Controlling a sound effect with a Picaxe 14M2 or 20M2

rob53

New Member
I don't know if this is the right forum for this and I've seen a bunch of similar threads on various forums, but my situation is somewhat unique. I'm wanting introduce a photon torpedo sound effect to coincide with the LED flash in my enterprise refit lighting effect picaxe program.

For the torpedo lighting effect, my code ramps up the red diode on a red/blue bicolored LED (via pwmout), then gives a quick 100ms burst from the blue diode, then the red diode fades out

Code:
PwmOut PWMDIV4, B.2, 99, 0
        For pwmB = 0 To 400   ;ramp up the red LED
          PwmDuty B.2, pwmB
          Pause 2
        Next
        High B.3
        Pause 100   ;quick burst from the blue side
        Low B.3
        For pwmB = 400 To 0 Step -1
          PwmDuty B.2, pwmB
          Pause 2
        Next
        PwmDuty B.2, 0
Then with the next button press, that same sequence of code repeats on another red/blue bi-LED on B.4 and B.5 (14M2 chip), alternating between left and right torpedo launchers on the 32" 1/350 scale USS Enterprise models that I build.

Code:
Case 2
        PwmOut PWMDIV4, B.4, 99, 0
        For pwmB = 0 To 400
          PwmDuty B.4, pwmB
          Pause 2
        Next pwmB
        High B.5
        Pause 100
        Low B.5
        For pwmB = 400 To 0 Step -1
          PwmDuty B.4, pwmB
          Pause 2
        Next
        PwmDuty B.4, 0
        buttonB = 0
    End Select
  Loop
Ok, now to the point. I have a .wav file of the authentic photon torpedo sound effect. I'm wanting to build some sort of slave device to record that file off of my computer and play the sound, having it triggered by the picaxe output pins that control the "blue burst" (through a lower power transistor if necessary).

The wav file is only a 15.5KB, single channel, 8bit sampling, 8khz, nothing fancy. I can build most any small project with a schematic. However, I don't want to spend a bunch of money on it. I've seen these little sound modules like they use for greeting cards that can record and playback tens or even hundreds of seconds of audio. All I need is two seconds of single channel audio. There must be a simple solution for this, but I've looked all over and haven't come up with one.



I'm relatively new to micro-controllers, and hobby electronics in general, though I've learned a whole lot in the few months that I've been playing with it. I could just buy something and connect it into the picaxe somehow, but I would rather build it myself if I can learn how. Any advice would be much appreciated.
 

rob53

New Member
Hi, erco. Thank you for replying. The only problem with that one is there's no interface with my computer. All it has is a mic for recording voice messages.

If I did use something like that, that does have USB interface for downloading my and playing my wav file, would it work to clip off the "Play" button with some wire cutters and wire it into the picaxe output pin that controls the "blue burst"?? I would also need to remove those batteries and somehow connect it to my power supply (9v wall wart), as it has no interface for external power.

That's kinda why I was hoping to build something from scratch, so it can be designed to suit my individual (and simplistic) needs, which it just to play that 2 second wav file from the same signal that controls the blue LED "burst". The way those bi-colored LEDs ramp up, then quick flash, then ramp down, is kinda like a perfect built in "one-shot" timer switch.
 

Jeff Haas

Senior Member
Rob,

You're probably going to have to spend a bit more than what erco suggested to get a direct interface to your computer. Take a look at this module from Electronics123.com:

http://www.electronics123.com/kits-and-modules/Audio-Effects-and-Sound-Modules/75-second-USB-recording-module.html

I have a variation of this that I used as part of an interactive exhibit, I replaced the cheapo button with a small relay and the module performed perfectly. They have instructions on how to use a transistor for the same thing, but I had a silent relay module handy. The sound module I have is a bit more expensive and has a jack for connecting a speaker, but even with the built-in speaker it sounds pretty good.

This is the easiest way to do what you want. Other methods work but need a bit more effort in programming.

Jeff
 

erco

Senior Member
Jeff: Thanks for posting. That site has a variety of affordable sound modules with different features.
 
Top