5 Tones, 1 Arduino

Because the Arduino is in such high demand for producing multiple musical tones at the same time; [Jeremy Blum] has successfully figured out the math and other necessaries that will take your once previously single tone producing MCU and turn it into a 5 tone producing machine. unsurprisingly its really just some creative use of PWM control but it all works out in the end anyway and helps prevent you from purchasing additional sound generating chips. This truly does open up some new doors, as [Jeremy] shows with his still in production thingamakit like project: ReacXion.


  1. Eirinn says:

    Oooh quite interesting, i’ve got to look into this some more.

  2. Finally!! I tried doing this months ago and failed =\

  3. i dont really get why he’s using _five_ speakers instead of making a sum of his audio and sending it to one speaker?

  4. Uh... says:

    Has this individual taken into consideration the fact that…

    …Atmel AVR chips usually aren’t meant to directly drive inductive loads with PWM?


    is there an amplifier in-between? A FET buffer? Just curious, but this seems like a good way to kill a micro.

    (Of course, these days, most people know how to code far better than they know the implications of impedance…)

  5. Same fellow here…Oops.

    I need to poke around websites more. Upon further review, looks like he’s using a transistor as a buffer. Still a bit goofy…but it makes a little more sense (in a cheesy sort of way.)

  6. tomas says:

    @stealthmonkey – if i understand correctly, making a sum of his audio and sending it to one speaker will take 100% of processor power, and still sound lousy. OTOH using the available pwm generators sounds more logical and leaves you with the cpu itself available for other tasks.

  7. walt says:

    is there not a video of this in action, or am I just blind?

  8. srw says:

    Why would adding five resistors use more CPU?

    or, to quote and slightly modify a previous comment:
    (Of course, these days, most people know how to code far better than they know the implications of resistance…)

  9. srw says:

    Of course, after actually reading his website, I learned that five separate speakers is actually a requirement for his project, not a lack of ability to mix the audio.

  10. osgeld says:

    tomas its called a passive mixer, look it up

  11. Justin says:

    Osgeld, it’s called critical reading skills and social awareness. please look into it and ask your doctor about aspergers.

    The end project looks pretty interesting and actually based on music theory! I can’t wait to see the results and the cooperative behaviors that emerge around it to see people exploring the musicality of it.

  12. osgeld says:

    “ask your doctor about aspergers.”

    maybe you should take your own advice

    where as my post may have been blunt, hopefully the individual that it was directed to will look up passive mixer schematics and see how simple they are, and gain that knowledge

    your response however serves no other reason other than to be an asshole troll

  13. Decius says:

    Omg, I was just thinking about this like 2 days ago lmao. I wish I had an arduino for things like this because I am a guitarist and I like to play around with effects this cuts the need for a pc and only for the board it self.

    I lack the free time to learn how to program :\

  14. Yann Vernier says:

    Awful summary. The article is actually of mild interest, about using only one timer interrupt to produce a number of simultaneous tones. It’s mainly of interest when the MCU is doing something else, as it leaves it almost entirely idle.

    On the more resource demanding end of the spectrum, I got eight channel wavetable on a pic16f628 (link in this post), and was fighting the poor architecture every step of the way – that would be way easier on an AVR.

  15. Jake says:

    Osgeld is correct. Simple passive mixer, get rid of the dumb speakers. Duh.

    No offense, but this has been done before. Maybe not on an “arduino” (lol) but that’s irrelevant… I fail to see how this is post-worthy in its current state.

  16. octel says:

    it’s an old trick used by chiptune musicians in the olden days

  17. localroger says:

    Then again for eight bucks you can use a Parallax Propeller (or if your’re really an Arduino addict sign up for a PropDuino so you can use your shields) and then you can just run the same single-channel PWM in five cogs. Ten minute project. The sine table is even in the ROM.

  18. Jeremy Blum says:


    I’m using 5 speakers for artistic purposes in my project, and had to come up with a solution drive 5. I purposely chose not to mix all the tones into one speaker.

  19. Justin says:

    I jumped the gun, Osgeld isn’t the asp of this thread. (and yes I was being a dick, though I don’t think my post was completely devoid of merit)

    It’s a smart piece of artwork and good technical problem solving. skills.

    The separate speakers has a lot of potential in an installation. A pentatonic scale has a lot of harmonic overlap so the way the waveforms are being generated are going to be phased in ways that will distort and overlap in a very natural way that will sound really different on where you stand by the piece. Also because we have 2 ears and brain is really good at locating where a sound is coming from it will be much more interactive and engaging to explore the possibilities than mushing the sound into one speaker.

    It is the same reason in recording a nice amp and a good sounding room are used in recording instead of direct to board. It defines the sound in ways that let stand against or support other instruments.

  20. gijs says:
  21. Jarkman says:

    We managed 3-note polyphony, with wavetables and ADSR envelopes, playing on an Arduino (with a 328):


    And yes, you can wire a speaker directly to the PWM output pin on an Arduino. It isn’t very loud, but the Arduino survices.

  22. Jeremy Blum says:


    Well put. Thanks! I’m really excited to see how the final product will sound, though I probably won’t get around to finishing it until winter break :(

  23. VisN says:

    A bit of a tangent post but here is something that impressed me : http://www.pic24.ru/doku.php/en/osa/articles/pk2_osa_piano
    a Polyphonic piano with touch sense of 36 keys(!) using a 16f88. I did not think the pic had the ability to detect so many keys via touch as well as it does, and only expect chirps out of the device.

  24. janin says:

    Without the Arduino layer, directly in C, the ATmega168 is perfectly capable of generating 5 channels (and probably more) of square wave sounds in software, and do the mixing as well using one PWM output in fast mode.

    There was another very nice project posted here a while back generated 6 wavetable channels @32kbps on an ATtiny45 (which has a superior fast PWM mode).
    See http://elm-chan.org/works/mxb/report.html

  25. John says:

    This has been done for awhile now (sort of) youtube bassdll and you will see one that uses 3 peizo speakers to make a nintendo like tune

  26. Yann Vernier says:

    Sorry to feed the troll here, but I just need to have it written that I disapprove of Justin’s offensive references to Asperger’s. As is common with such things, they make very little sense. Yes, your posts weren’t devoid of merit; why not let them stand on that instead of dirtying them with misleading attacks?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 96,661 other followers