I'm very new at electronics and whatnot, please be gentle.
I want to have a random WAV to be played after I trigger it with a Piezo or other type of sensor. Is this something I can do with the programming aspect?
Example: When I strike the Snare pad I want 1 of 10 random snare sounds to be played, mimicking a more natural and dynamic sound.
Alternate option 1:
Sequential playback of the files could work as well, so when I strike the pad for the first time 1.wav gets played back, on the 2nd strike 2.wav, etc.
Alternate option 2:
I could mount 10 piezos in to one pad, and somehow with or without space magic have them only be active one at a time, disabling itself after being triggered and activate one of the other piezos. This seems a rather unlikely option because I'm guessing timings will be tough cookie, but maybe worth pursuing.
Thanks in advance!
The Arduino function random() will produce a different random number each time it is called, for example in the range from 1 to 10.
The call to random could be followed by a series of 10 if or case statements, each of which would make a different sound.
The basic idea is certainly possible but you might find you have real timing problems if you're going to read a hit and then find one of ten .wav files to play so a full 10 item random round robin might be a bit ambitious. Particularly if you're planning on a full drum kit not just a single drum. Playing more than one .wav sample at a time will be tricky.
But if you Google "Arduino drum kit" or "Arduino drum machine" you'll find plenty of people have already made a good start on this for you.
Steve
jremington:
The Arduino function random() will produce a different random number each time it is called, for example in the range from 1 to 10.
The call to random could be followed by a series of 10 if or case statements, each of which would make a different sound.
Thanks, this is a good lead for me to read up on.
slipstick:
The basic idea is certainly possible but you might find you have real timing problems if you're going to read a hit and then find one of ten .wav files to play so a full 10 item random round robin might be a bit ambitious. Particularly if you're planning on a full drum kit not just a single drum. Playing more than one .wav sample at a time will be tricky.
But if you Google "Arduino drum kit" or "Arduino drum machine" you'll find plenty of people have already made a good start on this for you.
Steve
For now, I'm fine with the idea of just building this for a single drum pad. I can always expand the drum kit with a 2nd and 3rd Arduino board.
Would it matter much if instead of 10 wav files I'd do it with 5, or even 3?
jremington:
Not to us!
That's very comforting to hear!