littlepeople
New member
Hi
I recently purchased a Teensy 4.1 with the 8mb PSRAM chip. My idea is to try and play audio data saved to the PSRAM chip. To test the feasibility of this i've tried modifying the SamplePlayer example project to use EXTMEM instead of PROGMEM for the different samples. That swap didn't work at first so i used the PSRAM test to double check all was well with the PSRAM (it was). I had a dig into the play_memory.cpp file to see why no sound was being emitted. There are a few sections of code i'm struggling to make sense of...
My c++ is not up to scratch so i'm not sure what is being achieved in these 3 particular lines of code:
Could someone help explain what is going on here? The playing variable is then used in the update method in a switch-case section to determine the type of audio data being read. Audio data read from the PSRAM seem to have different playing values than if they being read from PROGMEM. I've checked and saving values as PROGMEM or EXTMEM variable match one another in terms of actual data.
I actually created a new switch case to catch the playing value pertaining to the sample on the PSRAM and i get some audio now... but it doesn't sound right. You can detect the attack of the sound but it is masked by a noisy short loop that plays constantly over the top.
I feel if i could make sense of the part of the code above, i could figure what's required to get it working. So would love some help here if possible.
Or am i barking up the wrong tree here. Is adapting the AudioPlayMemory class not good option for what i'm trying to achieve?
I recently purchased a Teensy 4.1 with the 8mb PSRAM chip. My idea is to try and play audio data saved to the PSRAM chip. To test the feasibility of this i've tried modifying the SamplePlayer example project to use EXTMEM instead of PROGMEM for the different samples. That swap didn't work at first so i used the PSRAM test to double check all was well with the PSRAM (it was). I had a dig into the play_memory.cpp file to see why no sound was being emitted. There are a few sections of code i'm struggling to make sense of...
Code:
void AudioPlayMemory::play(const unsigned int *data)
{
uint32_t format;
playing = 0;
prior = 0;
format = *data++;
next = data;
beginning = data;
length = format & 0xFFFFFF;
playing = format >> 24;
}
My c++ is not up to scratch so i'm not sure what is being achieved in these 3 particular lines of code:
Code:
format = *data++;
length = format & 0xFFFFFF;
playing = format >> 24;
Could someone help explain what is going on here? The playing variable is then used in the update method in a switch-case section to determine the type of audio data being read. Audio data read from the PSRAM seem to have different playing values than if they being read from PROGMEM. I've checked and saving values as PROGMEM or EXTMEM variable match one another in terms of actual data.
I actually created a new switch case to catch the playing value pertaining to the sample on the PSRAM and i get some audio now... but it doesn't sound right. You can detect the attack of the sound but it is masked by a noisy short loop that plays constantly over the top.
I feel if i could make sense of the part of the code above, i could figure what's required to get it working. So would love some help here if possible.
Or am i barking up the wrong tree here. Is adapting the AudioPlayMemory class not good option for what i'm trying to achieve?