Audiokit , how to make sd player go a2dp source ?? #364
-
Hi, i'm sruggling with it today,there is no examples with SD player and A2P source, /-------------------------------------------------------- #define USE_SDFAT const char startFilePath="/"; SdSpiConfig sdcfg(PIN_AUDIO_KIT_SD_CARD_CS, DEDICATED_SPI, SD_SCK_MHZ(10) , &AUDIOKIT_SD_SPI); AudioKitStream i2s; const int16_t BYTES_PER_FRAME = 4; // callback used by A2DP to provide the sound data - usually len is 128 2 channel int16 frames void next(bool, int, void*) { void previous(bool, int, void*) { void setup() { // start i2s input with default configuration cfg.bits_per_sample = 16; i2s.begin(cfg); // setup additional buttons // setup player // start the bluetooth void loop() { //-------------------------------------------------------------- I guess that " player.copy();" does not make the deal |
Beta Was this translation helpful? Give feedback.
Replies: 49 comments 5 replies
-
What's wrong with this example: https://github.com/pschatzmann/arduino-audio-tools/tree/main/examples/examples-player/player-sdfat-a2dp ? |
Beta Was this translation helpful? Give feedback.
-
That's make my audiokit reboot after connecting,here is the log: [W] AudioA2DP.h : 302 - ==> state: Connecting Core 1 register dump: Backtrace:0x4009152e:0x3ffcafb00x4018d569:0x3ffcafc0 0x4018a6f5:0x3ffcb2d0 0x400d65c7:0x3ffcb390 0x400d6b96:0x3ffcb3b0 0x400d6f72:0x3ffcb480 0x400d5e08:0x3ffcb4a0 0x400d5f39:0x3ffcb4c0 0x400e0cca:0x3ffcb520 ELF file SHA256: 0000000000000000 Rebooting... |
Beta Was this translation helpful? Give feedback.
-
Did you replace the I2SStream with the AudioKitStream and activate the SD correctly ? And please learn how to decode the stacktrace: https://github.com/me-no-dev/EspExceptionDecoder |
Beta Was this translation helpful? Give feedback.
-
Now the sd card is ok,i can hear it in the headphones,but not via the bluetooth,only the 2 mics //-------------------------------------------------------------- /**
#include "AudioTools.h" BluetoothA2DPSource a2dp_source; const char startFilePath="/"; AudioKitStream i2s; const int16_t BYTES_PER_FRAME = 4; // callback used by A2DP to provide the sound data - usually len is 128 2 channel int16 frames AudioPlayer player(source,i2s, decoder); void setup() { auto cfg = i2s.defaultConfig(RXTX_MODE); cfg.sd_active = true; // setup player // start the bluetooth } void loop() { //-------------------------------------------------------------------- I have no really errors in the monitor log: //--------------------------------------------------------- my switches are 0-1-1-0-0, board-->(6) |
Beta Was this translation helpful? Give feedback.
-
Forget my comment about replacing the I2SStream with the AudioKitStream. I got confused... Just use the sketch that I proposed above. The only issue with this is that, since you don't need any AudioKitStream, the SPI does not get initialized and you need to do it yourself. I added a section to the documentation how to do this. Or alternatively use SDMMC... |
Beta Was this translation helpful? Give feedback.
-
But i had SD issues with the sketch you suggested,not with my last one,i only need to synthetize in mind the use of those functions and // callback used by A2DP to provide the sound data - usually len is 128 2 channel int16 frames As i try to understand,A2DP take in the frames ,like a streamcopy by frame ,what going out of the audiokit (i2s),and it's not AudioPlayer player(source,i2s, decoder); Then i tried to write : AudioPlayer player(source, A2DP_source, decoder); and it said AudioPlayer class don't allow that. I'm sure i'm not alone to be confused with all of that :) |
Beta Was this translation helpful? Give feedback.
-
int32_t get_sound_data(Frame* data, int32_t frameCount) { All you need to do is take this example and make sure that the SD is working, by initializing SPI or by using SDMMC As an excercise it might be even helpful if you try create a learning test sketch which opens and reads a file! |
Beta Was this translation helpful? Give feedback.
-
That's not the SD that makes problem,i've incorporate the SD MMC in the sketch and the result is ok. |
Beta Was this translation helpful? Give feedback.
-
Maybe https://github.com/pschatzmann/ESP32-A2DP/wiki/Auto-Reconnect helps. AudioKit.h is the stream API from the Audio Tools which is using AudioKitHAL.h which is part of the AudioKit HAL Project |
Beta Was this translation helpful? Give feedback.
-
a2dp_source.set_auto_reconnect(true) does not work,same for : out.set_auto_reconnect(true) |
Beta Was this translation helpful? Give feedback.
-
The issue is that is might be set to true: Change it to false! |
Beta Was this translation helpful? Give feedback.
-
i have a esp32 wrover near at 10 cm from the sender, my pc is windows 7 ,no bluetooth i believe, |
Beta Was this translation helpful? Give feedback.
-
The problem is not with your audiokit but with your bluetooth speaker that does not accept any connect request. If it is not working with an audiokit it will not work with an ESP32 as well. I always recommend to start simple: so to test A2DP you should have used the https://github.com/pschatzmann/arduino-audio-tools/tree/main/examples/examples-stream/streams-generator-a2dp sketch first... Did you try to restart the Bluetooth Speaker. Maybe it is just hanging... |
Beta Was this translation helpful? Give feedback.
-
Oh,it's not a real bluetooth speaker,only a esp32 receiver ,with a basic sketch from your's: //------------------------------------------------------- #include "BluetoothA2DPSink.h" BluetoothA2DPSink a2dp_sink; void setup() { //---------PIN CONFIG------------ //------------I2S CONFIG---------------
} void loop() { //--------------------------------------------------------------------- |
Beta Was this translation helpful? Give feedback.
-
Hmm, that should work as well: Make sure on that sketch that the auto reconnect is as well disabled! |
Beta Was this translation helpful? Give feedback.
-
bad thing,it can't compile because it makes a very very long text in the verbose monitor and makes the memory full,i'm back to downgrade to 2.01,'cause the 2.02 disapeared |
Beta Was this translation helpful? Give feedback.
-
I did some tests with the audiokit with sdfat -> a2dp, but there are quite a few issues there as well, that I need to look into.. |
Beta Was this translation helpful? Give feedback.
-
I can believe you, i have : sd.begin failed after connected in "player-sdfat-a2dp" [W] AudioA2DP.h : 302 - ==> state: Connecting |
Beta Was this translation helpful? Give feedback.
-
when i incorporate audiokit.h in the player-sdfat-a2dp sketch,i have: [W] AudioKit.h : 51 - sd_active = true |
Beta Was this translation helpful? Give feedback.
-
The audio data that is currently in the buffer for a2dp when it starts the processing |
Beta Was this translation helpful? Give feedback.
-
It's a new sanbox sketch you put in,do i upload the new reposite to make it work? |
Beta Was this translation helpful? Give feedback.
-
No need to update! |
Beta Was this translation helpful? Give feedback.
-
Ok,i have enough for today,i hope you'll find what is going wrong :) |
Beta Was this translation helpful? Give feedback.
-
I will fix the file issues first. This is for another day... |
Beta Was this translation helpful? Give feedback.
-
Hi, Sketch uses 1347313 bytes (102%) of program storage space. Maximum is 1310720 bytes. Should i get the last esp32 libraries? |
Beta Was this translation helpful? Give feedback.
-
Sketch uses 1347313 bytes (102%) of program storage space. Maximum is 1310720 bytes. |
Beta Was this translation helpful? Give feedback.
-
How can i do that? |
Beta Was this translation helpful? Give feedback.
-
ok have seen it,i'll give a try |
Beta Was this translation helpful? Give feedback.
-
Ok,go back to esp32 package 2.02,everything now works as before but still problem with "audiokit sdfat a2dp source" |
Beta Was this translation helpful? Give feedback.
-
Ok,problem solved,see topic #502,the working sketch is "base-player-a2dp" from the examples-basic-api. |
Beta Was this translation helpful? Give feedback.
What's wrong with this example: https://github.com/pschatzmann/arduino-audio-tools/tree/main/examples/examples-player/player-sdfat-a2dp ?