Realistic piano notes with Arduino Uno

Hello dudes

I've just created a paper piano with an Arduino Uno (similar to this, but the sound of the keys is so horrible. Is it possible to make my paper piano sound like a real piano? I understand that I will probably need extra software and hardware...

Can you please guide me? I'm completely new to Arduino.


You will need an extra computer, too. The Arduino is not capable of generating complex sounds.

If you look at a note with an oscilloscope, you can envision its envelope. Notes will have an Attack curve, some Hold time, a Release shape, and then Decay or fadeout shape.
What you can do is combine an external Multiplying DAC that you control with Arduino to control the gain of an Tone that Arduino generates to start making a more complex note.
To get a piano sound tho, the frequency is a lot more than a simple square wave that you perhaps filter and then control the shape of. You really need a Midi Sound module; you can send it Midi notes to play from an Arduino.

This one has very good piano sound for example. My wife used this with a very good keyboard controller (Fatar SL880, keyboard only, no sound output, very good piano feel) until she decided she needed even better piano keyboard feel and we picked up an older babygrand piano that she plays now.

You can get better sounds that don't just "beep", but they won't sound like a piano. They will sound like the tones from one of those wall Christmas clocks that play a song every hour. They have a nicer waveform than a square wave, and they have better attack/decay so it doesn't just cut off abruptly. Not great, but much more pleasing than just beeps. Also, they sound quieter unless you get an amplified speaker since they produce sounds differently than just toggling a pin at the right pitch.

Not trivial programming, so I'd suggest you search for arduino synth and see what software is out there. Search the audio forum for posts. I have a couple posts where I mention some software modified.


You could check this out to start. Code, schematic, youtube link to a video I made.

The problem with a piano sound is that every note has a different mix of harmonics and harmonic envelopes so you really need a sample for each note. You can just about get away with stretching one sample over an octave but that is it. I would, and have on many occasions, use a MIDI sound module. My favorite is the Yamaha MU10, long since obsolete but still available on eBay. You feed MIDI signals directly into it which the Arduino can generate. It also does other great sounds.

Failing an external MIDI sound module many computers have software sound generators. Garage band on the Mac has lots of sound you can trigger in this way. You need a helper application called Hairless ( it is free ) to convert the normal serial connection from an Arduino into MIDI.

There is a project here where I used the MU10 to make a chaotic pendulum trigger MIDI notes. There is a video with some of the sounds on it.

CrossRoads: You could check this out to start. Code, schematic, youtube link to a video I made.

I made a program sort of like that, allowing any number of tones to be played together. I hooked it up to another program that read midi notes and it would play converted midi files. I liked it, but my wife and daughter thought it sounded awful, so I went back to using some synth software I found. Back to the Christmas clock sound.