ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
esphome::i2s_audio Namespace Reference

Data Structures

class  DCOffsetFilter
 Removes DC from mono or stereo PCM, retaining separate channel histories between buffers. More...
 
class  I2SAudioBase
 
class  I2SAudioComponent
 
class  I2SAudioIn
 
class  I2SAudioMicrophone
 
class  I2SAudioOut
 
class  I2SAudioSpeaker
 Standard I2S speaker implementation. More...
 
class  I2SAudioSpeakerBase
 Abstract base class for I2S audio speaker implementations. More...
 
class  I2SAudioSpeakerSPDIF
 SPDIF speaker implementation. More...
 
class  SPDIFEncoder
 

Typedefs

using SPDIFBlockCallback = esp_err_t (*)(void *user_ctx, uint32_t *data, size_t size, TickType_t ticks_to_wait)
 Callback signature for block completion (raw function pointer for minimal overhead)
 

Enumerations

enum  MicrophoneEventGroupBits : uint32_t {
  COMMAND_STOP = (1 << 0) , TASK_STARTING = (1 << 10) , TASK_RUNNING = (1 << 11) , TASK_STOPPED = (1 << 13) ,
  ALL_BITS = 0x00FFFFFF
}
 
enum  SpeakerEventGroupBits : uint32_t {
  COMMAND_START = (1 << 0) , COMMAND_STOP = (1 << 0) , COMMAND_STOP_GRACEFULLY = (1 << 2) , TASK_STARTING = (1 << 10) ,
  TASK_RUNNING = (1 << 11) , TASK_STOPPING = (1 << 12) , TASK_STOPPED = (1 << 13) , ERR_ESP_NO_MEM = (1 << 19) ,
  ERR_DROPPED_EVENT = (1 << 20) , ALL_BITS = 0x00FFFFFF
}
 
enum class  I2SCommFmt : uint8_t { STANDARD , PCM , MSB }
 

Functions

 ESPHOME_LOG_TAG (TAG, "i2s_audio")
 
int64_t dma_capture_time_us (uint32_t bytes_received, uint32_t drops, uint32_t drops_before_read, int64_t receive_time_us, uint32_t bytes_read_before, uint32_t bytes_read, uint32_t dma_desc_num, uint32_t dma_buffer_bytes, const audio::AudioStreamInfo &stream_info)
 Returns when the first frame of a read was captured, counted back from the newest DMA buffer, or 0 when the time is unknown.
 
 ESPHOME_LOG_TAG (TAG, "i2s_audio.microphone")
 
 ESPHOME_LOG_TAG (TAG, "i2s_audio.spdif")
 
 ESPHOME_LOG_TAG (TAG, "i2s_audio.speaker")
 
 ESPHOME_LOG_TAG (TAG, "i2s_audio.speaker.std")
 
 ESPHOME_LOG_TAG (TAG, "i2s_audio.spdif_encoder")
 

Typedef Documentation

◆ SPDIFBlockCallback

using esphome::i2s_audio::SPDIFBlockCallback = esp_err_t (*)(void *user_ctx, uint32_t *data, size_t size, TickType_t ticks_to_wait)

Callback signature for block completion (raw function pointer for minimal overhead)

Parameters
user_ctxUser context pointer passed during callback registration
dataPointer to SPDIF encoded block data
sizeSize of the block in bytes (always SPDIF_BLOCK_SIZE_BYTES)
ticks_to_waitFreeRTOS ticks to wait for write completion
Returns
ESP_OK on success, or an error code

Definition at line 34 of file spdif_encoder.h.

Enumeration Type Documentation

◆ I2SCommFmt

enum class esphome::i2s_audio::I2SCommFmt : uint8_t
strong
Enumerator
STANDARD 
PCM 
MSB 

Definition at line 9 of file i2s_audio_speaker_standard.h.

◆ MicrophoneEventGroupBits

Enumerator
COMMAND_STOP 
TASK_STARTING 
TASK_RUNNING 
TASK_STOPPED 
ALL_BITS 

Definition at line 32 of file i2s_audio_microphone.cpp.

◆ SpeakerEventGroupBits

Enumerator
COMMAND_START 
COMMAND_STOP 
COMMAND_STOP_GRACEFULLY 
TASK_STARTING 
TASK_RUNNING 
TASK_STOPPING 
TASK_STOPPED 
ERR_ESP_NO_MEM 
ERR_DROPPED_EVENT 
ALL_BITS 

Definition at line 27 of file i2s_audio_speaker.h.

Function Documentation

◆ dma_capture_time_us()

int64_t esphome::i2s_audio::dma_capture_time_us ( uint32_t bytes_received,
uint32_t drops,
uint32_t drops_before_read,
int64_t receive_time_us,
uint32_t bytes_read_before,
uint32_t bytes_read,
uint32_t dma_desc_num,
uint32_t dma_buffer_bytes,
const audio::AudioStreamInfo & stream_info )
inline

Returns when the first frame of a read was captured, counted back from the newest DMA buffer, or 0 when the time is unknown.

All byte and buffer counts are since the channel was enabled and wrap at 2^32.

Parameters
bytes_receivedBytes the interrupt has received, taken after the read
dropsBuffers dropped from the driver's full queue, taken with bytes_received
drops_before_readBuffers dropped, taken before the read
receive_time_usWhen the newest buffer was received, taken with bytes_received, or 0 if none has been
bytes_read_beforeBytes read before this read
bytes_readBytes this read returned
dma_desc_numNumber of DMA buffers
dma_buffer_bytesSize of each DMA buffer
stream_infoFormat of the audio read

Definition at line 23 of file capture_time.h.

◆ ESPHOME_LOG_TAG() [1/6]

esphome::i2s_audio::ESPHOME_LOG_TAG ( TAG ,
"i2s_audio"  )

◆ ESPHOME_LOG_TAG() [2/6]

esphome::i2s_audio::ESPHOME_LOG_TAG ( TAG ,
"i2s_audio.microphone"  )

◆ ESPHOME_LOG_TAG() [3/6]

esphome::i2s_audio::ESPHOME_LOG_TAG ( TAG ,
"i2s_audio.spdif"  )

◆ ESPHOME_LOG_TAG() [4/6]

esphome::i2s_audio::ESPHOME_LOG_TAG ( TAG ,
"i2s_audio.spdif_encoder"  )

◆ ESPHOME_LOG_TAG() [5/6]

esphome::i2s_audio::ESPHOME_LOG_TAG ( TAG ,
"i2s_audio.speaker"  )

◆ ESPHOME_LOG_TAG() [6/6]

esphome::i2s_audio::ESPHOME_LOG_TAG ( TAG ,
"i2s_audio.speaker.std"  )