Introduction: How to Make an Arduino Sound Synthesizer With MIDI Interface

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.

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
  • Breadboard
  • LM386
  • Pins strips (male and female)

For soldering (optional):

  • Solder
  • Soldering iron
  • Sponge
  • 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:

https://www.instructables.com/id/Electrical-Soldering/

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:

http://sensorium.github.io/Mozzi/

https://github.com/FortySevenEffects/arduino_midi_library/

If you don't know how to install a library for Arduino, follow this link:

http://arduino.cc/en/Guide/Libraries

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.

Comments

author
DylanB5 (author)2015-07-24

I can't tell which of the two blue capacitors on that Fritzing diagram is the 10nF and which is the 0.56µF. Can you specify which is which please?

author
Spio (author)DylanB52015-09-02

hi,

i've found this instructable you can use also this amp

https://www.instructables.com/id/LM386-Audio-Amplif...

author
Spio (author)2015-09-02

HI,


I'm trying to build your project , but I have a problem , it doesn't work :) .

I connected the center pin of the MIDI out of the keyboard to GND , while the pin 5 of the midi connector to the digital 1 (tx) . Then, instead of using the circuit for the amplifier, I connected the pin 9 of Arduino to an output jack and I plugged the jack in a little speaker ( in practice as it is explained on the mozzi library's website) .

So I guess I made some mess with the MIDI out of my keyboard . can you add a picture or a draw of the connection of the keyboard's midi out to arduino?

Thank you

author
tomatoskins (author)2015-03-03

This is a great idea! I love the concept of making your own sounds through the arduino!

About This Instructable

9,733views

53favorites

License:

More by Cristhian180:How to make an Arduino sound synthesizer with MIDI interface
Add instructable to: