ESP32 Wrover-E
IDF 4.4
ADF 2.4
Hi,
i've set up an A2DP sink (https://github.com/espressif/esp-adf/bl ... _example.c) and modified it.
I can play music via bluetooth and the remote control also works well.
However i have difficulties getting the volume control to work properly.
I can change the volume value from the ESP and receive it properly on the device.
(If i set f.e. 50% on the device, the ESP gets the info "50%")
(If i set f.e. 50% on the ESP, the device also gets the info "50%" and shows it)
So i guess the root of my problem is not where i send the volume commands as they seem to work fine.
If i look at the PCM data received via bluetooth i noticed the problem: It seems like the volume of the PCM signal caps at about 40%.
I created a .mp3 file with an 1kHz sine wave and amplitude 1 (max. amplitude).
As the ESP32 defaults to 16bit PCM, the absolute min and max of the signal should be about -32000 and 32000 (not exactly).
My problem is, that if i set the volume value to 40% or above, the peak of the sine wave always reaches the min and max.
So it doesn't change for volume values between 40% and 100%.
The control works ok'ish in the range from 0% to 40%... At least the signal amplitude is changing.
It acts like the whole range from 0% to 100% is scaled down to 0% to 40%.
If i connect a device that doesn't support the remote control features, the volume range is fine.
Am i doing something wrong in general or am I missing something?
Thank you in advance!
A2DP sink volume cap
-
- Posts: 6
- Joined: Tue Aug 09, 2022 6:30 am
Re: A2DP sink volume cap
Can anyone at Espressif give any hints on what to look for? I've now observed the same behavior while controlling an ESP32 and don't know where to even begin to look for fixes.
Re: A2DP sink volume cap
I've looked into that problem again and still didn't find an answer.
In `btc_a2dp_sink_handle_inc_media` in the file `btc_a2dp_sink.c` the incoming data gets converted via `OI_CODEC_SBC_DecodeFrame`. If i check the data directly after the conversation i can see the same problem as in the output.
A volume setting of 100% results in -32000 to 32000 (which is ok)
Same for 40% (which is totally not ok)
Below 40% the signal gets lower with every "volume down"-step.
Can anyone give me an advice on what to do/check/measure/debug?
In `btc_a2dp_sink_handle_inc_media` in the file `btc_a2dp_sink.c` the incoming data gets converted via `OI_CODEC_SBC_DecodeFrame`. If i check the data directly after the conversation i can see the same problem as in the output.
A volume setting of 100% results in -32000 to 32000 (which is ok)
Same for 40% (which is totally not ok)
Below 40% the signal gets lower with every "volume down"-step.
Can anyone give me an advice on what to do/check/measure/debug?
Who is online
Users browsing this forum: No registered users and 68 guests