AudioPlayer with SD A2DP Problem with loading subsequent Files. Next,Prevous and Play/Pause not working... #998
-
Hey Phil! I tried using your examples
On inspection with Serial.println and AudioLogger they both had problems finding the next song in the directory. When using or on player.next(): Here are my Index Files:
idx-def.txt:
Here is the code I use in void loop to initiate player.next() with a simple PULL UP button:
For Play/Pause I subsequently used:
Note that the player.isActive() actualy changes from true to false and back when the button is pressed. Do you have any ideas what my problem could be? Whole console log:
Board: ESP-WROOM32 |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 2 replies
-
I never had any issues with finding any files. However I do not store the audio files in the root but have them in subdirectories by artist and then usually by album |
Beta Was this translation helpful? Give feedback.
-
I think you are confused: Try first to figure out which SD library you want to use! https://github.com/pschatzmann/arduino-audio-tools/wiki/The-Audio-Player-Class |
Beta Was this translation helpful? Give feedback.
-
So far i tried AudioSourceSD, AudioSourceIdxSD, AudioSourceSDFAT and AudioSourceIdxSDFAT. But the problem remained. What exactly is the difference between AudioSourceSD and AudioSourceIdxSD? |
Beta Was this translation helpful? Give feedback.
-
The debug Messages now show me that the SD library is not the problem!
I also printed the AudioPlayer output to the Serial Monitor and this shows that the next song is indeed played. It seems that the Bluetooth connection ends the audioStream every time a song is paused or a next song is selected. |
Beta Was this translation helpful? Give feedback.
-
You only show the warning messages: Did you change the log level to actually see in more detail what's happening ? I guess A2DP is automatially dropping the connection when there is no audio for too long.
You can look up the method names in the class documentation Here is a working example that I have tested with the AudioKit: https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-audiokit/player-sd-audiokit/player-sd-audiokit.ino. You can replace the AudioKitStream with I2SStream and handle the audio actions and debouncing with AudioActions |
Beta Was this translation helpful? Give feedback.
-
This was indeed the problem. The simple Bluetooth speaker now works flawlessly! Considering Apple's Audio Share mode, where one phone can send data to multiple AirPods, it's possible that AirPods use A2DP Dual Mode. This suggests that each earbud establishes a Bluetooth connection individually. Could this be a reason why the A2DP connection is lost after the first song? This may be due to the ESP32 only connecting to one Bluetooth address. On the other hand, I can hear audio on both earbuds despite only connecting to one address. |
Beta Was this translation helpful? Give feedback.
-
Here is a debug Log from a player.next() call. Before this there is music playing and then the A2DP Stream cuts of.
|
Beta Was this translation helpful? Give feedback.
-
This looks normal to me. |
Beta Was this translation helpful? Give feedback.
I never had any issues with finding any files.
Did you run the test sketches that come with the corresponding SD libraries ?
However I do not store the audio files in the root but have them in subdirectories by artist and then usually by album