Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Can a Teensy 3.2 hold 16 seconds of 12 bit 8khz on chip?

  1. #1
    Senior Member
    Join Date
    May 2015
    Posts
    436

    Can a Teensy 3.2 hold 16 seconds of 12 bit 8khz on chip?

    I only have about 16 seconds of audio for a project I am working on and sticking it on a SD card seems overkill.

    Right now its in raw format 16 bit recorded on the audio adaptor Paul designed and sold on PJRC etc. I think I could get by with 12 bit audio at 8 khz instead of 44.1 khz and 16 bit for my app and use the onboard DAC and make the teensy do all the work if it can hold that much audio as data in a header file and if the audio library will support such a low sampling rate.

  2. #2
    Senior Member
    Join Date
    May 2015
    Posts
    436
    I have thought about it some more and I will just add the footprint for one of the serial flash chips that the audio board uses. I want to do a couple minor tweaks and move the pine used fir an led so I now would be the perfect time. If I do it right nothing will conflict with the audio board if I donít place the parts so I call always fall back to a two board solution. A back of the envelope estimate is the audio would take maybe 1 megabyte of storage.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,784
    If you're looking to store the sound in program memory, maybe try the wav2sketch program. It doesn't support 8 kHz sample rate, but you can use 11 kHz. It also supports ulaw compression, so each sample is stored using only 8 bits. In that format, each second takes 11025 bytes. So 16 seconds should fit into 176400 bytes. That's about 67% of the flash memory on Teensy 3.2, so hopefully it can fit if your program isn't really large.

    You'll probably want to do some listening tests to check whether the sound you're using distorts too much with ulaw encoding. The ulaw encoding gives the dynamic range of about 14 bits (so give wav2sketch a 16 bit file as input). But ulaw does this using logarithmic rather than linear quantization, so you get some distortion and loss of fidelity on small subtle sounds when mixed together louder sounds. As a general guideline, it usually sounds pretty good for simple sounds which are 1 source, like a voice or just 1 musical instrument. But it performs pretty badly for a musical composition or other complex sounds.

  4. #4
    Senior Member
    Join Date
    May 2015
    Posts
    436
    Thank you Paul. I am just trying to restore voice channel alerts on old pagers and the original voice isnít the best quality to begin with. The chip has a 3.2 kHz low pass filter and uses 8 khz internally so 11 probably would be fine. Thanks for the details and hopefully others will have use for all the options you gave me too.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •