Basic foreground & background

Ok now that you're done, you can see we have one file called T10HOLDL.WAV - this is a file that will play on loop as long as pin #10 is held down. There's also a couple T00RANDx.WAV files, these are files that will be played in random order when pin #0 is held down

Power the sound board and connect a wire from pin #10 to ground (not a switch!) you'll notice that the Darth Vader breathing sound is now playing on loop. If you then have a button between pin #0 and ground and press it, a voice clip will play on the next loop cycle (once the breathing has ended)

If you have a very short background sound loop, say one that loops evey 1-2 seconds, then this is probably good enough. If you have a long loop like this one, where it takes 3 seconds to loop it can be annoying because you have to wait until the sound is done to have the foreground noise.

Advanced Background/Foreground

The problem here is that you can't release the looping sound since its tied to ground. You could have one button held down all the time or try a latching loop but it's a lot easier if you just use a switch that has NC (normally closed) and NO (normally open) contacts - sometimes called a DPST (double pole single throw) switch

Most low cost switches and buttons do not have a normally-closed output, so make sure to check the specifications. This switch is a good example of one with both, and it even has nice markings!

In this case, we connect the COM (common) pin to ground, then the normally-closed to pin #10 and the normally open to pin #0

With this setup, pin #10 is triggered normally, and when the lever is pressed, #10 is released and #0 is pressed. That way the #10 background loop stops immediately, and the #0 foreground sound starts immediately. When the lever is released, it goes back to having pin #10 connected

Here's a list of some of the switches we have at Adafruit that have a NC and NO output

OUT OF STOCK NOTIFICATION

YOUR NAME

YOUR EMAIL

You have been successfully subscribed to the Notification List for this product and will therefore receive an e-mail from us when it is back in stock!

For security reasons, an e-mail has been sent to you acknowledging your subscription. Please remember that this subscription will not result in you receiving any e-mail from us about anything other than the restocking of this item.

If, for any reason, you would like to unsubscribe from the Notification List for this product you will find details of how to do so in the e-mail that has just been sent to you!