Send Data to LED while Playing #691
-
I have the MP3 Decoding working from a Micro SD and playing to an I2S amplifier and being triggered by a PIR sensor. This part is working fine. I have another function that I would like to implement - I found
And when I put it in the ESP32 project I can get the buffer length and data, But then data stream stops going to the I2S Amplifier. I would like to be able to get a number that indicates the volume and send to the PCM processor to drive an LED while the stream is playing. The only other option I have come up with is a second ESP32 to monitor the sound and to drive the LED - This should be able to be done in one set of hardware. I appreciate any help or advice anyone could provide. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
With audio_process_extern() you get every single sample in int16_t format. uint16_t vum = audio.getVUlevel();
uint8_t left = vum >> 8;
uint8_t right = vum & 0x00FF; this gives you an average value for both channels, the values are between 0...127 |
Beta Was this translation helpful? Give feedback.
-
That would be ideal. But when I try to use it I get no member named getVUlevel exists. All I can find is a getVolumn. Is that the same call? |
Beta Was this translation helpful? Give feedback.
-
I think I found the issue. The GIThub source code shows it. I am using VS code for the ESP32 and the library it shows is 2.0.7 - GitHUB show 3.0.8P RECOMMENDEDAccept new functionality in a backwards compatible manner and patcheshttps://github.com/schreibfaul1/ESP32-audioI2S#esphome/ESP32-audioI2S @ 2.0.7 I get SemanticVersionError: Invalid simple block '3.0.8p' |
Beta Was this translation helpful? Give feedback.
-
I tried using |
Beta Was this translation helpful? Give feedback.
-
Thank you for your help. I got the Latest Library and cleared the History so now it is compiling and working. What is the levels that would be expected? So far looks like 0 to over 32000. Is there a built in max? |
Beta Was this translation helpful? Give feedback.
With audio_process_extern() you get every single sample in int16_t format.
this gives you an average value for both channels, the values are between 0...127