Rapid audio repeat

Hello all - I'm looking for a little guidance here. I'll start by explaining the application.

A friend has an old WWII truck with a replica 50cal machine gun on top. He has it rigged up to a compressed air system so that the bolt operates when the trigger is pulled, etc. It's really cool, and should be a blast at reenactments, parades, etc.

My part of the project is the audio. We have a button integrated into the trigger, and I'm trying to build and program something that will play a single gunshot audio clip when the button is pressed and released. When the button is held, we need it to play this audio clip rapidly on repeat, so that once the button has been let go, it will finish the last gunshot and stop. (machinegun)

The audio will be put through a custom car audio system all concealed in a box disguised as an army footlocker. JVC head unit to a crossover, (2) 12" 1500 watt kicker subs powered by a 2000 watt amp, (4) 6x9's by a smaller amp, and some 1" titanium tweeters probably straight off of the crossover. So, wherever the audio comes from, I want it to be clean and clear.

Does this sound feasible? I don't know if the wave shield is up to the task audio quality-wise. I was looking at some MP3 shields, and they look a little more promising in that regard. I think the repeat part should just be a matter of programming, but I wonder if the hardware can play the clip on repeat rapidly enough for it to sound right.

Thoughts, comments, and suggestions are greatly appreciated.

mp3 modules usually have a set-up time per clip to initialize the mp3 state/buffers.

Any module using SDcard samples may also have setup-time for opening the file
afresh too.

You want something with enough RAM to buffer the maximum length of uncompressed
audio you need, which is a tall order for a small microcontroller - even the Mega has just 8k.

How long is the sound of one gunshot??

A .wav file can be various formats. 8 bit depth may be OK for a gunshot. 8 Khz may be fast enough for sampling. If the gunshop is 1/2 second it could go in RAM on a Mega. A .wav playing shield might do OK if you can program it right. Hmmm..

Take a look at the Arduino DUE it should have the legs for this. But you are better off looking for an MPĀ£ player that you can control from the Arduino without having the MP3 file going through the Arduino.

As an alternative you could try contacting some where like the "tank museum" at Bovington dorset UK the model makers there should be able to help. Many of the model tanks on display at the tank festival have sound systems. You may find something off the peg which does not require and arduino.

Mark

Well, I suppose it's essentially a half second clip of an explosion, so some distortion may not really matter all that much.

If I sacrificed some quality, I could get it quite small. Under 8k... I guess that would take some trial and error to see how it sounds.
If I can find something with enough RAM, will it store it as soon as it powers up and leave it in RAM until powered off?

I may try contacting that tank museum if I conclude this isn't going to work. I like the idea of being able to program it however I like, use different audio if necessary, time it to the gun, etc.

I was also looking at this: http://www.amazon.com/gp/product/B004G2KRXS/ref=gno_cart_title_2?ie=UTF8&psc=1&smid=A30ZYR2W3VAJ0A
It looks simple (simple is good), but I don't know if it'll be able to repeat as fast as I need it to. I don't know anything about the microcontrollers it lists in the specs.

So I had an idea last night... please tell me if this sounds do-able.

Rather than having it replay a single half second clip over and over again, I could make a full 2 minute clip of this half second gunshot repeating. In theory, would it be possible to program it to play this clip to play in half second intervals until the button is released?

Example:
Button is clicked - plays a half second of the audio clip. (one shot)
Button is held for 3/4 of a second - plays clip for one second. (two shots)
Button held for 1.2 seconds, plays through 1.5 second mark. (three shots)

This way, it doesn't have to reload the file repeatedly, and the only lag would be on the first shot. I guess the tradeoff would be a larger file to load initially, so there may be some additional lag on the first shot.

The (basic) Arduino cannot do MP3.

There are MP3 modules, whether it is convenient to make them operate rapidly, is another matter.

The module you want is a "Voice recorder" module, readily available. It has controls for record and play, many or most have a microphone attached which you can reconfigure, and a spill for a speaker. They generally have space for recording up to a minute or so, possibly more than one "message". That's the sort of device you are looking for.