Arduino has a built in function “tone()” to play sound. It is simple and efficient, while the only problem is the sound quality. The tone function uses square waves, which have only odd harmonics. This harp uses wavetable synthesizer to generate a 6-channel chord tone. The sound is controlled by the touch harp.
The wavetable synthesizer on AVR was first introduced by elm-chan. I tried to transplant the code to Arduino IDE, but it is too slow. Finally I used C code directly.
I removed the melody reading function and used the touch sensing function instead. The circuit is based on the schematic in “PreSense: Interaction Techniques for Finger Sensing Input Devices”. The human body is equivalent to a capacitor which is greatly larger than the distributed capacitance of the IO port. So the sensing pin needs more time to charge when touched. One problem I noticed is that the high frequency current from the PWM port may affect the sensing of the surrounding pins.
The circuit was drawn by Fritzing (seems quite unprofessional). I used a smaller resistor to shorten the time of sensing.
There is a performance. Please forgive my skill.