An Audio Element <../framework/audio_element>
responsible for acquiring of audio data and then sending the data out after processing, is called the Audio Stream.
The following stream types are supported:
To set the stream type, use provided structure, e.g. :cppi2s_stream_cfg_t
for I2S stream, together with :cppaudio_stream_type_t
enumerator.
See description below for the API details.
When the I2S stream type is "writer", the data may be sent either to a codec chip or to the internal DAC of ESP32. To simplify configuration, two macros are provided to cover each case:
- :cpp
I2S_STREAM_CFG_DEFAULT
- the I2S stream is communicating with a codec chip - :cpp
I2S_STREAM_INTERNAL_DAC_CFG_DEFAULT
- the stream data are sent to the DAC
Each macro configures several other stream parameters such as sample rate, bits per sample, DMA buffer length, etc.