im making a small project and i need sound in it, but i dont want it connected through serial for the sound
is there a simple way to play a small sound file when a button is pressed??
try a search on google using the words: arduino sound play
There's lots of ways to play a generic beep or buzz.
When you say "play a sound file," I assume you mean a specific sample. Probably the simplest thing to do is leverage a pre-built sound board, or hack one; a toy, one of those digital "memo" recorders -- you can get something that will play back a sound for you for probably under twenty bucks. Just figure out where to attach the power, what pins have to go logical high to make the chip start playing, and borrow some digital out pins on the Arduino to trigger it.
For instance, this cheap board from Radio Shack --> RadioShack.com Official Site - America's Technology Store
well i wanted to put a custom gunshot type sound for the arduino to play with a small speaker when the "trigger" button is hit
best way would to crack open something small and do it that way??
Heh. Oddly enough, that's the task that got me into Arduino -- and I just got back this minute from a theater where they are using it.
Not sure you'd like my solution, though. Which was to output a MIDI note event from the Arduino and trigger a sample player (or, in this case, show software running on a Mac laptop).
Anyhow. Yes, those little chips will do okay at playing back a sound. Most of them are limited to a lo-fi 8 kHz sampling rate, though. However, they can be very cheap; seven bucks for this one --> http://www.electronics123.com/s.nl/it.A/id.499/.f?category=2 and easy to use. The ISD chip a lot of these things use has built-in mic pre-amp and a line input, plus a low-power amplifier right on the chip to drive a small speaker, and will run on 5V.
Also, a lot of these chips are pre-programmed for toys and you can get a few with gunshots already on them. Less flexibility that way of course.
Next step up in geekiness would be to attach an DAC to the Arduino and send your sound out the serial port. Or attach white noise generator and ADSR and synthesize your own gunshot. Further along that road, rig up a pyro unit to make your own bang.
In the direction of performance simplicity, send the Arduino data to a computer (however you can do it), and use Max/MSP, or Processing, or some other application to play your sound file. This method has the distinction of being the highest sonic quality -- and possibly the most flexibility as well.
thankyou!, that might work.. ill keep looking around and playing with some stuff... any more input is apreciated though!!!
Let me emphasize the ease of those chips, especially as pre-wired on a little board (like the Radio Shack offering). Recording is as easy as recording a message on a telephone answering machine. (Quality is similar too...!)
But MIDI is easy, too. It's just three wires to a MIDI jack, and a simple code to the serial out.
(Reminds me of another arty idea I got on the way back from Maker's Faire; set up solar cell and one of those "burst storage" devices -- that's storage capacitor, power regulator/switch -- and the exposed guts of a mini-cassette dicta-phone. When in strong light, would occasionally come to life and play a short snippet of recorded material -- say, birdsong. Create a half-dozen of these things and you have a sort of solar wind chime.)
on that link you sent me i saw a 2x 20 second one... i think ill use that all i need is 2 individual sounds