I2S select audio channel

MP@L&T
Posts: 6
Joined: Wed Feb 17, 2021 11:34 am

I2S select audio channel

Postby MP@L&T » Tue May 04, 2021 11:17 am

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?

ims67-fdc
Posts: 1
Joined: Sat May 15, 2021 3:35 pm

Re: I2S select audio channel

Postby ims67-fdc » Sat May 15, 2021 4:24 pm

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/

MP@L&T
Posts: 6
Joined: Wed Feb 17, 2021 11:34 am

Re: I2S select audio channel

Postby MP@L&T » Mon May 17, 2021 10:41 am

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.

Who is online

Users browsing this forum: No registered users and 6 guests