Ai-Thinker-Open / ESP32-A1S-AudioKit

Ai-Thinker AudioKit Board SDK - 安信可 esp32-a1s 音频模组开发板
Other
132 stars 63 forks source link

How to detect the volume? #30

Open T-vK opened 2 years ago

T-vK commented 2 years ago

Is it possible to detect the volume of the line-in signal?

E.g. something like this?

#define LINE_IN_PIN A0;
void loop() {
    int sample = analogRead(LINE_IN_PIN);
    int volume = sample/4096*100; // volume in percent
    Serial.println(volume);
}