I have been using the HSS ADPCM format to stream audio from I2C EEPROMs.· The quality is quite good when you use 8 bit files sampled at 32KHz.· The compression·is 6:1, so you're looking at 5.3K/Sec.·
This is a fanfare from a game I did.· The first long in the file is the data length and the second represents the sample rate.· I always use 32KHz, so the value is always $FFFFFFFE.· The rest of the file is the ADPCM.· B6 and B7 of each byte represents the magnitude of change and the other 6 bits represent the direction.· $EA is a value that should never appear as data, so I use that as an EOF·terminator.· By using a terminator I can simply stream the audio with no regard to the file size.· If you like I have a simple tool that will convert 8 bit, 32KHz .WAV files into 32KHz ADPCM.
I just wanted to point out that it would be fairly easy to extend this to arbitrary bit-depths. Instead of having the delta computed as 1<<(B6+B7+B7), delta could be persistent, shifting by (B6+B7+B7-1) each byte (so SHL if >0, SHR if <0). In fact, if you made delta a negative number, and used SAR instead of SHR then you would never have to do range checking (as it could never go to 0).
One trick when decoding delta modulation type signals is to output the average of the last two samples. This gets rid of the sawtooth wave that happens when trying to represent a flat waveform.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
lonesock
Piranha are people too.
OK, here are the other two files you'll need.· The first one is the I2C that includes a streaming command.· It's really the I2C object that controls streaming because it fills the ADPCM buffer with data.· The second file is the modified HSS object.· The ADPCM was changed to have an ADPCM buffer, master volume, and the capability of two channels with a second slave object.· If there's data in the buffer the ADPCM will stream audio, once the terminator is reached the ADPCM will stop streaming.· I've used the HSS with EEPROMs, the uALFAT and the Vinculum, the only difference being the memory handling object that fills ADPCM buffer.
Comments
I don't think anybody made one to play from eeprom already.
This is a fanfare from a game I did.· The first long in the file is the data length and the second represents the sample rate.· I always use 32KHz, so the value is always $FFFFFFFE.· The rest of the file is the ADPCM.· B6 and B7 of each byte represents the magnitude of change and the other 6 bits represent the direction.· $EA is a value that should never appear as data, so I use that as an EOF·terminator.· By using a terminator I can simply stream the audio with no regard to the file size.· If you like I have a simple tool that will convert 8 bit, 32KHz .WAV files into 32KHz ADPCM.
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Getting started with the Protoboard? - Propeller Cookbook 1.4
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card? - PropDOS
Need a part? Got spare electronics? - The Electronics Exchange
One trick when decoding delta modulation type signals is to output the average of the last two samples. This gets rid of the sawtooth wave that happens when trying to represent a flat waveform.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
lonesock
Piranha are people too.