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.
28 thoughts on “5 Tones, 1 Arduino”
Oooh quite interesting, i’ve got to look into this some more.
Finally!! I tried doing this months ago and failed =\
i dont really get why he’s using _five_ speakers instead of making a sum of his audio and sending it to one speaker?
Yes, its mainly for artistic purposes for the project I’m doing.
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…)
Of course! I’m driving the speakers using transistors.
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.)
@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.
is there not a video of this in action, or am I just blind?
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…)
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.
tomas its called a passive mixer, look it up
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.
“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
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 :\
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.
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.
it’s an old trick used by chiptune musicians in the olden days
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.
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.
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.
check my poly http://gieskes.nl/instruments/?file=hard-soft-synth-3
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.
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 :(
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.
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).
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
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?
Please be kind and respectful to help make the comments section excellent. (Comment Policy)