Contributors

Serial Audio Control

If for some reason you don't want to use the trigger mode, say you need some more complex audio playing, you can use serial audio control. This allows any microcontroller with 9600 baud TTL UART to send commands to the module.

All Adafruit Soundboards can be used in either UART mode or GPIO (button) mode - but not at the same time!

We'll demonstrate with an Arduino, but you can use any microcontroller with a little adaptation

Arduino Library

If you have an Arduino, you can wire it as seen above (UG to Ground, TX to #5, RX to #6 and RST to #4) to control the sound board via our simple menu example.

Load Demo Sketch

Now you can open up File->Examples->Adafruit_Soundboard->menu and upload to your Arduino wired up to the breakout

Then open up the serial console at 115200 baud to interact!

General Usage

For connections we recommend at a minimum

Connect UG to GND (to start the sound board in Uart mode)

Connect RX to the data-output pin from the microcontroller into the sound board

Connect TX to the data-output pin to the microcontroller from the sound board

Connect RST to another microcontroller pin, when toggled low, it will reset the sound board into a known state

If you want to know when sound is being played, the ACT pin is LOW when audio is playing - this output also controls the red ACT LED

You can use 3.3V or 5V logic on the RX pin, it has a level shifter. TX is output at 3.3V which can be read from a 3.3V or 5V logic. For the RST pin, it's 3.3V and has a pullup. To reset the board, set the microcontroller pin to low, then an output, then back to an input like so:

First line tells you when this firmware was written (10/21/14) and the name of the board - the name is the same for all the SFX boards right now, but you may have a different firmware date

The second line will read FAT and then a 8 digit hexadecimal number, which will tell you the size of the partition that all the files are on in 512 byte sectors. E.g. here 0x7FC0 = 32,704. 32704 * 512 bytes = 16,744,448 (16 MB)

Third line will read Files and then a 5 digit decimal # of files that are on the Soundboard. here, we see it has 16 files available.

Commands

There are a few commands, in two 'sets' - one set is commands that can be run in IDLE mode, and the other is commands that can be run in PLAY mode.

IDLE mode commands

These are commands you can use when audio is not being played!

List Files

L - Send "L\n" (L plus new line) to list files

files will be listed in following format:

FILENAMEEXTfilesizeinbytes

Where "FILENAMEEXT" is the full 8.3 file name of each file, with no dot, if you have a file with shorter than 8 characters, it will be padded with spaces.

The filesize is in bytes, and is padded with zeros as well

Volume up and down

You can adjust volume from 0 (silent) to 204 (loudest) in 2-increments. To increase the volume, send +\n (plus symbol plus new line). to decrease volume send -\n (minus symbol plus new line) and it will reply with the new volume (5 ascii characters, two of which are going to be zeros and then three digits of volume, plus a new line)

Play track by Number

Each track has a number with respect to when it was copied onto the SD card, starting with track #0, these are in the order that the tracks are printed out when you send 'L' for list tracks.

The fastest way to play a track is by the track number, send #NN\n (# symbol, then the number of the track, and end with a new line). E.g. to play the first track (track #0) send #0\n and for the 11th track, send #10\n

If the file wasnt found, it will reply with NoFile\n

If the file is found, the sound board will reply with playNNNNNFILENAMEEXT\n

where NNNNN is the track number, and FILENAMEEXT is the 11-character file name (8.3 without the dot)

When the file is done, it will print done\n to let you know

Play track by name

Maybe you want to just play the track by a name, not number. No problem! You can do that with the P command

Send PFILENAMEEXT\n - 'P' plus the 11-character file name (8.3 without the dot) then a new line. If the filename is shorter than 8 characters, fill the characters

For example, to play T00NEXT5.WAV send PT00NEXT5WAV\n and to play T09.OGG send PT09 OGG\n

If the file wasnt found, it will reply with NoFile\n otherwise it will reply as above, with playNNNNNFILENAMEEXT\n

PLAY mode commands

OK now that you are playing audio, you can do stuff during play, these are not available in IDLE mode

Pause & Unpause

You can pause at any time by sending the = character, no new line required. To restart playback, send the > character

These character will be echo'd back to you on the UART so you know they were received!

Stopping Playback

You can also stop instantly by sending a q (for 'quit') and the audio will stop and return back to IDLE mode

Current playback time

You can query how much time has been spent playing the current track by sending an t character

You will get a response which is 5 digits a : and then another 5 digits. The first 5 digits are seconds currently elapsed, the second half is supposed to be the codec's report of total play time but so far we've always just gotten 0's so we suggest just using the first set of digits (current playback in seconds)

Please note this is a blocking operation. Doing it too much can cause your audio to stutter!

File size and remaining

Finally, you can query the size of the file and how far along you are in it, which is sort of like how much you've got left to play but of course, for compressed OGGs may vary a bit. Still, might be handy!

You can get the file size and remaining bytes by sending an 's'

The sizes are reported in decimal bytes, 10 digits long seperated by a /

The first number is remaining bytes and the second number is total size.

Please note this is a blocking operation. Doing it too much/fast can cause your audio to stutter!

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!