Skip to content

Commit

Permalink
Use webrtc
Browse files Browse the repository at this point in the history
  • Loading branch information
synesthesiam committed Sep 12, 2023
1 parent f5372f7 commit 09e83ff
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 16 deletions.
4 changes: 4 additions & 0 deletions openwakeword/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.4.0

- Add noise suppression/auto gain with webrtc

## 1.1.0

- Initial release
27 changes: 22 additions & 5 deletions openwakeword/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ for more information.

Name of wake word model to use. Available models are:

* `hey_jarvis` (default)
* `ok_nabu` (default)
* `hey_jarvis`
* `alexa`
* `hey_mycroft`
* `hey_rhasspy`
Expand All @@ -43,13 +44,29 @@ means fewer detections.

### Option: `noise_suppression`

Enable noise suppression using speexdsp. This should be used for low quality
microphones, or in noisy environments where noise suppression is not available
on the voice satellite.
Noise suppression level with
[webrtc](https://github.com/rhasspy/webrtc-noise-gain), where 0 is disabled
(default) and 4 is the max. Suppresses common sources of noise, such as fans,
but may distort audio. This should be used for low quality microphones, or in
noisy environments where noise suppression is not available on the voice
satellite.

### Option: `auto_gain`

Automatic gain control target dBFS with
[webrtc](https://github.com/rhasspy/webrtc-noise-gain), where 0 is disabled
(default) and 31 is the max. Raises the volume when someone is speaking too
quietly, but may distort audio. This should be used for low quality microphones,
or if the voice satellite is far away and does not have auto-gain functionality.

### Option: `save_audio`

Enable recording of audio to `/share/openwakeword` as WAV files.
**WARNING**: All audio is saved, including before the wake word is spoken, so this option should be disabled to preserve disk space.

### Option: `debug_logging`

Enable debug logging. Useful for seeing each wake word detection in the logs.
Enable debug logging. Useful for seeing satellite connections and each wake word detection in the logs.

## Support

Expand Down
3 changes: 1 addition & 2 deletions openwakeword/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ RUN \
setuptools \
wheel \
&& pip3 install --no-cache-dir \
"wyoming-openwakeword==${OPENWAKEWORD_LIB_VERSION}" \
'speexdsp-ns==0.1.2' \
"wyoming-openwakeword[webrtc]==${OPENWAKEWORD_LIB_VERSION}" \
\
&& rm -rf /var/lib/apt/lists/*

Expand Down
2 changes: 1 addition & 1 deletion openwakeword/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ codenotary:
signer: [email protected]
base_image: [email protected]
args:
OPENWAKEWORD_LIB_VERSION: 1.3.0
OPENWAKEWORD_LIB_VERSION: 1.4.0
12 changes: 8 additions & 4 deletions openwakeword/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
version: 1.3.1
version: 1.4.0-2
slug: openwakeword
name: openWakeWord
description: openWakeWord using the Wyoming protocol
Expand All @@ -17,16 +17,20 @@ map:
options:
model: "ok_nabu"
threshold: 0.5
trigger_level: 2
noise_suppression: false
trigger_level: 1
noise_suppression: 0
auto_gain: 0
debug_logging: false
save_audio: false
schema:
model: |
list(ok_nabu|alexa|hey_jarvis|hey_mycroft|hey_rhasspy)
threshold: float
trigger_level: int
noise_suppression: bool
noise_suppression: int
auto_gain: int
debug_logging: bool
save_audio: bool
ports:
"10400/tcp": null
homeassistant: 2023.9.0.dev20230809
10 changes: 6 additions & 4 deletions openwakeword/rootfs/etc/s6-overlay/s6-rc.d/openwakeword/run
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@
# Start openWakeWord service
# ==============================================================================
flags=()
if bashio::config.true 'noise_suppression'; then
flags+=('--noise-suppression')
fi

if bashio::config.true 'debug_logging'; then
flags+=('--debug')
fi

if bashio::config.true 'save_audio'; then
flags+=('--output-dir' '/share/openwakeword')
fi

exec python3 -m wyoming_openwakeword \
--uri 'tcp://0.0.0.0:10400' \
--model "$(bashio::config 'model')" \
--threshold "$(bashio::config 'threshold')" \
--trigger-level "$(bashio::config 'trigger_level')" \
--output-dir /share/openwakeword ${flags[@]}
--noise-suppression "$(bashio::config 'noise_suppression')" \
--auto-gain "$(bashio::config 'auto_gain')" ${flags[@]}

0 comments on commit 09e83ff

Please sign in to comment.