charliehoey.com Back

The SD Card Sampler

The Arduino Soundbank

This was I think the first module I ever built, and it's kind of an odd choice. But I felt most comfortable with digital electronics / Arduino stuff at this stage, and wanted to try to figure out how to use some stuff from the junk bin.

Construction

Internally, this is an Inland-brand Arduino Uno clone from Microcenter.

There's a small uSD card adapter that I probably got off of eBay or Ali Express that connects over a few jumper cables and communicates over serial.

Arduino Uno prototype Arduino Uno prototype Arduino Uno prototype Arduino Uno prototype Arduino Uno prototype

The DAC is a hand-built R2R with discrete resistors. I'm not sure I even bothered to test them ahead of time, but I found that 8-bit audio sounds remarkably good as long as the sample rate stays fairly high. I believe this could comfortably do 22khz (maybe 44.1?) which was plenty.

Another advantage: USB programming and power! I did not even have a power supply (or ribbon cable, connectors, etc), so I basically just balanced it in my little wooden case and ran the USB cable out the back.

But it was able to interface with Ashley's Mother 32, and they could actually interact both with audio and control voltage.

Playing audio from an SD card with an Arduino Uno

I learned a lot about low-level audio formats on this one. I could probably have done this with an LPF on a PWM signal, but I had ports to spare so I built my own R2R DAC for about 20 cents.

The broad strokes are:

  1. load an 8-bit, unsigned int wave file is stored on the SD card in FAT format
  2. read bytes from it at a specified rate
  3. pass each byte to PORTB in a single instruction
  4. PORTB's 8 pins are wired to the DAC, which converts the 8-bit binary value into an analog voltage between 0 and VCC

Raw audio files are extremely simple, lacking header information in many cases, it's just a list of the bytes read from an audio input, spaced out at regular intervals.

To speed up playback, you just read samples more frequently. To slow down, you read them more seldomly. I attached the one CV input to this value, which creates a really nice and convincing-sounding tape effect when you drive it with an envelope generator.

Sampler Mode

I also added a mode to this eventually that allowed you to use the CV input to control which from a batch of audio files you wished to play, and then the trigger would play it. This worked essentially as a drum machine, though picking an instrument with CV is a little weird, and there were occasionally timing issues.