Have an issue using AudioPlayQueue on Teensy 4.0, that isn't present on Teensy 3.6. My sketch is complex, so will describe the issue seen as best I can in the hope it jogs some recollection or thought. I pulled out just the required code into a different sketch to minimize conflicts with other utilized libraries in my full sketch. Recreated the issue there.
Basically, a call to AudioPlayQueue.getBuffer() or AudioPlayQueue.playBuffer() is taking almost 3ms on the Teensy 4.0, whereas this is just a microsecond or two on the Teensy 3.6.
This latency translates into stuttering audio played via AudioMixer -> AudioAmplifier -> AudioOutputI2S2 as the code cannot stream the audio fast enough.
Further diagnostics in my sketch show this only happens if I have previously made a call to AudioPlaySdWav; if I call my video-playing code (which utilizes AudioPlayQueue) before any other call to the Audio functions, such as AudioPlaySdWav, then the getBuffer and playBuffer return within 1 or 2 microseconds, as desired. Only after a single call to AudioPlaySdWav does the latency occur in AudioPlayQueue.
AudioMemory is set to 40, and AudioMemoryUsage and AudioMemoryUsageMax report 34 during playback of the video and audio.
This is not present on the Teensy 3.6, just the 4.0, the same sketch works fine on the Teensy 3.6.
I'm using SdFat library SDIO with the builtin SD card on the 3.6, the Teensy 4.0 has a microSD hard wired to the breakouts underneath and also uses SdFat library SDIO. Using SPI to transmit an in-memory buffer to a 320x240 ILI9341 based display for the screen updates.
I realize that not providing full code, etc, and only a description is less than optimal, but if jogs an experts memory on here about similar issues or potential issues, then I'd be grateful for any pointers or help!
Basically, a call to AudioPlayQueue.getBuffer() or AudioPlayQueue.playBuffer() is taking almost 3ms on the Teensy 4.0, whereas this is just a microsecond or two on the Teensy 3.6.
This latency translates into stuttering audio played via AudioMixer -> AudioAmplifier -> AudioOutputI2S2 as the code cannot stream the audio fast enough.
Further diagnostics in my sketch show this only happens if I have previously made a call to AudioPlaySdWav; if I call my video-playing code (which utilizes AudioPlayQueue) before any other call to the Audio functions, such as AudioPlaySdWav, then the getBuffer and playBuffer return within 1 or 2 microseconds, as desired. Only after a single call to AudioPlaySdWav does the latency occur in AudioPlayQueue.
AudioMemory is set to 40, and AudioMemoryUsage and AudioMemoryUsageMax report 34 during playback of the video and audio.
This is not present on the Teensy 3.6, just the 4.0, the same sketch works fine on the Teensy 3.6.
I'm using SdFat library SDIO with the builtin SD card on the 3.6, the Teensy 4.0 has a microSD hard wired to the breakouts underneath and also uses SdFat library SDIO. Using SPI to transmit an in-memory buffer to a 320x240 ILI9341 based display for the screen updates.
I realize that not providing full code, etc, and only a description is less than optimal, but if jogs an experts memory on here about similar issues or potential issues, then I'd be grateful for any pointers or help!