Don't Know Enough To Ask The Right Question, But ....

Hi, I have built an Audino which I am very happy with however I want to add the ability to strike something to play the notes and have the note decay in a reasonably organic way.

I am happy enough to use a simple push button, its the decay I am more interested in for now, is there a commonly used function (mathematical - not looking for code) which gives a good approximation of the decay of a stringed instrument and if so is the decay of a drum similar or a vastly different function ?


Duane B

I think the decay of a drum or plucked string is typically exponential. It decays by half in a short time period and in the next time period has decayed again by half for it's down to 1/4. Then in the next time period it decays again by half to 1/8th strength.

For a drum (except the Tympani) the decay is very fast.

If you want to make drum noises you might want to look into analog drum machine circuits. The Arduino is not great at digital signal processing but would be great for triggering analog circuits.

Google envelope attack decay sustain release you will find a bunch of stuff to start.

This one looks interesting

This article from Analog Devices also covers a lot. Well, maybe overkill for what you want.

What you could do instead, is use a DAC like this and feed the Vref pin with your output (PWM?) frequency and then control the output envelope by sending the DAC data over time that represents the envelope shape. You could change the PWM frequency over time too. Run the DAC output thru a big cap to let the 0-5V output become +/-2.5V max, feed that into your amp that drives your speaker, or whatever. Bank of DACs on the output of 15 PWMs from a Mega2560, 15 digital triggers, or 15 analog triggers so you can manipulate the initial volume of the output note, all kinds of possibilities!

Thanks both,

Duane B