1

I need to play an intro file and one of 50 different files after it in order each time the switch is pressed, with a short delay between the intro and next file.

For example let's say the intro is called "intro.wav," and each of the 50 other sound files are just named 01.wav-50.wav.

The logic would be:

TRIGGER
PLAY intro.wav
250ms DELAY
PLAY 01.wav
END
TRIGGER
PLAY intro.wav
250ms DELAY
PLAY 02.wav
END
TRIGGER
PLAY intro.wav
250ms DELAY
PLAY 03.wav
END

and so on, until all 50 files are played, then start over.

The messages are going to be a curated group of words. I'm not sure what the intro will be yet, but it will just be something like:

intro.wav = "The word of the day is"

01.wav = "help"

02.wav = "climb"

03.wav = "think"

I'm looking for some guidance on where to start with this, if an Arduino product would be suitable, and if so, which one. I've worked with the Adafruit Audio FX Sound Board before, and that can almost do what I need it to do, but not by itself. It looks like I'll need an Arduino of some kind to accomplish this, so I went ahead ordered an Uno.

I'm not married to the idea of having the intro and word files separate either. If I need to create all 50 files to contain the intro and the word, that would be fine, as long as each one is triggered sequentially.

In that scenario, 01.wav could be "The word of the day is ... help" and the button would basically be the "next track" command. I don't really have a problem with doing that because I'm all about keeping things simple and I don't think I'd run out of space, but I think it would be less time consuming to just dump all the individual word files onto the card.

The important thing is that the track(s) would play once, then stop, and when the button is pressed again, the next one plays.

4
  • 4
    That's simple. Look at any basic Arduino example for how to read your button. Then you just need an if statement that says if the button is pressed then play a sound. An array of file names or if they're really sequentially numbered then you can probably create the file names on the fly. They're just char array strings. What part of this is holding you up? You've done a great job of describing what you want to do but not what your problem is. This isn't a free code writing service. If you were hoping someone would just tell you what to do next you're in the wrong place.
    – Delta_G
    Commented May 13, 2020 at 21:16
  • @delta_g Yeesh. Guess I’m just a big dummy and I should give up since this is so simple and I couldn’t figure it out instantly! ¯\_(ツ)_/¯ This is my first foray into the Arduino world and was kinda hoping someone else had a similar project so as not to reinvent the wheel because yes it does seem like an easy thing to do, and in my 2 hour search I didn’t find any solutions. I’m sure I’ll figure it out once I have a device I can work with.
    – AdamDallas
    Commented May 14, 2020 at 0:38
  • Try forum.arduino.cc That more for the non-specific, just tell me how to do it kind of questions.
    – Delta_G
    Commented May 14, 2020 at 1:23
  • @AdamDallas, you are not a dummy, you are a beginner arduino programmer ... try out some of the example sketches that are included with the Arduino IDE ... break your programming task into small pieces ... start with the button ... write code that toggles an LED ... add code that increments a number ... add code that inserts the number into a text string to produce a file name such as "4.wav" ... find code on the internet that plays wav files from the SD card ... pass the file name to that code
    – jsotola
    Commented May 14, 2020 at 16:19

1 Answer 1

1

You will find all the code and thelibrary you need on the Adafruit learn center.
For such a project I would use a DF-robot (clone) MP3 player (~4$), an Uno, a speaker and an SD card. The library for the player includes examples to get you started and the sound project you plan is possible even with low programming skills. Look at the example codes provided and start to program.

1
  • Thanks for the input! I just saw this, but I happened to order the microSD MP3 player the day I posted the question so I'm glad I'm on the right track. I will be testing as a standalone device today, but it does look like I'll probably need some code. I was just reading through the sample code from DFRobot and it definitely looks like this is feasible. Just hoping I can do this with the cheaper Arduino stuff and not have to use a Pi.
    – AdamDallas
    Commented May 15, 2020 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.