Notifications
Clear all

I2S Audio -- how does the Audio library identify which channel is being read or written?

2 Posts
2 Users
0 Likes
479 Views
 John
(@jhb)
Member
Joined: 2 months ago
Posts: 12
Topic starter  

I’ve been watching Bill's ESP32 Sound - Working with I2S,

video and have a couple of questions.

In the chapter, at 10:18 - Using an I2S Microphone, the example is all mono, left channel.  How would I do both channels for stereo?  Obviously I would hook up a 2nd microphone strapped for the right channel, and change the channel_format in the i2s_config structure.  In Serial Monitor, and other places, I’d need to know the data for each channel separately.  So, in the Audio library, in loop(), where the i2s_read() is performed, how can the code determine from which channel the data is coming when in stereo mode?  Is that encoded in buffer data, or is there some corresponding metadata?  I also want programmatically generate sound data to send to output amplifiers, and would like to know how the write function discriminates between channels.

It seems probable that the channels are interleaved in the read buffer, but I can't find where that is specified.  Nor is it clear (assuming the above assumption is correct) which channel is first in the buffer.

Thanks for any thoughts.

- John


   
Quote
Topic Tags
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6982
 

@jhb Bill covers stereo in his article at ARTICLE

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote