ESP32-A2DP icon indicating copy to clipboard operation
ESP32-A2DP copied to clipboard

Weird noises when playing music from Spotify or YouTube

Open Razzorback225 opened this issue 1 year ago • 10 comments

Problem Description

Hi all,

I just tested the library today in a hurry and I just use a old board that I developped a few years ago. This board uses a ESP32-WROOM32D module and I soldered a 3.5mm audio jack to the pins 25 and 26 of the module. The Bluetooth part seems to work as I can connect to the ESP32, but the audio out is not working properly. I captured what I can hear when plugin some earphones or speaker to the 3.5mm audio jack. Sound

I used the latest release of the library.

Device Description

Custom ESP32 board using an ESP32-WROOM32D (4MB of Flash) IMG_20231006_151717590 IMG_20231006_151725612

Sketch

Sketch used comes from the examples folder of the Github.

Other Steps to Reproduce

No response

Provide your Version of the EP32 Arduino Core (or the IDF Version)

Arduino ESP32 Core version 2.0.1

I have checked existing issues, discussions and online documentation

  • [X] I confirm I have checked existing issues, discussions and online documentation

Razzorback225 avatar Oct 06 '23 13:10 Razzorback225

I am hardly hearing anything.

  • Did you try to increase the volume on the phone or by calling set_volume() ?
  • Looking at your picture, I can't see the ground connection to the audio jack

I just recently retested the analog output with this board and it was working perfectly

pschatzmann avatar Oct 07 '23 16:10 pschatzmann

@pschatzmann Yeah sorry for that I tried to be as close as possible of the earphones when I recorded the sample.

I set the volume at max level on my phone when I tried but not in the code.

The jack is connected to ground through the PTH at its right. It is connected to ground.

The board you mentionned is the one with Yellow mask and TFT or the one above?

Razzorback225 avatar Oct 09 '23 06:10 Razzorback225

The one with the TFT screen is using the internal DAC of the ESP32 with an amplifier to output audio. To be honest I tested it with my AudioTools. Maybe it helps if you do some tests

  • https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-stream/streams-generator-analog/streams-generator-analog.ino (if you dont get a proper sine signal you have a hardware issue)

Try to change it to use 44100 on 2 channels!

pschatzmann avatar Oct 09 '23 14:10 pschatzmann

What is the phone that you are using? Did you try anything else besides Spotify and YouTube? I'm just asking why they were specified in the title specifically

See also: https://github.com/pschatzmann/ESP32-A2DP/discussions/495

mrhempman69 avatar Oct 17 '23 21:10 mrhempman69

@mrhempman69

Sorry for the late answer.

I've got an android phone (a Motorola Edge). I'did not try anything else than these 2 applications. I put them in the title because they are the 2 applications I used to test the setup.

Razzorback225 avatar Oct 26 '23 15:10 Razzorback225

Maybe is it just noise from your power supply ? Did you try to power it from an (e.g. laptop) battery

pschatzmann avatar Oct 26 '23 15:10 pschatzmann

I also tried to power it from 5V coming from USB to UART adapter but it makes no changes.

The sound I add to this topic is the only thing that comes out of the speakers when I play a song on my phone. There is no music just this sound

Razzorback225 avatar Oct 26 '23 16:10 Razzorback225

Did you try another ESP32 to figure out if the issue is your phone or your Processor ? Did you run the test sketch to figure out if the issue is with the A2DP library ?

pschatzmann avatar Oct 26 '23 16:10 pschatzmann

I did not tried yet on another ESP32 due to missing components.

I run the test sketch for internalDac and this was not working but I cannot guarantee that this does not have to do with my setup.

I tryied the library with an I2S DAC (PCM5102A) using a custom pin assignement and It worked like a charm.

Once I'll have all the component I'll try again.

Razzorback225 avatar Oct 26 '23 16:10 Razzorback225

I face this problem too This is due to the lack of CPU processing ability or the BREDR signal quality difference leading to the loss of blue sound frequency, different solutions:

  1. Setting CPU speed at least 160MHz or higher (recommended 240MHz)
  2. Increased DMA Buffer length like .dma_buf_len = 256, 3.Increasing TX power by using esp_bredr_tx_power_set(ESP_PWR_LVL_P9, ESP_PWR_LVL_P9)

CC0126 avatar Feb 03 '24 06:02 CC0126