Playing chords with Arduino and one buzzer

Hello dudes

I'm about to start a paper piano project and I wonder if it's possible to play several tones at the same time with Arduino and only one buzzer. Can you please help me with tips?

If you are using the tone() function to generate notes, you will need a mixer to combine the sound from all the pins that you output to. For example, a resistor network. That is the cheap and simple solution. Otherwise you would have to add a hardware DAC and write your own tone software.

The standard 'tone()' function can only generate sound on one pin at a time, so chords are out.
From the "Tone" reference:-

Only one tone can be generated at a time. If a tone is already playing on a different pin, the call to tone() will have no effect.

Tone

(Bloody annoying, isn't it? :frowning: )

So yoy mean a resistor network won't work?

natito:
So yoy mean a resistor network won't work?

I don't understand what you're trying to say. What resistor network, connected to where?

It would only work if you could have tone on multiple pins. But I was mistaken, you can't.

It was aargs suggestion (see post #1)..

aarg:
It would only work if you could have tone on multiple pins. But I was mistaken, you can't.

Ah, now I follow. I missed the resistor network reference in your earlier post. I thought natito was suggesting a resistor network as a means of getting around the fact that 'tone()' can only output on one pin at a time.
(And I had to quickly read the "Tone" page to double-check that I was right on that point, by the way. :slight_smile: )

natito:
It was aargs suggestion (see post #1)..

Yep, no worries. I'm a bit slow at this time of night. (8:35pm here.)
Edit: And sorry to ruin your plan, by the way. :frowning:

If I don't use the standard tone() function... is there any other way to play chords?

You

natito:
If I don't use the standard tone() function... is there any other way to play chords?

Buy a guitar? :smiley:

You haven't yet mentioned which Arduino.

In theory, Arduinos like the Mega2560 should be able to produce chords, since they have a number of spare timers. Have you done a good search?

You could check out this library. It claims to be able to produce multiple tones at the same time, with the number dependent upon the number of hardware timers the chip has:- Tone Library Documentation - rogue-code
(I've never tried it, and only just found it, so can't help with it's use. You'll need to do some reading.)

I have arduino uno

You haven't mentioned specifications yet. How many tones? Does it need to sound good, or would a cheezy sound be okay? Do you want an ADSR envelope? etc.