Random Sound Box

2 years 3 months ago - 2 years 3 months ago #618 by ericleven
ericleven created the topic: Random Sound Box
I've wanted to make one of these for a long time, and Foxonix was the perfect way to do it: a little box that plays a different sound every time you press a button.

This is my first project that wasn't essentially one of the examples. In theory, it's a pretty simple program, but I had enough trouble getting it to work that I thought I'd share in case others were interested!

This is a scaled down version of the box I made, which has over 60 sounds. The sounds took up so much memory that I needed to use the largest device; in this example I'm only using 5 sounds, so the device size is overkill.

I initially used the random function to randomly select the sounds, but it didn't "seem" random enough, so I ended up creating a number of different pre-randomized shuffles of the sound files and I randomly select one of those to play all the way thru before selecting another (a register makes sure the same shuffle isn't played twice in a row). In this example there are three shuffles; in my project I used 10, at which point I ran out of program memory.

A bonus feature is the addition of a switch (wired to P1.1) which selects whether to play back one of the pre-randomized shuffles, or just play everything in order. When the switch is flipped high, it starts back at the first sound on the list and loops through them in order. Also, an LED wired to P3.0 lights up when a sound is being played.

Finally, thanks to Will and the Foxonix gang for all the help to get this working!

Last Edit: 2 years 3 months ago by ericleven.
The following user(s) said Thank You: foxonix

Please Log in or Create an account to join the conversation.

2 years 3 months ago #619 by foxonix
foxonix replied the topic: Random Sound Box

Thanks so much for posting your project. The box itself looks AMAZING, and we're psyched that you were able to get so many sound effects packed in there and working great. We'll share this on our Twitter page and our Facebook page so that we can show off your handiwork. You should do the same!

Will @ Foxonix

Foxonix - make your ideas heard.

Please Log in or Create an account to join the conversation.

Time to create page: 0.211 seconds