Saving Audio as WAV Sounds Like Static


New member
Hey all,
First time post and first time getting involved with any type of project like this. Super excited.

So like a few folks on here, I'm trying to build out an Audio Guest Book from that wonderful YouTube tutorial using the Teensy. I've started from the github repo here at earlier revisions and trying to work my way forward:

My situation:
* I've soldered the Teensy 4.0 to the Audio Shield 4.0. Solder seems good.
* I can play a wav file off of the SD card and it plays through a set of headphones, as well as the phone speaker. I'm using the shield's 3.5mm jack in both scenarios.
* If I patch the input from the phone's microphone to the phone's speaker in the headset, I can hear myself pretty clearly (it's not perfect, but good enough for now)
* When I try to patch the input from the speaker to a queue and write a raw or wav file to the SD card, I can barely hear myself and it's just static/garbled.

I also tried using the phone on an active landline. The phone's mic and speaker work fine in that scenario.

Since the hardware seems fine, a couple tests I wanted to try next are:
* Use a different SD card. Maybe it's not fast enough for writes? That's an easy one I can do tonight and if it yields positive results I'll report back.
* I wanted to try to play a wav file, and patch that to a queue to write the output to the SD card to see if there was something wrong with the capture/saving of the audio, but I haven't been able to get that to work (see writeDirectFromPlay.ino)

Does anyone have any suggestions? Attaching my code for reference as well.
* AudioGuestBook.ino - The actual project
* writeDirectFromPlay.ino - The test project attempting to test writing a file playing to the SD card.

Thanks in advance for any feedback.


  • AudioGuestBook.ino
    12.2 KB · Views: 12
  • writeDirectFromPlay.ino
    6.7 KB · Views: 10
Quick Update. It was the SD Card. After putting in a better one it's saving the audio.

One issue I have now is that the file i just wrote doesn't actually write the bytes to the card until I start a new recording. It's like whatever file is written doesn't actually write to the card until I write the next one. I'll keep looking.

One quick thing that might help, I diagnosed that the card I was using was too slow with the Recorder example. I used the block of code in continueRecording to show my average write times were way too high.

    elapsedMicros usec = 0;
    frec.write(buffer, 512);
    // Uncomment these lines to see how long SD writes
    // are taking.  A pair of audio blocks arrives every
    // 5802 microseconds, so hopefully most of the writes
    // take well under 5802 us.  Some will take more, as
    // the SD library also must write to the FAT tables
    // and the SD card controller manages media erase and
    // wear leveling.  The queue1 object can buffer
    // approximately 301700 us of audio, to allow time
    // for occasional high SD card latency, as long as
    // the average write time is under 5802 us.
    Serial.print("SD write, us=");