mirror of
https://github.com/randybb/esphome-configs.git
synced 2026-10-14 08:35:12 +02:00
mcu-echo-1: migrate to speaker-based media_player with mixer
The i2s_audio media_player platform was removed; rebuild the audio pipeline like mcu-echo.yaml with an i2s_audio speaker feeding a mixer, so media playback, TTS announcements, and rtttl beeps all share the one physical DAC output without conflicting. Also uses format: NONE instead of the deprecated codec_support_enabled. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b818b5291b
commit
173514f73e
1 file changed
+43
-38
+43
-38
@@ -15,33 +15,15 @@ esphome:
|
||||
esp32:
|
||||
variant: esp32
|
||||
framework:
|
||||
type: arduino
|
||||
# version: 2.0.14
|
||||
# platform_version: 6.5.0
|
||||
# type: esp-idf
|
||||
# version: 5.1.2
|
||||
# platform_version: 6.5.0
|
||||
|
||||
|
||||
external_components:
|
||||
- source: components
|
||||
# - source:
|
||||
# type: git
|
||||
# url: https://github.com/nielsnl68/esphome
|
||||
# ref: nvds-RTTTL_I2S
|
||||
# components: [ speaker, rtttl ]
|
||||
# refresh: 0s
|
||||
- source: github://pr#5177
|
||||
components: [rtttl]
|
||||
refresh: 0s
|
||||
type: esp-idf
|
||||
|
||||
packages:
|
||||
common: !include common/common_esp8266.yaml # this profile is without fancy features that are not supported by arduino
|
||||
common: !include common/common.yaml
|
||||
|
||||
api:
|
||||
services:
|
||||
actions:
|
||||
# https://github.com/granadaxronos/120-SONG_NOKIA_RTTTL_RINGTONE_PLAYER_FOR_ARDUINO_UNO/blob/master/RTTTL_PLAYER/songs.h
|
||||
- service: play_rtttl
|
||||
- action: play_rtttl
|
||||
variables:
|
||||
song: string
|
||||
then:
|
||||
@@ -81,7 +63,7 @@ light:
|
||||
- platform: esp32_rmt_led_strip
|
||||
name: LED
|
||||
id: neo_buildin
|
||||
rgb_order: GRB
|
||||
channel_colors: GRB
|
||||
pin: 27
|
||||
num_leds: 1
|
||||
chipset: ws2812
|
||||
@@ -110,35 +92,58 @@ light:
|
||||
# # brightness: 30%
|
||||
|
||||
i2s_audio:
|
||||
- id: speaker_bus
|
||||
i2s_lrclk_pin: 33
|
||||
i2s_bclk_pin: 19
|
||||
|
||||
media_player:
|
||||
- platform: i2s_audio
|
||||
id: media_out
|
||||
name: ${name} Player
|
||||
dac_type: external
|
||||
i2s_dout_pin:
|
||||
number: 22
|
||||
allow_other_uses: true
|
||||
mode: mono
|
||||
|
||||
speaker:
|
||||
- platform: i2s_audio
|
||||
id: echo_speaker
|
||||
id: speaker_id
|
||||
i2s_audio_id: speaker_bus
|
||||
dac_type: external
|
||||
i2s_dout_pin:
|
||||
number: 22
|
||||
allow_other_uses: true
|
||||
i2s_dout_pin: 22
|
||||
channel: mono
|
||||
sample_rate: 16000
|
||||
buffer_duration: 100ms
|
||||
- platform: mixer
|
||||
id: mixer_speaker_id
|
||||
output_speaker: speaker_id
|
||||
num_channels: 1
|
||||
task_stack_in_psram: false
|
||||
source_speakers:
|
||||
- id: announcement_spk_mixer_input
|
||||
- id: media_spk_mixer_input
|
||||
- id: rtttl_spk_mixer_input
|
||||
- platform: resampler
|
||||
id: media_spk_resampling_input
|
||||
output_speaker: media_spk_mixer_input
|
||||
- platform: resampler
|
||||
id: announcement_spk_resampling_input
|
||||
output_speaker: announcement_spk_mixer_input
|
||||
- platform: resampler
|
||||
id: rtttl_spk_resampling_input
|
||||
output_speaker: rtttl_spk_mixer_input
|
||||
|
||||
media_player:
|
||||
- platform: speaker
|
||||
id: media_out
|
||||
name: ${name} Player
|
||||
buffer_size: 14000
|
||||
media_pipeline:
|
||||
speaker: media_spk_resampling_input
|
||||
format: NONE
|
||||
announcement_pipeline:
|
||||
speaker: announcement_spk_resampling_input
|
||||
format: NONE
|
||||
|
||||
rtttl:
|
||||
id: my_rtttl
|
||||
speaker: echo_speaker
|
||||
speaker: rtttl_spk_resampling_input
|
||||
|
||||
microphone:
|
||||
- platform: i2s_audio
|
||||
id: echo_microphone
|
||||
i2s_audio_id: speaker_bus
|
||||
i2s_din_pin: 23
|
||||
adc_type: external
|
||||
pdm: true
|
||||
|
||||
Reference in new issue
Block a user