Microphone Components
The microphone domain contains common functionality shared across the
microphone platforms.
Base Microphone Configuration
Section titled “Base Microphone Configuration”Configuration variables:
- on_data (Optional, Automation): An automation to perform when new data is received.
Microphone Source Configuration
Section titled “Microphone Source Configuration”A microphone source configuration is used by components to ensure that it receives audio in the required format.
Configuration variables:
-
microphone (Required, ID): The microphone to use for input.
-
bits_per_sample (Optional, int): The bits per sample to use as input to the component. May be restricted by the component to a specific value.
-
channels (Optional, list): A list of 0-indexed channel numbers enabling them to use as input to the component. The total amount may be restricted by the component. Defaults to 0, the first channel read by the microphone.
-
gain_factor (Optional, int): The gain factor to apply to audio read from the microphone. Ranges from 1 to 64. Defaults to 1, no gain.
Microphone Actions
Section titled “Microphone Actions”All microphone actions can be used without specifying an id if you have only one microphone in
your configuration YAML.
Configuration variables:
id (Optional, ID): The microphone to control. Defaults to the only one in YAML.
microphone.capture Action
Section titled “microphone.capture Action”This action will start capturing audio data from the microphone. The data will be passed to any components listening
and will be available in the on_data trigger.
microphone.stop_capture Action
Section titled “microphone.stop_capture Action”This action will stop capturing audio data from the microphone.
microphone.mute Action
Section titled “microphone.mute Action”This action will apply a software mute to the audio data from the microphone before passing it to any listening components.
microphone.unmute Action
Section titled “microphone.unmute Action”This action will disable applying a software mute initiated with microphone.mute.
Microphone Triggers
Section titled “Microphone Triggers”microphone.on_data Trigger
Section titled “microphone.on_data Trigger”This trigger will fire when new data is received from the microphone.
The data is available as a std::vector<uint8_t> in the variable x.
This data is the raw microphone audio and includes all the read bits per sample and channels.
microphone: - platform: ... on_data: - logger.log: format: "Received %d bytes" args: ['x.size()']Configuration variables:
- id (Optional, ID): The microphone to check. Defaults to the only one in YAML.
Microphone Conditions
Section titled “Microphone Conditions”All microphone conditions can be used without specifying an id if you have only one microphone in
your configuration YAML.
Configuration variables:
id (Optional, ID): The microphone to check. Defaults to the only one in YAML.
microphone.is_capturing Condition
Section titled “microphone.is_capturing Condition”This condition will check if the microphone is currently capturing audio data.
microphone.is_muted Condition
Section titled “microphone.is_muted Condition”This condition will check if the microphone is currently apply a software mute.