Teensy4 AudioMemoryUsageMax caps at 54

Status
Not open for further replies.

lrietveld

New member
I'm trying to smooth out the granular effect with delays, but I need pretty high delay times to achieve the effect that i want. I have allocated 200 audio blocks so I can easily get up to 500ms of delay time, but the max delay that the teensy generates is ~150ms. This is also visible when printing the AudioMemoryUsageMax(), which shows that it only uses 54 blocks of memory. I looked around the teensy4 AudioStream and if I understand correctly, the max number of blocks that can be allocated for delay is 229376 / 128 / 2, which is 896.
Is this correct? And if so, why is the delay line not using more of the audio blocks?
 
I actually found the cause in effect_delay.h:

#if defined(__MK66FX1M0__)
// 2.41 second maximum on Teensy 3.6
#define DELAY_QUEUE_SIZE (106496 / AUDIO_BLOCK_SAMPLES)
#elif defined(__MK64FX512__)
// 1.67 second maximum on Teensy 3.5
#define DELAY_QUEUE_SIZE (73728 / AUDIO_BLOCK_SAMPLES)
#elif defined(__MK20DX256__)
// 0.45 second maximum on Teensy 3.1 & 3.2
#define DELAY_QUEUE_SIZE (19826 / AUDIO_BLOCK_SAMPLES)
#else
// 0.14 second maximum on Teensy 3.0
#define DELAY_QUEUE_SIZE (6144 / AUDIO_BLOCK_SAMPLES)
#endif

There's no #if for the teensy4, which is causing the DELAY_QUEUE_SIZE to default to 0.14.
 
This fixed the issue. Maybe the defines can be combined but I don't know enough c to know if that would work, so I took the safe road
#if defined(__IMXRT1062__)
// 2.41 second maximum on Teensy 4.0
#define DELAY_QUEUE_SIZE (106496 / AUDIO_BLOCK_SAMPLES)
#elif defined(__MK66FX1M0__)
// 2.41 second maximum on Teensy 3.6
#define DELAY_QUEUE_SIZE (106496 / AUDIO_BLOCK_SAMPLES)
#elif defined(__MK64FX512__)
// 1.67 second maximum on Teensy 3.5
#define DELAY_QUEUE_SIZE (73728 / AUDIO_BLOCK_SAMPLES)
#elif defined(__MK20DX256__)
// 0.45 second maximum on Teensy 3.1 & 3.2
#define DELAY_QUEUE_SIZE (19826 / AUDIO_BLOCK_SAMPLES)
#else
// 0.14 second maximum on Teensy 3.0
#define DELAY_QUEUE_SIZE (6144 / AUDIO_BLOCK_SAMPLES)
#endif
 
True, but the definition of MAX_AUDIO_MEMORY in AudioStream.cpp is the same as for teensy 3.6:

#if defined(__IMXRT1062__)
#define MAX_AUDIO_MEMORY 229376
#endif

unless that is changed, which I could do i guess, it’s the same
 
You can also use SPI ram for delay. My audio board uses 4Mbit chips. One of these chips gives about 6 seconds of single-channel delay, the equivalent of 2048 audio blocks. You can use the SPI interface directly (like shown in Pauls effect_delay_ext.cpp) or you might find the audio helper objects in my BALibrary useful. Take a look at the AudioDelay class.
 
Status
Not open for further replies.
Back
Top