Closed olsonap closed 2 years ago
For added clarity, the DAC pin in use is Pin 25.
https://github.com/pschatzmann/ESP32-A2DP/issues/76 I see you addressed mono in the issue above but I'm afraid I don't know how to implement your method. Could you provide an example? Perhaps of how it would be added to your bt_music_receiver_to_dac example?
a2dp_sink.set_channels(I2S_CHANNEL_MONO); I'm assuming this is the correct implementation? It uploads okay, but no difference.
Anyway, as you can see I'm traveling blind down a rabbit hole. Any help would be appreciated. Thank you!
I suggest to split up the problem and to
try to figure out if my library works: just use the the bt_music_receiver_to_dac example and test with some earphones using GND and GPIO25 or GPIO26.
audio shield: As far as I can see the TinyPICO Audio Shield is not using I2S but it's own audio interface. So you would need to provide your own implementation by getting the data as described in 'Accessing the Sink Data Stream with Callbacks'
Correction: googling was giving me the wrong audio shield. After double checking I assume you refer to the Audio Shield which can be found on https://www.tinypico.com/add-ons - which receives analog data.
a2dp_sink.set_channels(I2S_CHANNEL_MONO) is mixing the input from left and right and provides the same output on GPIO25 or GPIO26 . So this should be the right approach...
I also would suggest to set the Core Debug Level setting to Verbose just to get more logging info
void setup() {
const i2s_config_t i2s_config = {
.mode = (i2s_mode_t) (I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN),
.sample_rate = 44100, // corrected by info from bluetooth
.bits_per_sample = (i2s_bits_per_sample_t) 16, / the DAC module will only take the 8bits from MSB /
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
.communication_format = I2S_COMM_FORMAT_I2S_MSB,
.intr_alloc_flags = 0, // default interrupt priority
.dma_buf_count = 8,
.dma_buf_len = 64,
.use_apll = false
};
a2dp_sink.set_channels(I2S_CHANNEL_MONO);
a2dp_sink.set_i2s_config(i2s_config);
a2dp_sink.start("MyLoop");
}
Uploads correctly, but this is in the window.
C:\Users\aman_\AppData\Local\Temp\arduino_modified_sketch_188925\bt_music_receiver_todac.ino: In function 'void setup()':
C:\Users\aman\AppData\Local\Temp\arduino_modified_sketch_188925\bt_music_receiver_to_dac.ino:29:31: warning: 'I2S_COMM_FORMAT_I2S_MSB' is deprecated [-Wdeprecated-declarations]
.communication_format = I2S_COMM_FORMAT_I2SMSB,
^~~~~~~
In file included from C:\Users\aman\OneDrive\Documents\Arduino\hardware\espressif\esp32/tools/sdk/esp32/include/driver/include/driver/i2s.h:16,
from C:\Users\aman\OneDrive\Documents\Arduino\libraries\ESP32-A2DP-main\src/BluetoothA2DPCommon.h:36,
from C:\Users\aman\OneDrive\Documents\Arduino\libraries\ESP32-A2DP-main\src/BluetoothA2DPSink.h:22,
from C:\Users\aman_\AppData\Local\Temp\arduino_modified_sketch_188925\bt_music_receiver_todac.ino:19:
C:\Users\aman\OneDrive\Documents\Arduino\hardware\espressif\esp32/tools/sdk/esp32/include/hal/include/hal/i2s_types.h:96:5: note: declared here
I2S_COMM_FORMAT_I2S_MSB attribute((deprecated)) = 0x01, /!< I2S format MSB, (I2S_COMM_FORMAT_I2S |I2S_COMM_FORMAT_I2S_MSB) correspond to I2S_COMM_FORMAT_STAND_I2S
/
^~~~~~~
Thanks for responding so quickly, by the way!
.communication_format = I2S_COMM_FORMAT_STAND_I2S,
Updated this line. No change.
I just did a test and I confirm that I don't get any analog output as well. Something must be broken in the current version!
Oh no, that's unfortunate!
I think I have it working again: the communication format needs to be I2S_COMM_FORMAT_STAND_MSB The corrections have been committed to the main branch...
I tried it. I can definitely hear the audio deep in the background for the first time but it's overpowered by a sin wave like beeping sound (difficult to explain).
I suggest to replace the a2dp_sink.set_channels(I2S_CHANNEL_MONO) with a2dp_sink.set_mono_downmix(true);
Please note that noise is also a problem with bigger boards, so using an even smaller one is just increasing the problem. Try to power it from a battery pack and check the quality without amplifier to nail down the source of the problem...
Did you try the a2dp_sink.set_mono_downmix(true); Any feedback ?
As the header describes, I'm trying to use this on a TinyPICO (ESP32-PICO-D4) with the TinyPICO Audio Shield. The TinyPICO Audio Shield only uses one of the two DAC outputs, so it is a mono amplifier. I don't know if that has anything to do with why this isn't working, but I'm getting no audio. The only thing I can hear is crackling which does not correspond to the audio I'm trying to play at all. The device does show up and connect on my phone.
To be clear, I'm only trying to use the provided example with internal DAC output. I tried the I2S example as well just for kicks, and in that case, I was able to hear a difference when audio was paused and unpaused, but it is still (obviously in this case) just static.