miketeachman/micropython-i2s-examples

Support for int. ADC via I2S ?

mtk11 opened this issue · 2 comments

mtk11 commented

Some projects like ESP32 Audio Input - MAX4466, MAX9814, SPH0645LM4H, INMP441 use the internal ADC via I2S for sampling. Availability of such functionality ?

The machine.I2S class was designed to only support devices that communicate with the I2S protocol.

To my knowledge there is no-one working to support analog microphones on the official MicroPython implementation. To support an analog microphone the machine.ADC class could be extended, supporting devices such as the MAX4466 and the MAX9814. At the moment, the machine.ADC class samples an analog signal, producing an single value. By extending the machine.ADC API, the incoming analog audio signal could be sampled, and a buffer filled with audio samples. e.g machine.ADC.readinto(buf). For the ESP32 port, the ADC components of the ESP-IDF I2S peripheral interface would be used.

The Loboris port of the ESP32 allows sampling of audio data using the machine.ADC class.
adc.read_timed()

Note: Two devices you mention, SPH0645LM4H and INPM441, are not analog devices - they are I2S devices that work with the I2S protocol and are supported by machine.I2S

I hope that answers your question.

There are no plans to support analog microphones in the machine.I2S class, so closing this issue.