Basys 3 Keyboard Synthesizer
by chloeusebio in Circuits > Gadgets
5922 Views, 25 Favorites, 0 Comments
Basys 3 Keyboard Synthesizer
This tutorial will tell you how to make a synthesizer using VHDL and a Basys 3 board. To begin, it is important to have some background information on how synthesizers work. A synthesizer is basically a keyboard that emits different tones by producing different frequencies. It creates these frequencies by vibrating a speaker, which in turn creates areas of high and low pressure that our ears pick up as noise. More vibrations per second leads to less space between the high and low pressure areas, which are perceived by our ears as higher notes. In contrast, less vibrations per second causes more space between high and low pressure areas and creates lower notes. To cause the speaker to vibrate, one must send it rapid successions of high and low voltages. Obtaining sound waves that are perceivable by the human ear requires frequencies between 20 Hz and 20 kHz, or 20 to 20,000 cycles per second. Therefore the voltage must switch from high to low 20 to 20,000 times a second in order to hear a sound.
Created by Nick Lampe and Chloe Eusebio
Materials (pictured above)
- Basys 3 Board (bottom left)
- Pmod AMP2: Audio Amplifier (bottom right), which can be found and purchased at http://store.digilentinc.com/pmod-amp2-audio-ampl...
- Speaker with an auxiliary cord
WARNING: Cheaper headphones/speakers with lower power rating might blow out. Be careful with what you choose to output the audio.
How It Operates
The top block box diagram above shows the inputs and outputs. The synthesizer takes in three inputs (switch, stop, clkin) and has six outputs (freq, lit, gain, shutdown, an, cat). “Switch” is a 16-bit bus that determines which frequency is used (i.e. what note/sound is played). “Stop” is a button that when pressed down, stops the sound from playing. “ClkIn” is the system clock from the board, which runs at 100 megahertz.
The sound output is “freq”, which toggles between high and low an x amount of times per second, calculated by dividing 100 MHz (from the system clock) by the note frequencies we chose from the "Note Frequency Chart" above, and dividing that by two (See sample toggle count calculation above). “Lit” displays a lit LED that corresponds with which switch is on. “Gain” when set high is 12 dB gain and when set low is 6 dB gain. Shutdown will kill pretty much all current allowed to the speaker if set to high. Finally, the anodes and cathodes are used on the 7-segment display to show which note is playing. In order for one of the segments to light up, both the anode and the cathode corresponding to the segment must be set to a “0”. The anodes and cathodes are shown above (bottom left)..
Additional Features
- Use a potentiometer to add volume control. Using the PMOD Audio Amplifier produced a pretty loud sounds.
- Use the extra buttons for extra modifications to the output signal.
- One example of this would be changing the duty cycle of the signal.
Files
The following are attached: the main code for the synthesizer using Vivado, the constraints file (how signals were connected to the actual board), and the annotated version of the code (Comments are written in red, describing the function of parts of the code). If you want to know more about how the synthesizer works, read through the code and use the comments as a guide.
How to Use
Each switch when flipped up plays a different note with a different frequency. Only one sound can be produced at a time (i.e. only one switch up will work). The LED above the corresponding switch will turn on when that switch is in use. The corresponding note (disregarding sharps/flats) will also be shown on the 7-segment display.