Open manalotobry opened 2 months ago
What's wrong with it? I used media_player with Music Assistant, and it works...
it doesnt play any music, but it does play TTS.
Here's the code I've used:
esphome:
name: esp32-s3-wake-word
friendly_name: ESP32-S3-Wake-word
platformio_options:
board_build.flash_mode: dio
on_boot:
- light.turn_on:
id: led_ww
blue: 100%
brightness: 60%
effect: fast pulse
esp32:
board: esp32-s3-devkitc-1
variant: esp32s3
framework:
type: esp-idf
version: recommended
sdkconfig_options:
CONFIG_ESP32_S3_BOX_BOARD: "y"
CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM: "16"
CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM: "512"
CONFIG_TCPIP_RECVMBOX_SIZE: "512"
CONFIG_TCP_SND_BUF_DEFAULT: "65535"
CONFIG_TCP_WND_DEFAULT: "512000"
CONFIG_TCP_RECVMBOX_SIZE: "512"
psram:
mode: octal # Please change this to quad for N8R2 and octal for N16R8
speed: 80MHz
# Enable Home Assistant API
api:
encryption:
key: "TFpb+pBAvQIS1MVwaA7EoJ2DkpWE+79UvVro7yMyGdU="
on_client_connected:
then:
- delay: 50ms
- light.turn_off: led_ww
- micro_wake_word.start:
on_client_disconnected:
then:
- voice_assistant.stop:
external_components:
- source:
type: git
url: https://github.com/gnumpi/esphome_audio
ref: dev-next
components: [ adf_pipeline, i2s_audio ]
refresh: 0s
logger:
ota:
- platform: esphome
password: "1245211a05eef56614a2ef5a3f3e971c"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp32-S3-Wake-Word"
password: "LJfUrdJk3svP"
button:
- platform: restart
name: "Restart"
id: but_rest
switch:
- platform: template
id: mute
name: mute
optimistic: true
on_turn_on:
- micro_wake_word.stop:
- voice_assistant.stop:
- light.turn_on:
id: led_ww
red: 100%
green: 0%
blue: 0%
brightness: 60%
effect: fast pulse
- light.turn_on:
id: led_strip
red: 100%
green: 0%
blue: 0%
brightness: 60%
effect: fast pulse
- delay: 2s
- light.turn_off:
id: led_ww
- light.turn_off:
id: led_strip
- light.turn_on:
id: led_ww
red: 100%
green: 0%
blue: 0%
brightness: 30%
- light.turn_on:
id: led_strip
red: 100%
green: 0%
blue: 0%
brightness: 30%
on_turn_off:
- micro_wake_word.start:
- light.turn_on:
id: led_ww
red: 0%
green: 100%
blue: 0%
brightness: 60%
effect: fast pulse
- light.turn_on:
id: led_strip
red: 0%
green: 100%
blue: 0%
brightness: 60%
effect: fast pulse
- delay: 2s
- light.turn_off:
id: led_strip
- light.turn_off:
id: led_ww
binary_sensor:
- platform: gpio
id: button01
name: "Mute Button" # Physical Mute switch
pin:
number: GPIO10 #Physical Button connected to this pin.
inverted: True
mode:
input: True
pullup: True
on_press:
then:
- switch.toggle: mute
light:
- platform: esp32_rmt_led_strip
id: led_ww
rgb_order: GRB
pin: GPIO48
num_leds: 1
rmt_channel: 0
chipset: ws2812
name: "On board light"
effects:
- pulse:
- pulse:
name: "Fast Pulse"
transition_length: 0.5s
update_interval: 0.5s
min_brightness: 0%
max_brightness: 100%
- platform: esp32_rmt_led_strip
id: led_strip
rgb_order: GRB
pin: GPIO09
num_leds: 29
rmt_channel: 1
chipset: ws2812
name: "Led Strip"
effects:
- pulse:
- pulse:
name: "Fast Pulse"
transition_length: 0.5s
update_interval: 0.5s
min_brightness: 0%
max_brightness: 100%
- addressable_scan:
name: "Scan Effect With Custom Values"
move_interval: 5ms
scan_width: 10
# Audio and Voice Assistant Config
i2s_audio:
- id: i2s_in
i2s_lrclk_pin: GPIO3
i2s_bclk_pin: GPIO2
- id: i2s_out
i2s_lrclk_pin: GPIO6
i2s_bclk_pin: GPIO7
adf_pipeline:
- platform: i2s_audio
type: audio_out
id: adf_i2s_out
i2s_audio_id: i2s_out
i2s_dout_pin: GPIO8
- platform: i2s_audio
type: audio_in
id: adf_i2s_in
i2s_audio_id: i2s_in
i2s_din_pin: GPIO4
channel: left
sample_rate: 16000
bits_per_sample: 32bit
pdm: false
microphone:
- platform: adf_pipeline
id: adf_microphone
gain_log2: 3
keep_pipeline_alive: true
pipeline:
- adf_i2s_in
- self
media_player:
- platform: adf_pipeline
id: adf_media_player
name: adf_media_player
internal: false
keep_pipeline_alive: true
pipeline:
- self
- adf_i2s_out
micro_wake_word:
on_wake_word_detected:
- voice_assistant.start:
wake_word: !lambda return wake_word;
silence_detection: true
- light.turn_on:
id: led_ww
red: 30%
green: 30%
blue: 70%
brightness: 60%
effect: fast pulse
- light.turn_on:
id: led_strip
effect: "Scan Effect With Custom Values"
red: 80%
green: 0%
blue: 80%
brightness: 80%
models:
- model: hey_jarvis
voice_assistant:
id: va
microphone: adf_microphone
auto_gain: 31dBFS
noise_suppression_level: 2
volume_multiplier: 4.0
media_player: adf_media_player
on_stt_end:
then:
- light.turn_off: led_ww
- light.turn_off: led_strip
on_error:
- micro_wake_word.start:
on_end:
then:
- light.turn_off: led_ww
- light.turn_off: led_strip
- wait_until:
not:
voice_assistant.is_running:
- micro_wake_word.start:
Hope you can enlighten me and thanks a lot, brother :) @formatBCE
@manalotobry just checked - my audio config is identical. And my 2 satellites are playing music.... Although I don't use them for music, they're too weak.
But Mischa said yesterday, that with new ESPHome modules, that will be released next month, his adf pipeline is redundant... Will check and see.
Hi, first of all thanks for the code - truly appreciate it.
May I ask if there's a way to stream or play any audio to the speakers? So far, I can play TTS on its media player but no luck with streaming or playing audio.