I wasn't sure whether to post here or in project guidance but since this is audio related I thought here would be best.
I'd like to be able to play 2 discrete sounds from an arduino setup.
Sound 1. A steam train 'choofing' sound
Sound 2. A steam whistle.
Controls:
I'd like to be able to have these activated by
Sound 1. Latching button - sounds plays while button 'on'.
Sound 2. Momentary button. Sounds plays once when button pushed.
Now I'm sure this must be possible but the more Arduino sound threads I read the more confused I get.
(In an ideal world this project would have a further complication. The Arduino would control the speed of a set of train 'wheels' / cogs / whatever and the sound of the choofing would alter with the speed. But that's getting ahead of things for now I suppose.)
From my reading I'd need
Arduino with appropriate programming
SD card reader / SD card with the sound files on it.
Some sort of amplification circuit (ideal if volume can be changed)
A speaker.
I note that this isn't for an actual model train, it's for "evil project #1" to be revealed at a later date.
Any help, links to appropriate resources, hardware, libraries, circuits etc etc all welcome !
Robin2:
That is an interesting device but it has a large footprint.
If your referring to the links I posted then yes it is quite big compared to a model train. Maybe this is a bit better as the holder is for a micro SD card.
@Riva, you are a great source of interesting stuff. Thanks.
However the device in the link in Reply #4 also has 8 pins on each side suggesting a footprint of about 20 x 20mm or maybe 20 x 16. An Attiny 1634 SOIC is only about 13x12 - and you would need something like that also.
It would be nicer if an Attiny plus a micro SD card plus a transistor would be sufficient. It would also allow the "system" to be built without a PCB in a shape that would fit where the space might be available.
I have found a few links to web pages with simple Arduino WAV sound players. But it would be nice to know how good, or bad, the sound quality would be.
I had completely forgotten that I had investigated this about 12 months ago.
I resurrected my files and used the basic.ino program from the TMRh20/TMRpcm library. I created a WAV file with the first 30 seconds of Donna Summer's "Love to love you baby" converted to 32kHz 8bit mono and it played very well through my amplified speakers.
Ideally I'd like to be able to play 2 sounds simultaneously so the "whistle" sound doesn't interrupt the engine sound.
Footprint isn't a big issue - it's not going into a model train but into a PC case.
(also why did this say "You have exceeded the number of posts you can make in a 5 minutes period. Please try again later" when I've only made 1 post.... and trying to post a second.)
You're limited on posting for the first 100, it's an anti-spam feature of the forum. Little painful for new posters, but makes moderating bearable. Spamming was unbearable for a while, time limit between posts helped.
Hey, not sure if you ever resolved this, but I would suggest looking at teensy 3.6. It has a built in SD card and the audio library teensy comes with has polyphonic audio support! (meaning you can play multiple .wav sounds simultaneously). I'm building an O gauge sound system using this board and it has been working very well in conjunction with a standard amplifier. Cheers!