Categories
Making

Arduino: Rugged Audio Shield

3/6/13 Rugged Audio Shield – Session 1
The Rugged Audio Shield can function as both a sound generator, and a recording/playback device, with an advertised 44.1 khz/16 bit output. It includes both a line input and microphone input, along with stereo output with a volume control that can be mapped to other parameters (like pitch in the case of sound generation).

The board arrived quickly from the manufacturer, and the test sketches loaded fine with no errors. However, audio recording using my 1 GB micro SD and 8 GB micro SDHD cards failed, as did audio playback at both 32 Khz and 44.1 Khz (16 bit). Since my goal is WAV playback, I didn’t try MP3. The recording instructions indicate that a serial action is required to initiate record, but there weren’t clear instructions on how to set that up. I was getting strange character output on the serial monitor. See Session 2 for more.

All issues point to the speed of my memory cards, so I have written to Rugged Circuits for more info on recommended card types. I suspect SDXC is needed, but what size? Most of the devices I’ve tried so far do not recognize anything over 2 GB, and finding small/fast micro SD is getting difficult. Only option is ordering online, as stores only carry larger sizes for commercial devices. The 1 GB and 2 GB SD cards have become the cassette tape of 2013.

The sound generator works fine, and is quite loud. For now I’ve set this shield up as an optical theremin using a Grove light sensor connected to a Grove sensor shield. There are much simpler ways to create an optical theremin, and I already have several of them. I’d like to get the WAV audio functions working instead.

3/11/13 Rugged Audio Shield – Session 2
Rugged Circuits took a week to get back to me, and didn’t answer all of my questions. They note that cards should be FAT32 (see below), and to use 8.3 file names. I always use 8.3 as other cards use the same standard. Rugged did not answer any of the more pertinent questions about card capacity (1 GB vs 8 GB) or speed (HD vs XC).

A couple more hours of troubleshooting revealed several things:

1. Serial Monitor to 38400
Changing my Serial Monitor to 38400, I was able to successfully run the Record sample sketch and get understandable output from the serial monitor. I found two issues… the sketch says “Press ENTER to record” and there is no response after pressing only enter. You have to at least enter a single character, then Enter. No big deal, but annoying. Then I noticed that the sketch instructions and the actual code for the Record sketch conflict. The sketch is set up by default to record via mic. If you want to use Line In, as I did, you need to change the code designating the input to Line In. This little bit of sloppy documentation wasted quite a bit of time.

While this test was finally good, and gave me some encouragement, I noticed the output jack was scratchy. I tried the obvious remedy: replace the cables to my speakers. Both a cheap $4 cable and a high-end cable with gold-plated connectors had the same result. I even tried a second Arduino board. The output problem was still there. We’ll come back to this later, but for now let’s look at the second problem that the Serial Monitor allowed me to correct.

2. Mac vs PC for creating WAV for playback
All other things being equal, there should be no difference in how a Mac/PC saves a standard WAV file. Sometimes, extra header info or meta data information/tags might be added, and I think this is happening here. Note very subtle differences in these files – the first the bad file from SoundBooth:

And the “good” file:

Up to this point, all of my playback tests were done with WAVs made on my MacBook in Adobe Soundbooth*. Serial Monitor output was now showing me Bad Audio File for the playback sketch. As an extra test, I took the same files into Sound Forge on a PC and re-saved them as 44.1 Khz, 16 bit. I must have stripped something out, because from there, the WAV playback sketch worked fine, except for the static/cut out problem mentioned earlier. I must deduce that SoundBooth was adding something else to the WAV – not necessarily because it’s on Mac, but because SoundBooth is being told to do so somewhere in the settings. More research needed, but at least I got playback.

Frustration Point Reached
After all of this technical troubleshooting, there appears to be a physical flaw on the board. When I press my finger on the headphone jack component, the sound comes through my speakers just fine. Sometimes a little bit of extra pressure from the back/side of the jack is needed. Flexing/pushing on the board should not be necessary, and it’s an indication that something is seriously wrong with the PCB. I made a video and sent it to Rugged and have asked for a replacement or refund. It’s a shame because, for all of the frustration, this is a neat little board, and the first out of the ones I’ve tried that truly plays 44.1 Khz 16 bit.

As for FAT32 or FAT16? – I can’t see any difference in performance now. It is not clear if I have much control over this anyway, at least on the Mac. My 1GB card is FAT16. My 8GB card is FAT32. Both work fine, as long as the WAV file is stripped of any extra data. The recommended SD formatter program – Mac or PC – doesn’t seem to give any choice of 16 vs 32 anyway, and the Interwebs confirmed this.

* In general, I prefer Sound Forge for audio editing, but when I got the MacBook in 2009, I started using Adobe Soundbooth because a) Sound Forge was not available for Mac, and b) I was generally boycotting Sony whenever possible. Of course now Sound Forge is available for Mac, but Sony still makes it, so I am on the fence. For a time I used Peak LE, but it has been discontinued. Adobe Soundbooth is suitable for most tasks, at least up until I started doing the Arduino stuff that is more picky about codecs. Others swear by Audacity, and I sometimes turn to it for a comparison, but I can’t stand the user interface.

3/31/13 Update – Rugged Circuits made good on the replacement board. The new shield works very well (no PCB flexing issues). I also made another discovery about how it’s reading WAV files. If a WAV file has too much dead air (0db) at the starts, the shield won’t play the file. I had a number of pieces of audio that played fine otherwise, but would not play until I cropped them very close at the beginning. I also verified that an 8GB HD XC card works fine.

avatar

By jjdeprisco

Sonic explorer, sound artist, guitarist in Fricknadorable, software designer.