pschatzmann / ESP32-A2DP

A Simple ESP32 Bluetooth A2DP Library (to implement a Music Receiver or Sender) that supports Arduino, PlatformIO and Espressif IDF
Apache License 2.0
1.65k stars 270 forks source link

Weird noises when playing music from Spotify or YouTube #485

Closed Razzorback225 closed 6 months ago

Razzorback225 commented 1 year ago

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

pschatzmann commented 1 year ago

I am hardly hearing anything.

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

Razzorback225 commented 12 months ago

@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?

pschatzmann commented 12 months ago

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

Try to change it to use 44100 on 2 channels!

mrhempman69 commented 11 months ago

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

Razzorback225 commented 11 months ago

@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.

pschatzmann commented 11 months ago

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

Razzorback225 commented 11 months ago

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

pschatzmann commented 11 months ago

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 ?

Razzorback225 commented 11 months ago

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.

CC0126 commented 8 months ago

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)