As the title states, I’m working on a hearing assistance device. I built an analog version that worked really good, but after looking into I2S, I know that’s the way to go forward.
I received the hardware for the build yesterday, consisting of a Seeed Studio XIAO ESP32-S3 controller, MAX98357 amplifiers and INMP441 microphones. I haven’t started the actual build yet, but will be soldering the headers and starting the breadboard this morning as soon as my eyes are ready. All of the audio data will stay “local” to the device.
I know that I won’t be sticking with ESPHome for the build, mainly because there’s additional processing that I eventually want to incorporate via the Arduino_Audio_Tools library, like the 3-band equalizer and possibly pitch-shifting.
Right now, though, all I want the headset to be able to do is play whatever sound is coming from the mics to the speakers (L & R for each). Incorporating volume control & a stop/start switch for HA will be useful, as well, for obvious reasons. I’ve read through all of the I2S sections of the ESPHome online manual, and copied the sections that looked obvious to me. I’ll post what I have below, but none of it is configured, except for where I added the left/right designations. I would love any ideas/suggestions for this project.
i2s_audio:
i2s_lrclk_pin: GPIOXX
i2s_bclk_pin: GPIOXX
i2s_mclk_pin: GPIOXX
microphone:
- platform: i2s_audio
id: mic_left
channel: left
adc_type: external
i2s_din_pin: GPIOXX
- platform: i2s_audio
id: mic_right
channel: right
adc_type: external
i2s_din_pin: GPIOXX
speaker:
- platform: i2s_audio
id: spk_left
channel: left
dac_type: external
i2s_dout_pin: GPIOXX
- platform: i2s_audio
id: spk_right
channel: right
dac_type: external
i2s_dout_pin: GPIOXX
binary_sensor:
- platform: template
name: 'Play'
id: spk_play
on_state:
then:
- if:
condition:
- speaker.is_playing: spk_left
then:
- speaker.stop: spk_left
- speaker.stop: spk_right
else:
- speaker.start: spk_left
- speaker.start: spk_right
number:
- platform: template
name: 'Volume'
id: spk_volume
step: 10
min_value: 10
max_value: 100
mode: SLIDER
initial_value: 10
optimistic: True
on_value:
then:
- speaker.volume_set:
id: spk_left
Volume: spk_volume
- speaker.volume_set:
id: spk_right
Volume: spk_volume