With this synthesizer you can make Arduino reproduce totally customized waveforms. Due to the MIDI interface, it can be connected to any instrument which such feature and play it with the sound you want.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials
- Arduino (in this case Arduino UNO)
- Instrument with MIDI interface
- Wire for connections
- Capacitors: 220µF, 10nF, 0.56µF
- -Resistors: 10 Ω
- 8 Ω speaker
- Pins strips (male and female)
For soldering (optional):
- Soldering iron
- Strip board
Step 2: The Amplifier
This amplifier is made for low voltage, it can afford until 18V at supply voltage.
First of all, we should put all parts together in the breadboard and check that everything works properly, just like at images. A breadboard is not a good option for sound circuits due to the parasitic capacitances, what introduce noise in our sound signal. Therefore, after test that everything work as expected, it is a good idea to solder it to remove noise effect.
Step 3: Soldering the Amplifier (optional)
If you never tried soldering before, read this Instructable first:
For the soldering we will use a strip board for prototyping.
We need to place the components where it is indicated in the design and solder them. Then, some parts of the circuit need to be isolated from others. For this we just need to cut some strips on the reverse part of the board: the strips behind the chip, and the strips at pins that are not used (they are included to attach it to Arduino shield).
Also in this case we included two extra connections that were not used in the breadboard design, they are marked with red wire. This connections are made for gain control. At the moment the gain of the amplifier is 20, if we add a capacitor (around 10uF) between this pins, the gain increase until 200.
Step 4: The MIDI Conection
As we said at the beginning, we need an instrument with MIDI interface to generate the notes. The MIDI connector has 5 pins, but only 3 are used: GND, VCC and DATA. VCC is not needed, so we just need to connect GND and DATA to the Arduino board.
Then, with a MIDI cable, we can make the connection with the instrument we are using.
Step 5: The Code
Now we just need
to load the code into the Arduino. The code uses MIDI library and Mozzi libraries, that should be installed. This libraries can be found here:
If you don't know how to install a library for Arduino, follow this link:
Step 6: Test It!
Now you just need to play! Connect everything properly and start testing your creation.
The audio input of the amplifier came from pin 9 of Arduino (in Arduino UNO).
If something went wrong:
In case you cannot hear anything, check the led indicator on Arduino Board. It should be ON when a note is pressed, and OFF when released. If this does not happen, maybe something is wrong with the MIDI connector.
If you can hear it, but does not sound good: This project uses PWM based sound, what does not deal good with low frequency sounds. Increase the scale of the instrument if possible. If not, change the parameter INCREMENT_NOTE at the beginning of the code. Try different values until the sound improves (it should be a positive value, maybe several tens).
Step 7: The Wave Tables
In this case, the sound is obtained from the addition of two sinusoidal waves. You can experiment with different sounds changing the wave table. Mozzi includes more already-made tables which can be used. For this, you can follow the instructions in the code and comment the section of “SINE WAVE” and uncomment another section.
You can even create your own tables and try them with your personalised wave form.
Step 8: Further Ideas
The duration of the notes are divided in 4: attack, delay, sustain, release. This times change the way the sound. Instead of manipulate this times in the code, we can add an external hardware control, and change the durations at anytime.
Also, an external control can be added to switch between different wave tables. This way the sound can be changed faster, at the same time the instrument is being played.
If we want to improve the sound quality, we should use a Digital Analog Converter. This way, we can use the digital exits of the Arduino shield to indicate the analogical value of the wave at the moment, then the converter will turn it into analogical value. The sound will be softer and we will be able to hear lower frequencies.