SD card WAV > uLaw encode > Teensy memory

Status
Not open for further replies.

jcarruthers

Well-known member
I am having issues reading two WAV files at once from SD cards — they are short samples and played repeatedly. I get issues with latency and eventually most of the time the Teensy crashes after a while.

My idea is to cache WAV files from the SD card in to Teensy memory and play them from there.

To make the most of the limited 64kB memory I am considering using uLaw so I can get 10 seconds or so in memory.

Any thoughts before I spend my time working this all out?

I found some uLaw code here: http://dystopiancode.blogspot.co.uk/2012/02/pcm-law-and-u-law-companding-algorithms.html


James
 
You'll find some existing uLaw code in the Audiolibrary too.
Maybe you want to add a flash-chip, it#s much faster than SD-Card and allows playing of 10..16 44KHz/mono files simulatanous in "Hifi"-quality , without compression.
 
Last edited:
Flash chip would be nice but I'm working with some existing hardware rather than making something new.

What I really need is to be able to write to the Teensy internal flash :)
 
Hi Nick,


Thanks for that.

I did find your post but then couldn't find a read command. Which I hope means I'm not too silly to use it.

Do you think that it's feasible to do what I want to do with your code? Having access to 200Kb or so of flash memory would be rather grand.


James
 
Hi jcarruthers,

the flash memory is in the common address space! So, when you do
uint32_t nVar = *(uint32_t*)0x00008000;
statement, you read from P-flash the 4 bytes from 32kB offset. You need to use special routines to _write_ to flash, but reading is common.

Nikolai
 
Dude, save your time, get a better SDcard.

i was happily playing 3 or 4 44khz files at once from mine.
 
Hi Pensive,

well, if you need only a few (short) sounds, that could fit to flash, there is no need in external socket + SD card.

Nikolai
 
But with the audio board you get an SDcard reader out of the box, it is sufficient to achieve the goal in hand, with a decent sdcard, and no complicated code required, acres of space, couldn't be easier to populate with sound files, no quality sacrifice.

seems like a quick win to me
 
Status
Not open for further replies.
Back
Top