2.4 File System
The SD card file system used is based on a standard FAT file system, which can be loaded normally by a PC. Each waveform is comprised of its own file, with the file names consisting of sequential numbers starting at ‘0’. The contents of the file consist of a 16-character description (e.g., “Sawtooth”) that is buffered with spaces as needed, a one-byte length field indicating the length of the waveform and up to 255 single-byte samples of the waveform to be generated.
The waveforms on the SD card are generated using a Python script that converts standard single-channel signed 16-bit pulse code modulation (PCM) .WAV files to an 8-bit unsigned PCM with the meta data, as described above. The .WAV files that the Python script converts from can be created using standard audio editing software. The Python script also down-samples the audio waveform to the desired number of samples.
On start-up, the PIC® device reads the contents of the SD card to determine the number of waveforms saved on the SD card. The descriptions of each file are then stored in RAM to prevent the need to repeatedly read from the SD card while cycling through choices.
When a waveform is loaded, the contents of the data portion of the file are read into the look-up table addressed by the DMA, and the length field is used to control the length of data read by the DMA.