Downmix BT stream from stereo to mono
Posted: Wed Aug 10, 2022 11:04 am
Hi everyone,
I am currently working with the LyraT eval board and try to understand audio pipelines.
I want to receive an audio stream via Bluetooth, downmix stereo to mono, and sent it via I2S to one of the codec chips.
For this reason, I tried to expand the "play_bt_music_example" with the "downmix_pipeline_example" where I think it would be easiest to not reconfigure the audio codec but mix L and R onto both output channels and check that the output of a single speaker contains information of both input channels.
So, I tried the following code but to no avail.
When I try to play a song, I always get the error
`A2DP_STREAM: No ineffecitive memory to allocate(190)`
but to me it seems like its basically the same usage of a downmixer as in the downmix example. Can the downmixer not be used to downmix a single (stereo) BT stream into a mono signal on I2S? Any help would be greatly appreciated.
I am currently working with the LyraT eval board and try to understand audio pipelines.
I want to receive an audio stream via Bluetooth, downmix stereo to mono, and sent it via I2S to one of the codec chips.
For this reason, I tried to expand the "play_bt_music_example" with the "downmix_pipeline_example" where I think it would be easiest to not reconfigure the audio codec but mix L and R onto both output channels and check that the output of a single speaker contains information of both input channels.
So, I tried the following code but to no avail.
Code: Select all
downmix_cfg_t downmix_cfg = DEFAULT_DOWNMIX_CONFIG();
downmix_cfg.downmix_info.source_num = 1;
audio_element_handle_t downmixer = downmix_init(&downmix_cfg);
esp_downmix_input_info_t source_info =
{
.samplerate = 48000,
.channel = 2,
.bits_num = 16,
.gain = {0, 0},
.transit_time = 500
};
source_info_init(downmixer, &source_info);
downmix_set_input_rb_timeout(downmixer, 0, 0);
downmix_set_input_rb(downmixer, audio_element_get_input_ringbuf(i2s_stream_writer), 0);
audio_pipeline_register(pipeline, downmixer, "downmixer");
const char *link_tag[3] = {"bt", "downmixer", "i2s"};
audio_pipeline_link(pipeline, &link_tag[0], 3);
`A2DP_STREAM: No ineffecitive memory to allocate(190)`
but to me it seems like its basically the same usage of a downmixer as in the downmix example. Can the downmixer not be used to downmix a single (stereo) BT stream into a mono signal on I2S? Any help would be greatly appreciated.