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

Thread: Teensy 4.1 audio - short filename play reboots, only if played as the first file.

  1. #1
    Junior Member
    Join Date
    Nov 2022
    Posts
    3

    Teensy 4.1 audio - short filename play reboots, only if played as the first file.

    I've got a bunch of *.wav files on SD, playing back from the SD slot on the 4.1. (AudioPlaySdWav)

    Files are being triggered via MQTT, all is well, no issues. Except...

    I have one file out of a dozen, that when triggered as the first file to play at anytime after the Teensy reboots, the Teensy crashes and resets. No other file does it. Play any other file on boot, then play the suspect file and it plays fine. Weird.

    Since I was controlling a bunch of other DSP objects as well, I made sure I had wrapped the numerous audio calls with AudioNoInterrupts()/AudioInterrupts();

    All files are converted to 44.1kHz, signed 16bit, little endian

    I looked at the file's peaks, trimmed off the front end, lowered the volume... nothing. In the act of trying to repair the audio file, it was deleted and re-added to the card several times. Still crashed the Teensy if it was the first one played.

    Then, looking at the list of files on the SD card, I noted it was the only file with a two character filename 'jr.wav'. All the others had at least 4 or 5 characters in the filename.

    On a whim, I changed the filename to a 5-character filename, 'royer.wav'. It was my second last dart. The last was reserved for removing the file entirely and not even having it available to play.

    But I didn't need to use it, renaming the file to a longer filename fixed the issue. No more crashes.

    Audio file source

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,925
    I downloaded and converted that file to 44.1k. The WavFilePlayer example plays it without any problems when it is the first thing being played.
    My guess is that there's a bug in your code. Can you post it?

    Pete

  3. #3
    Junior Member
    Join Date
    Nov 2022
    Posts
    3
    Quote Originally Posted by el_supremo View Post
    I downloaded and converted that file to 44.1k. The WavFilePlayer example plays it without any problems when it is the first thing being played.
    My guess is that there's a bug in your code. Can you post it?

    Pete
    I know the problem is not the file, I merely posted the link to it as a courtesy.

    Perhaps try any file, but give it the same name I did (jr.wav)

    My source code is over 84K for this project, I'm not sure what portion would be relevant, but the playback is as simple as the examples show.

    However as I mentioned, the problem is resolved. Since renaming the file, I can't reproduce the issue so I'm not too concerned.

  4. #4
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    11,802
    If it reboots, maybe it is crashing

    Try adding something like this at start of your program:

    Code:
    if (!Serial && millis() < 3000) ; // wait up to 3 seconds for serial
    if (CrashReport)Serial.print(CrashReport);
    And see if it triggers.

  5. #5
    Junior Member
    Join Date
    Nov 2022
    Posts
    3
    Quote Originally Posted by KurtE View Post
    If it reboots, maybe it is crashing

    Try adding something like this at start of your program:

    Code:
    if (!Serial && millis() < 3000) ; // wait up to 3 seconds for serial
    if (CrashReport)Serial.print(CrashReport);
    And see if it triggers.
    Good suggestion, I will give this a try at some point. It is definitely crashing as soon as you play a file with a two-character filename.

Posting Permissions

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