mulcmu
May 21, 2023, 12:50pm
23
I put the @Night.Dav3 patches from the PR3552 discussion in a repository if anyone wants to test them out. Change the external_components
section from above yaml as shown below.
external_components:
- source: github://mulcmu/esphome-es8388-a1s@nightdav-patch
components: [es8388]
refresh: 0s
#### Not needed if on 2023.5.0 or later
# - source: github://pr#4775
# components: [adc, i2s_audio, microphone]
# refresh: 0s
1 Like
ardenking
(Ardenking)
May 21, 2023, 5:25pm
24
Moving the caps looks easy enough do you need to also update the register too or is that in the new patch ?
mulcmu
May 21, 2023, 6:12pm
25
The external component I posted above now has the setup changes recommended by @Night.Dav3 up through this post . So the register changes to get mics working and now enable automatic gain correction for improved voice detection.
It compiles fine for me but I haven’t tested as I messed up while moving one of the capacitors.
You have to modify the caps and use the new code to have it working.
@mulcmu : voice assistant uses the right mic in mono mode, so if you do the mod on the right mic only it might work…
1 Like
pepe59
(Pepe59)
May 21, 2023, 6:59pm
27
I can’t find anywhere what the size of the JST connectors are for connecting the speakers.
Can anyone provide information?
Thank you
ardenking
(Ardenking)
May 24, 2023, 2:24pm
29
Thanks for your hard work and assi6 have it working now after moving the caps and using the new code
pepe59
(Pepe59)
May 24, 2023, 3:23pm
30
I have the same v2.2 A247 board.
I will move the capacitors to the correct positions.
I would just like to know what is the distance from the microphone so that the assist recognizes the voice command correctly?
ardenking
(Ardenking)
May 24, 2023, 3:36pm
31
I had the beard at arms length on the desk and it could still function
Tesat
June 2, 2023, 9:36am
32
if got everything working but i wanted to connect a screen to the i2c buss what io pins are these where on the board has to be scl sda ?
Tesat
June 2, 2023, 7:23pm
33
Nevermind if got it working but the voice recognition or mic is not really god. Is there a possibility to add a external i2s mic ?
pepe59
(Pepe59)
June 4, 2023, 7:14pm
34
The esp32 v 2.2 A149 board also had misplaced capacitors. After the fix, voice control works.
I must be doing something wrong. Pressing KEY6 and saying the command to turn the light on and off works, but no voice from the player.
Player esp32-A1s tested via NabuCasa (play voice) and it works.
What else do I need to set in HA for the esp32-A1s player to work (voice response).
1 Like
I would like to use an external Mic with mine as well. Did you ever get this working?
pepe59
(Pepe59)
October 23, 2023, 7:18am
36
Has anyone managed to get the wake word assist to work on this board?
stevemann
(Stephen Mann (YAML-challenged))
October 27, 2023, 2:01pm
37
In my house she appreciates the unfinished projects. They keep me busy.
1 Like
cociweb
(Cociweb)
November 7, 2023, 8:42pm
38
A new temporal PR is opened to @mulcmu 's repo. It gives support for the headphone output as well.
cociweb
(Cociweb)
November 7, 2023, 8:48pm
39
Fortunatelly, the tts response will be supported in the upcoming release(s), since now only mp3 tts (behind http) is the only supported now. Piper returns wav/raw by default:
esphome:dev
← robin-thoni:dev
opened 04:14PM - 03 Nov 23 UTC
This adds support for raw files. This allows to play TTS response files generate… d by Home Assistant Voice Assistant.
See https://github.com/home-assistant/core/issues/92969 for context.
home-assistant:dev
← home-assistant:synestheisam-20231025-tts-autoconvert
opened 07:38PM - 25 Oct 23 UTC
<!--
You are amazing! Thanks for contributing to our project!
Please, DO N… OT DELETE ANY TEXT from this template! (unless instructed).
-->
## Breaking change
<!--
If your PR contains a breaking change for existing users, it is important
to tell them what breaks, how to make it work again and why we did this.
This piece of text is published with the release notes, so it helps if you
write it towards our users, not us.
Note: Remove this section if this PR is NOT a breaking change.
-->
The `ATTR_AUDIO_OUTPUT` attribute is deprecated. This previously told the TTS system what audio format to generate. It has been superseded by `ATTR_PREFERRED_FORMAT` (see below).
Unless `ATTR_PREFERRED_FORMAT` is given, TTS audio will always be converted to (or kept in) MP3 format.
All TTS audio generation is now non-blocking. A media source id/URL will be returned immediately while TTS audio is generated in the background. Resolving the media/fetching the URL will block until generation is finished.
## Proposed change
<!--
Describe the big picture of your changes here to communicate to the
maintainers why we should accept this pull request. If it fixes a bug
or resolves a feature request, be sure to link to that issue in the
additional information section.
-->
Different TTS systems produce audio in different formats, some [not compatible with many media players](https://github.com/home-assistant/core/issues/92969). Some TTS systems support `ATTR_AUDIO_OUTPUT` format to change the output format, there is no guarantee that the TTS system can generate the requested audio format. Wyoming, for example, can only generate WAV files.
This PR adds several things to TTS:
1. A new `ATTR_PREFERRED_FORMAT` option lets the caller select a different audio format than what the TTS natively generates, such as "wav". Unless provided, it **defaults to MP3**.
2. Two additional options, `ATTR_PREFERRED_SAMPLE_RATE` and `ATTR_PREFERRED_SAMPLE_CHANNELS`, allow the caller to control the exact details of the final audio. This is required for ESPHome to stream audio to speakers.
3. All TTS audio generation is now non-blocking.
Lastly, the ESPHome voice assistant code has been updated to request 16 Khz 16-bit mono WAV audio when it will be streamed back to the client. This should now work with any TTS system.
## Type of change
<!--
What type of change does your PR introduce to Home Assistant?
NOTE: Please, check only 1! box!
If your PR requires multiple boxes to be checked, you'll most likely need to
split it into multiple PRs. This makes things easier and faster to code review.
-->
- [ ] Dependency upgrade
- [x] Bugfix (non-breaking change which fixes an issue)
- [ ] New integration (thank you!)
- [x] New feature (which adds functionality to an existing integration)
- [ ] Deprecation (breaking change to happen in the future)
- [x] Breaking change (fix/feature causing existing functionality to break)
- [ ] Code quality improvements to existing code or addition of tests
## Additional information
<!--
Details are important, and help maintainers processing your PR.
Please be sure to fill out additional details, if applicable.
-->
- This PR fixes or closes issue: fixes # https://github.com/home-assistant/addons/issues/3030 https://github.com/home-assistant/core/issues/92969
- This PR is related to issue:
- Link to documentation pull request:
## Checklist
<!--
Put an `x` in the boxes that apply. You can also fill these out after
creating the PR. If you're unsure about any of them, don't hesitate to ask.
We're here to help! This is simply a reminder of what we are going to look
for before merging your code.
-->
- [ ] The code change is tested and works locally.
- [ ] Local tests pass. **Your PR cannot be merged unless tests pass**
- [ ] There is no commented out code in this PR.
- [ ] I have followed the [development checklist][dev-checklist]
- [ ] I have followed the [perfect PR recommendations][perfect-pr]
- [ ] The code has been formatted using Black (`black --fast homeassistant tests`)
- [ ] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated for [www.home-assistant.io][docs-repository]
If the code communicates with devices, web services, or third-party tools:
- [ ] The [manifest file][manifest-docs] has all fields filled out correctly.
Updated and included derived files by running: `python3 -m script.hassfest`.
- [ ] New or updated dependencies have been added to `requirements_all.txt`.
Updated by running `python3 -m script.gen_requirements_all`.
- [ ] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
- [ ] Untested files have been added to `.coveragerc`.
<!--
This project is very active and we have a high turnover of pull requests.
Unfortunately, the number of incoming pull requests is higher than what our
reviewers can review and merge so there is a long backlog of pull requests
waiting for review. You can help here!
By reviewing another pull request, you will help raise the code quality of
that pull request and the final review will be faster. This way the general
pace of pull request reviews will go up and your wait time will go down.
When picking a pull request to review, try to choose one that hasn't yet
been reviewed.
Thanks for helping out!
-->
To help with the load of incoming pull requests:
- [ ] I have reviewed two other [open pull requests][prs] in this repository.
[prs]: https://github.com/home-assistant/core/pulls?q=is%3Aopen+is%3Apr+-author%3A%40me+-draft%3Atrue+-label%3Awaiting-for-upstream+sort%3Acreated-desc+review%3Anone+-status%3Afailure
<!--
Thank you for contributing <3
Below, some useful links you could explore:
-->
[dev-checklist]: https://developers.home-assistant.io/docs/development_checklist/
[manifest-docs]: https://developers.home-assistant.io/docs/creating_integration_manifest/
[quality-scale]: https://developers.home-assistant.io/docs/integration_quality_scale_index/
[docs-repository]: https://github.com/home-assistant/home-assistant.io
[perfect-pr]: https://developers.home-assistant.io/docs/review-process/#creating-the-perfect-pr
Unfortunatelly, https streams (such as tts) are still unsupported:
opened 12:59PM - 29 Mar 23 UTC
### The problem
I2S Media Player is defined as per [dokumentation](https://es… phome.io/components/media_player/i2s_audio.html) with MAX98357 DAC module. Works very well playing local (from HA server) mp3 files and also with Text to Spech provided by Nabucasa.
However when I want to play internet radio station (defined in HA and visible in Media folder it does not play. It does not do anything and there is very little (or none) information in logs.
The same radio station works fine on Webbrowser media (in HA) and on other player so it must be related to this particular player
### Which version of ESPHome has the issue?
2023.3.2
### What type of installation are you using?
Home Assistant Add-on
### Which version of Home Assistant has the issue?
2023.3.6
### What platform are you using?
ESP32
### Board
RPi4
### Component causing the issue
I2S Media Player
### Example YAML snippet
```yaml
ESP32 configuration related to i2s media player.
The rest of the YAML is very basic.
media_player:
- platform: i2s_audio
name: ESPHome I2S Media Player
dac_type: external
i2s_lrclk_pin: GPIO33
i2s_dout_pin: GPIO22
i2s_bclk_pin: GPIO19
mode: stereo
```
### Anything in the logs that might be useful for us?
```txt
I have changed logs for VERY_VERBOSE and here is the part related to not functioning radio station:
[22:51:15][D][media_player:059]: 'ESPHome I2S Media Player' - Setting
[22:51:15][D][media_player:066]: Media URL: https://stream.0nlineradio.com/80s-rock?ref=radiobrowser
[22:51:15][VV][api.service:324]: send_media_player_state_response: MediaPlayerStateResponse {
key: 3210548230
state: MEDIA_PLAYER_STATE_PLAYING
volume: 1
muted: NO
}
[22:51:15][V][component:204]: Component api took a long time for an operation (0.16 s).
[22:51:15][V][component:205]: Components should block for at most 20-30ms.
[22:51:15][VV][api.service:324]: send_media_player_state_response: MediaPlayerStateResponse {
key: 3210548230
state: MEDIA_PLAYER_STATE_IDLE
volume: 1
muted: NO
}
```
### Additional information
Some similar cases of other users in this tops: https://community.home-assistant.io/t/esp-home-media-player-play-https-media-url/442000/16
_No response_
loicd
(Loic Daigle)
December 16, 2023, 6:40pm
40
Hello , I got the board to work (STT and TTS) with Home-Assistant but like @pepe59 asked , does anybody knows how to make OpenWakeWord work for this board?
schmurtz
(TheSchmurtz)
February 20, 2024, 3:28pm
41
Hi, first you have to know that there are at least 7 versions of the A1S Audio Kit. The major difference is a version with AC101 codec and another one with ES8388 but as we can read in this topic there’s also some other differences (like the caps on the wrong places sometimes).
About these versions :
On my side, I have an old A1S board with AC101 codec. Fortunately I’ve found this issue & this repo . It works well (Thanks Sehraf !), I took inspiration from Muse Luxe configuration to create my own ESP configuration forht ethe A1S with AC101 codec that I share with you :
substitutions:
friendly_name: ESP32 AudioKit - voice assistant
# Audiokit Buttons
KEY1: "36"
KEY2: "13" # may be in use for other purposes, see onboard config switch
KEY3: "19" # also activates LED D4 if pressed
KEY4: "23" # do not use on A1S V2.3 with initial pinout -> I2C ES8388
KEY5: "18" # do not use on A1S V2.3 with initial pinout -> I2C ES8388
KEY6: "5" # do not use on A1S V2.3 with initial pinout -> I2S
# Audiokit LEDs
LED_D4: "22"
LED_D5: ${KEY3}
esphome:
name: esp32-audio-kit
esp32:
board: esp-wrover-kit
framework:
type: arduino
# amplifier is not required for headphones
# on_boot:
# then:
# - output.turn_on: gpio_amp
external_components:
source:
type: git
url: https://github.com/sehraf/esphome-components
ref: main
components: [ac101]
refresh: 1s
logger:
api:
encryption:
key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
services:
- service: start_va
then:
- voice_assistant.start
- service: stop_va
then:
- voice_assistant.stop
ota:
password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
wifi:
ssid: "MySSID"
password: "MyWifiPassword"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "esp32-audio-kit Fallback Hotspot"
password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
captive_portal:
#status_led:
# pin:
# number: ${LED_D5}
# inverted: true
web_server:
port: 80
# AC101 (I2C)
i2c:
sda: 33
scl: 32
scan: true
ac101:
# address: 0x1a
media_player:
- platform: i2s_audio
id: AudioKit
name: Media Player
dac_type: external
i2s_dout_pin: 25
mode: stereo
# on_play:
# output.turn_on: gpio_amp
# on_idle:
# output.turn_off: gpio_amp
# I2S Audio
i2s_audio:
i2s_lrclk_pin: 26
i2s_bclk_pin: 27
microphone:
- platform: i2s_audio
adc_type: external
i2s_din_pin: 35
pdm: false
id: mic_id
switch:
- platform: gpio
pin: GPIO21
name: "AMP Switch"
restore_mode: ALWAYS_ON
- platform: template
name: Use Wake Word
id: use_wake_word
optimistic: true
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lambda: id(va).set_use_wake_word(true);
- if:
condition:
not:
- voice_assistant.is_running
then:
- voice_assistant.start_continuous
- script.execute: reset_led
on_turn_off:
- voice_assistant.stop
- lambda: id(va).set_use_wake_word(false);
- script.execute: reset_led
voice_assistant:
id: va
microphone: mic_id
media_player: AudioKit
use_wake_word: true
on_listening:
- light.turn_on:
id: top_led
brightness: 100%
effect: pulse
on_tts_start:
- light.turn_on:
id: top_led
effect: none
on_tts_end:
- media_player.play_media: !lambda return x;
- light.turn_on:
id: top_led
effect: pulse
on_client_connected:
- if:
condition:
- switch.is_on: use_wake_word
then:
- voice_assistant.start_continuous:
on_client_disconnected:
- if:
condition:
- switch.is_on: use_wake_word
then:
- voice_assistant.stop:
on_end:
- delay: 100ms
- wait_until:
not:
media_player.is_playing: AudioKit
- script.execute: reset_led
on_error:
- light.turn_on:
id: top_led
effect: none
- delay: 1s
- script.execute: reset_led
- script.wait: reset_led
- lambda: |-
if (code == "wake-provider-missing" || code == "wake-engine-missing") {
id(use_wake_word).turn_off();
}
script:
- id: reset_led
then:
- light.turn_off: top_led
binary_sensor:
- platform: gpio
pin:
number: GPIO39
inverted: true
mode:
input: true
name: "Jack Status"
- platform: gpio
pin:
number: GPIO036
inverted: true
name: "Key 1"
filters:
- delayed_off: 10ms
- platform: gpio
pin:
number: GPIO013
inverted: true
name: "Key 2"
filters:
- delayed_off: 10ms
# - platform: gpio
# pin:
# number: GPIO019
# inverted: true
# name: "Key 3"
# filters:
# - delayed_off: 10ms
- platform: gpio
pin:
number: GPIO023
inverted: true
mode:
input: true
pullup: true
name: "Key 4"
filters:
- delayed_off: 10ms
- platform: gpio
pin:
number: GPIO018
inverted: true
mode:
input: true
pullup: true
name: "Key 5"
filters:
- delayed_off: 10ms
- platform: gpio
pin:
number: GPIO005
inverted: true
mode:
input: true
pullup: true
name: "Key 6"
filters:
- delayed_off: 10ms
on_press:
- voice_assistant.start:
on_release:
- voice_assistant.stop:
on_click:
- media_player.toggle: AudioKit
light:
- platform: binary
name: "LED D4"
id: top_led
output: light_output_1
- platform: binary
name: "LED D5"
output: light_output_2
output:
- id: light_output_1
platform: gpio
pin: GPIO22
inverted: true
- id: light_output_2
platform: gpio
pin: GPIO19
inverted: true
It’s not perfect but it allows to start to play with Voice Assistant with this great board.
Some issues :
At boot it often enter in a crazy loop on wake word initialization (like this on this topic or this one ). Just disable “Use Wake Word” toggle and enable it again to stop this loop. It seems to be related to the “voice_assistant” automations configured. A workaround could be to start Voice Assistant only after few seconds (as it seems related to the I2S microphone not initialized or something like that).
The jack is working however I didn’t found how to detect the jack to disable the amp if necessary (pin 39 doesn’t seem to work).
GPIO19 is muxed so I didn’t found how to use the key3 and the LED D5 simultaneously (ESPHOME refuse to use the same GPIO two times)
The media player is working but require to disable “Use Wake Word” first. May be we could find a trick in HA to disable it automatically when something is played.
Volume is reset to 100% after each restart.
So it can be improved a lot, for example the keys could be mapped for Media Player. I’m sure that the issues could be fixed by someone with a great debugging level on ESPHome
I hope that it will help some of you, once configured the result is not bad at all, even if only one microphone is used, the wake word detection is not bad at all even at several meters or by whispering. The media player is working fine, the speakers and the audio jack output too. Even if Voice Assist is far from perfect, at least my board has a use now
7 Likes