Teensy Audio Crashing

Hi

hope someone can help.

I'm using a Teensy 4.0 + RevD audio shield. I'm attempting to play thunder.wav files and control some LEDs as lightning.

Problem is that when I play a thunder.wav file it crashes and produces a very loud buzz. If you leave it, it will actually recover and continue playing.

The .wav files were converted from .mp3s to 16bit / 44100hz

Using a M2 scandisk 64gb Microsd card formatt with sdfat

I've trried various other .wav files and had the same issue.

I've checked the audiomemory to ensure its sufficient.

Hope someone can help

Thanks
 

Attachments

  • RS485.ino
    1.5 KB · Views: 37
  • Relays.ino
    1.3 KB · Views: 27
  • Music.ino
    2.7 KB · Views: 35
  • Thunder_v4.0.ino
    4 KB · Views: 36
  • LEDs.ino
    3.7 KB · Views: 31
The best way to see if your sketch fit the job or not ,is to load the basic "SdWaV player" ketch from the teensy library
and test with one or several wave tracks from yours,by this way you can also test your tracks too!
 
The FastLED WS2812 driver blocks interrupts. To work well with audio, you need a non-blocking driver. WS2812_Serial is the best choice for a single output, or even 2 outputs. The main downside is it only supports certain pins, so you'll need to rewire so your LEDs connect to the supported pins.

To get started, in Arduino click File > Examples > WS2812Serial > FaseLED_Cylon. See the comments in that code for the supported pins.

The order of includes and defines is critical, so make sure you keep it as shown in that example. For FastLED addLeds(), you need the LED type to be WS2812SERIAL rather than WS2812. Looks like you have this inside a define for LED_TYPE in your program.

If you set the LED type to WS2812SERIAL and get those includes right, and wire the LEDs to the supported pins, you'll get non-blicking output that doesn't mess up audio or other interrupt-based libraries.
 
Hi Paul

Thanks for taking the time to reply. Now makes sense why I was having sporadic issues. I learnt to separate processes out to other teensys rather than trying to get one to do too much.

I’ll give ws2812serial a try, thank-you!
 
Back
Top