Channel volume levels reading in real-time #921
-
Hi, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Yes, this is possible, add the following event: void audio_process_i2s(int16_t* outBuff, uint16_t validSamples, uint8_t bitsPerSample, uint8_t channels, bool *continueI2S){
// your vu meter code here
*continueI2S = true;
} In most cases bitsPerSample will be 16, then the samples are in int16_t range available in outBuff (numSamples = validSamples * channels). |
Beta Was this translation helpful? Give feedback.
-
Done :) |
Beta Was this translation helpful? Give feedback.
-
Congratulations, good work! |
Beta Was this translation helpful? Give feedback.
Yes, you can regularly query getVUlevel(). A uint16_t is returned where MSB is the left channel and LSB is the right channel. (Values between 0...127)
uint16_t vu = audio.getVUlevel();
uint8_t l = vu >> 8;
uint8_t r = vu & 0x00FF