Audiokit v2.2 #87
-
hi everyone i try this one but what i got in serial monitor seems unrelevan AudioKit kit; float calculateDB(uint8_t* buffer, size_t len) { void setup() { void loop() { float db = calculateDB(buffer, len); Serial.print("Noise Level (dB): "); |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I suggest that you use the AudioTools API instead of this. There you can get the max amplitude with the help of the VolumeOutput class and you can apply your db conversion formula to this. If you want to stick to this API, I still recommend that you read the AudioTools Introduction Wiki. There it is explained how to access the values: hint use uint8_t instead of int16_t values. |
Beta Was this translation helpful? Give feedback.
-
You would obviously need to cast the data to the format that you request in the config! By default this is 16 bits per sample which would correspond to int16_t. The AudioKit does not support 8 bits per sample! |
Beta Was this translation helpful? Give feedback.
I suggest that you use the AudioTools API instead of this. There you can get the max amplitude with the help of the VolumeOutput class and you can apply your db conversion formula to this.
If you want to stick to this API, I still recommend that you read the AudioTools Introduction Wiki. There it is explained how to access the values: hint use uint8_t instead of int16_t values.