USE_TEENSY3_OPTIMIZED_CODE distorts SD playback

Status
Not open for further replies.

jensa

Well-known member
Hi all,
For a while I've been wanting to make a launchpad & drum machine to bring along for our stands at Maker Faire and such events. Kids love anything that makes sound, so why not make something that'll be fun to play with and even has some depth?

After a bit of testing, it seems that playing from SD, it's very easy to get a "hang" when multiple sounds play at once? A hard reset is the only way out. The documentation clearly states that a good SD should enable playback of up to 2 sounds, but I remember testing 4 simultaneous sounds some years ago with good results. The Teensy 3.2 optimised version of the SD library should solve this "hang", but instead it produces "interesting" artefacts - distorting the sound and in some cases also adding quite bad white-noise.

My hardware setup is a Teensy 3.2 with Rev C of the Audio adapter. I have also tried Rev B and one that has no version marking (Rev A?). I made a simple project with 4 WAV players mixed into the I2S output (https://pastebin.com/eb7TbYJH). Levels of each of the 4 channels are set low (0.3) to prevent distortion. The sample files (WAV 16bit/44.1Khz) used with this test can be downloaded here. Without the USE_TEENSY3_OPTIMIZED_CODE flag, the audio plays back fine as long as you don't try to trigger two samples too quickly after each other. If you do, the Teensy will need a reset to stop that horrible sound.

When playing from the 32Gb Samsung Evo SD card, every sample is accompanied by a terrible, scraping sound. It sounds like random numbers playing back as sound and make you instantly reach over to turn down your speakers. The Samsung Evo SD card is a UHS-1, Class 10 card with a theoretical max speed of 95 MB/s.

When playing from a 16Gb Sandisk Ultra SD card, there is no noise but the samples are altered in interesting ways? A solid bass sound will suddenly get a vibrato and other sounds will do similar things. The Sandisk Ultra SD card is a UHS-1, Class 10 card with a theoretical max speed of 98 MB/s.

My third card is a Sandisk Extreme SD card and it is actually cheaper than the other two right now. Normally about the double price. With this card, it's very hard to get a hardware hang and audio plays back beautifully. I have not yet managed, but I'm sure some kids will do it at Maker Faire :) The Sandisk Extreme SD card is a UHS-3, Class 10 card with a theoretical max speed of 95 MB/s. The main difference here is thus the Write speed (UHS-3 = 30MB/s vs UHS-1 = 10MB/s). The read speed is theoretically the same.

The "SdCardTest" returns comparable results for all 3 cards, but the audible playback is significantly different. Has anyone done any more testing on this? I can't seem to find anything posted other than this thread.
 
Status
Not open for further replies.
Back
Top