Multiple synthesizer projects have been done for the Arduino, but few have been able to utilize the full power of the Arduino processor. DZL from GeekPhysical wrote a 4 voice wavetable synthesizer that is one of the more advanced software based synths for the Arduino.  It has wavetables included (sine, saw, square and triangle) and envelopes to create beats.

This instructable will show you how to make a simple sequencer that plays a little melody. You can hear how it sounds here:

It is up to you to modify the code to do many other things. Possible examples could be a midi controlled synth (sample code included), it could be a strange noise machine like this one:

Or you could detect touch and convert it into sound patterns:


Step 1: Parts

You should use the following parts:

  • Arduino board
  • BreadBoard
  • Wires
  • 2.2k Resistor
  • 100n Capacitor
  • 100u Capacitor
  • Jack where left and right channel has one wire and one wire to ground
  • A pair of computer speakers

  • Don't worry if you don't have the exact values. It will probably work, but might be with lower sound quality. The Arduino is not powerful enough to drive a pair of headphones so you will need some kind of preamp for that - e.g. a headphone preamp like this one.

    <p>i'm sorry, i feel a bit stupid : i built the thing and loaded the code on atmega328.... how do i play it now? I loaded the midi synth... should i play it from my daw? thanks</p>
    <p>would it be possible to use just two voices, but each on a separate PWM output to get effectively two detunable oscillators (detune realized by global pitchbend wheel and a dedicated detune knob, both read by analog inputs). Also how hard would it be to add a keyboard without using another Ardunio/uController? </p>
    I want to do the same thing did you ever figure out how to output different pins?
    unfortunately no. I'm building a Meeblip Anode instead, but check out the Midimuso website, a guy sells preprogrammed atmegas that do just that, they cost about 8 pounds each
    <p>unfortunately no, I just had to lower my expectations and use single pin :/</p>
    <p>Has anyone got this to compile in the 1.6.0 IDE? thanks</p>
    <p>I'm getting compilation issues as well fizz. Are you getting error messages like this?</p><p>In file included from IllutronBDemo0_2.ino:32:0:</p><p>sin256.h:4:23: error: variable 'SinTable' must be const in order to be put into read-only section by means of '__attribute__((progmem))'</p><p> PROGMEM char SinTable[]=</p><p> ^</p>
    <p>I had that problem, just go through the tables.h file and add &quot;const&quot; before all the tables</p>
    <p>My problem was the Import/Add Libary automatic installation method does not <br>work with the folder structure of the zip file. For any arduino newbies like myself, <br> open the_synth-master.zip, then the_synth-master folder, then copy and paste <br> or drag and drop the_synth folder(not synth-master) into My Documents\ Arduino\libraries</p>
    <p>I've been having endless fun with this! I've been making a sequencer with lots of functionality that I'll make available soon.</p><p>Could anyone tell me if there any way to reduce aliasing noise? In particular with &quot;clean&quot; sounding waveforms like sine and longer-duration notes, there's quite a bit of noise as the note decays. Is this unavoidable? Thanks!</p><p>Regarding some of the problems other have mentioned below: It's necessary to add &quot;const&quot; to the variable declaration for the tables stored in PROGMEM. </p>
    Hey there, awesome project. Im actually working on the groovesizer by MoShang but am not able to get any sound out so I came over to yours as there are less components to see if I could get sound out at all. <br> <br>Im having the same problem, code is uploading error free but Im still not able to get any sound out! <br> <br>Im running windows 7 and using an Arduino Mega2560 and have the circuit built on a breadboard. The sound is going out to an iHome rechargable speaker. <br> <br>My questions are is there anything that I need to change in the code since Im running a different board? And is there anything that I can be looking for or testing with a multi-meter to see if theres something I have messed up in the building of the circuit itself? <br> <br>Thanks!
    Have you solve the problem? I am facing the same problem. Can you share with me what should be done?
    I also have an Arduino Micro that I could try this out on if its supported
    <p>Great tutorial. Could you please explain a bit more about the circuit. How does it all work. I've noticed that when I use 1 K ohm resistance instead of 2.2. I get better louder and better quality sound</p>
    <p>I've just built this with the new version of the code and the differential circuit. It sounds great with headphones. I found a rather oversize (high current) 9mH inductor that is very bulky. My background is programming, not electronics. What type of inductor would you recommend for the low pass filter of this circuit?</p>
    <p>I've been using a 12mH inductor with a .33mf capacitor for the low pass filter, with excellent results in both the single-ended and differential output modes. It is optimized for telephony frequencies from 300Hz to 3000Hz. It reduces the 20KHz sampling frequency by 40dB. You can also substitute a 150 ohm resistor for the inductor. It provides 20dB of attenuation of the 20KHz, with a small loss of volume. The inductor sounds better.</p>
    <p>Excellent library! However, it would not work with any Atmega 32U4-based boards (Leornardo, Micro, Pro Micro, etc) as it uses Timer 2 for the timer output compares. Timer 2 is missing from the 32U4. I re-wrote the library using Timer 4. This has the advantage of offering a few more differential output modes that were not possible with Timer 2. This is possible because the 32U4 has two addition timer output pins that mirror the state of the primary pin. Not all pins are available on all 32U4 Arduinos, but if they are, the library mod now supports them. The pins mentioned are the standard Arduino pin mappings to the Atmega 32U4.</p><p>The new modes are:</p><p>DIFF_10_13 - Differential mode on pins 10 and 13, same as old diff. mode</p><p>CHB_9 - Single-ended mode on pin 9 (channel B)</p><p>CHB_10 - Single-ended mode on pin 10 (channel B)</p><p>CHB_DIFF_9_10 - Differential mode on pins 9 and 10 (with Channel B only!)</p><p>CHA_5 - Single-ended mode on pin 5 (channel A)</p><p>CHA_13 - Single-ended mode on pin 13 (channel A)</p><p>CHA_DIFF_5_13 (default) - Differential mode on pins 5 and 13 (with channel A only!)</p><p>Example: edgar.begin(DIFF_10_13);</p><p>New library is at:</p><p><a href="http://projectmf.homelinux.com/Arduino/Synth/" rel="nofollow">http://projectmf.homelinux.com/Arduino/Synth/</a></p><p>I used the library to build an old-school phone phreak blue box, as it allows generation of multiple sine waves. See df9999999999 YouTube channel for details.</p>
    <p>My speaker have 12Ohm + 100Ohm rezistor.</p><p>For <strong>tune </strong>command was working OK.</p>
    <p>Hello,</p><p>I try to use your instructions and run one of your examples, concrete different_pins_and_modes.</p><p>I'm using Arduino Leonardo. I try mostly everything but I cannot hear any sound from my speaker. Should I change some settings or what can be a problem?</p><p>Thank you</p>
    <p>Please ignore my previous comment! I just had to move the header files to the directory of the sketch. I want to know how to control the MIDI synth though. I'm not sure what you mean by the Arduino receiving MIDI over serial. Is it the Serial Monitor?</p>
    <p>Thanks for uploading this! Unfortunately I'm having some trouble and can't get the new code to work though. the old code works just fine however. Whenever I try to compile the new code, I get an error like this:</p><p>song:22: error: 'synth' does not name a type</p><p>song.ino: In function 'void setup()':</p><p>song:27: error: 'edgar' was not declared in this scope</p><p>song:27: error: 'DIFF' was not declared in this scope</p><p>song:29: error: 'SINE' was not declared in this scope</p><p>song:29: error: 'ENVELOPE0' was not declared in this scope</p><p>song:31: error: 'ENVELOPE2' was not declared in this scope</p><p>This was for the song file, but it's the same error for every file.</p>
    Great project, thanks! I'm having problems getting a sound output using a Mega 2560 - the code seems to run fine (at least it streams the counter values out to the terminal) but there's no output that I can find on any of the PWM pins. Is there a simple fix do you know, or is it a huge amount of work to get it to run on the Mega due to the different architecture?
    Im having the same issue, did you ever discover a fix for this?
    <p>Try the updated version.</p>
    <p>Hey! How can we try the code if the cpp files aren&acute;t there??</p>
    The ino files contains what would normally be a part of the cpp file. It is an Arduino way of doing things.
    I'm relatively new to arduino, but the program keeps telling me various parts of the code contain errors... <br>Running ubuntu 64-Bit, Arduino Duemilanove.
    hi my friend,, please might upload the code for arduino leonardo, thanks, regards from Bogota Colombia
    if your wondering if it works on the leonardo yes it should
    awesome projects, Mads! can you share a link to code/wiring or at least some more info about the touch sensing-sound conversion circuits as in the &quot;mediated body&quot; clip? I am interested in integrating something like this into a larger project out on the playa... <br>thanks
    Look at the instructable on touche or the singing plant under my profile and you will find two good examples. Good luck with BM.
    Hey so I have everything set up, but because Im very new to this I guess I'm a bit confused on how to upload this code. Ive downloaded all the files...now what should I do?
    Hello, i'm seriously thinking to build this project, but what code i have to choose from link?
    All of it, but open it with the &quot;synthOriginal.ino&quot; sketch.
    That is one chunky breadboard...
    Wonderful. I noticed you commented out some midi support. If I un-comment it, what pins should I use or it it not completed yet?
    That was really inspiring. I've reproduced your tutorial and everything was smooth and clear. It worked the first attempt. <br /> <br />However, I found a bit difficult to understand how External Midi works in this code and with this hardware layout. <br /> <br />It would be great to know where is supposed to come in the MIDI IN signal. <br />Could you possibly link to any MIDI interface compatible with your design? <br /> <br />Thanks in advance for any further information or links to better understanding the MIDI interfacing.
    Hello. <br>I have two questions: <br>I've tested it and it sounds better (and louder) without caps and resistors, wiring ardu pin to jack directly. What have I done wrong? <br>And, please, can you post a more hackable code? Sound is awesome but I can't imagine how to do things, p.e. read some buttons for change pitch. <br>BPM: Your video demo song is slower than my attempt, Where can I change BPM? <br>Thank you very much. <br>
    G E N I U S !!!
    Funny!! but I don&acute;t know very well where can I change the parameters. Thanks!
    That is a whole other story and quite a challenge - I dream of releasing a simplere version that is more hackable. This version shows off the potential, but uses a couple of advanced tricks. Remove the demo tracker part and just play notes yourself then you can get a feel of ways to play it.
    Can you explain how to program this a bit more? I just built the circuit (2 minute build) and am trying to program this thing and am encountering lots of trouble. <br> <br>Being completely honest, I never coded in the &quot;arduino&quot; language and it's frightening me.
    Great to hear that you are using it! I think there are lots of tutorials who have already explained how to program an Arduino and they do a much better job than I could. So I will just give you a couple of links: <br> <br>http://arduino.cc/en/Guide/HomePage <br>http://www.youtube.com/watch?v=4HqXAmV_Ock <br>http://www.ladyada.net/learn/arduino/lesson1.html <br> <br>Let me know if you succeed.
    The 3 things that ususally causes trouble: <br> <br>1. On windows you have to install the proper drivers (sometimes also on mac). <br>2. Remember to select the right serial port in the gui. <br>3. Remember to select the right board in the gui.

    About This Instructable


    138 favorites


    Bio: IMPORTANT: Please do not message me personally with technical questions. Use the comments in the respective instructables. I really love sharing and helping people makes ... More »
    More by madshobye: Guino: Dashboard for your Arduino Making noise machines Making sound (noise) machines
    Add instructable to: