Page 1 of 1

I2S select audio channel

Posted: Tue May 04, 2021 11:17 am
by MP@L&T
Hi,

I am using a ESP32 Lyrat dev board with two speakers plugged into the left and right channel outputs and have got audio examples running. I am now using the play_sdcard_mp3_control_example project to try and select only one channel.


In the program after the line
i2s_stream_cfg_t i2s_cfg = I2S_STREAM_CFG_DEFAULT();

I have tried adding the line
i2s_cfg.i2s_config.channel_format = I2S_CHANNEL_FMT_ALL_LEFT;
and
i2s_cfg.i2s_config.channel_format = I2S_CHANNEL_FMT_ONLY_LEFT;

but the board is still playing audio out of both channels. Can anyone help me with this, thanks?

Re: I2S select audio channel

Posted: Sat May 15, 2021 4:24 pm
by ims67-fdc
Hi,

I had a similar issue with play_mp3 example.
After starting the audio pipeline, when happen the event AEL_MSG_CMD_REPORT_MUSIC_INFO,
the i2s_stream config is updated with info from mp3 decoder.

The call
audio_element_setinfo(i2s_stream_writer, &music_info);

overwrite the initial config of i2s_stream, making it to become again stereo.
Try commenting the previous row of code.

In your case, to select one channel from a stereo stream,
use I2S_CHANNEL_FMT_ALL_LEFT or I2S_CHANNEL_FMT_ALL_RIGHT.

This is useful
https://github.com/miketeachman/micropy ... -examples/

Re: I2S select audio channel

Posted: Mon May 17, 2021 10:41 am
by MP@L&T
Hi, thanks for the reply.

I have tried out what you suggested. I commented out the whole if block that contained
audio_element_setinfo(i2s_stream_writer, &music_info);

and set the i2s channel to I2S_CHANNEL_FMT_ALL_RIGHT.

My Lyrat dev board still plays audio out on both channels with stereo and mono sound tracks.