ATtiny soundboard and LED project

I was wondering if it is possible to use an ATtiny (either the 85 or 45) to build a soundboard. The board would play one or two sound files and maybe flash an LED. Also can an ATtiny flash the LED to match the sound from the board?

This is a project idea and I’m not sure if the ATtiny can do the job. I’m guessing the Arduino Nano or Micro could probably do it. The area where the board is going to be located is probably going to be maybe 3x3 inches square, and the battery will be located in a different location, so it won’ be on the board.

It depends on how long the sounds are and what quality you need. In either case, you will probably need external memory. Small external flash chips are cheap.

I started a similar project that plays fixed frequency sounds. However, the same principle can be used to playback voice or music. You may want to add compression to get longer sounds to fit in memory. That’s where I stopped: I was going to add voice playback and was implementing a form of RLE (Run Length Encoding) to compress the audio, but real life intervened and I haven’t gotten back to that project yet :slight_smile:

If there is enough interest in this, I might put together a tutorial on how to do it. Would give me the encouragement to complete the project.

I would actually be interested in a permanent circuit that would do voice for a personal project. Right now I am using an MP3 trigger and I think it’s overkill.

Please excuse the thread derailment…

I would definitely be interested in a tutorial. I’m thinking of using it for a firearm costume piece so the sound won’t have to be too great.

codlink:
I would actually be interested in a permanent circuit that would do voice for a personal project. Right now I am using an MP3 trigger and I think it’s overkill.

Please excuse the thread derailment…

There was a post a few months ago that mentioned speech synthesis using an Uno but I can't find it now. Perhaps you can. Somebody developed a new library, it's output was quite good.

http://www.moneyplansos.com/wp-content/ … derail.jpg

This guy does some pretty amazing things, and among other things has written a music player for an 8-pin ATtiny. Take a look around his site at http://elm-chan.org/works/sd8p/report.html

I’m not looking for anything real fancy, I am just wondering if it’s possible to have an ATtiny play a single sound clip and have flash an LED along with the sound clip.

Yes, it is possible.

Again: how long is the sound and what kind of sound is it – voice, music, random noise, etc?

Looks like the adafruit people had the same idea I did. Use a serial Flash chip to hold the audio and make a programmer from an Arduino: http://learn.adafruit.com/trinket-audio-player

Ooh, that’s a great link thanks. It’s going to go inside of a costume gun. Since it has PM output pins it should be able the flash an led along with the sound, or do I need another chip to do that?

Don’t need another chip, the Trinket will drive LEDs directly.

And I missed your comment about the firearm sound above, sorry. If it’s a very short sound, then it may fit inside the Trinket without any external memory. A good sample rate for voice is about 8kb/second; no idea how fast you need to sample to get a good reproduction of a gunshot, if that’s what you’re going for.

The link you posted has some great info. I don’t know the size or bit rate of the file I may want to use (a buddy has it), so I am guessing that I will need an external chip the store the sound clip.

If I write the code to play the sound and flash the led every time an input pin on the trinket gets a low, what would it do if the button that is connected to the input pin were to be pressed in repeatedly in quick succession, would it play the entire clip or would it start it over every time its pressed?

That depends completely on how you program it. You can achieve either behavior.

As an aside, this is going to be fun. I have programmed a Trinket to play back a short sample (me saying “hello”) from its own memory, but I haven’t had time to assemble the extra hardware yet. Recorded using Audacity with output to RAW format then I wrote a command-line program to read the RAW file and output it as a numeric array (that one word took 2,200 8-bit samples) for inclusion into an AVR program. In theory it should all work the first time, in practice, well… :think:

I would like it to play the entire clip rather than stutter with each repeated press. I already have a trinket and was going to use it to control a servo, but since I would need a different servo library, I may go with a Nano to control the servo.

The potential problem with a Trinket is that it only has 8k of flash memory and ~2.5k is used up by the bootloader. That leaves you only 5.5k for both the program and your sound data (unless you use some added, external memory).

For short sounds that shouldn’t be a problem. The audio I recorded of me saying hello actually took up 4200 bytes even after editing. Makes sense: it’s about half a second of recording at 8k samples/second. However, the rest of the program is only about 20 lines of code, so it all fits. My original plan (and the project I linked to also) was to use an external Flash memory to hold the audio. A megabyte of serial Flash costs less than $2 so it’s a viable approach.

I just need time…

Made some progress, but sound is extremely distorted. Will try adding a low pass filter to the output.

I know that the thread has been sidetracked a little, but my question is whether or not an ATtiny (or the trinket) can play a small sound clip and flash an LED that is activated by the sound clip.

Not to be rude, but jremington already answered that on the first page and I posted a link to a project doing exactly this. What else are you looking for?

jc27:
I know that the thread has been sidetracked a little, but my question is whether or not an ATtiny (or the trinket) can play a small sound clip and flash an LED that is activated by the sound clip.