Skip to content

Commit

Permalink
feat(voice): add piper engine to voice service as the default engine …
Browse files Browse the repository at this point in the history
…and a menu to select the engine - closes #120

refactor(notification): add `NotificationExtraInformation` with `text`, `piper_text`, and `orca_text` to replace the simple strings passed to `extra_information` field of the `Notification` object
refactor(audio): rename sound service to audio service
refactor(audio): drop `pyaudio` and use `simpleaudio` for playback
  • Loading branch information
sassanh committed Jul 29, 2024
1 parent 2a2da18 commit 842ba28
Show file tree
Hide file tree
Showing 47 changed files with 1,399 additions and 476 deletions.
7 changes: 2 additions & 5 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
ubo_app/services/000-sound/sounds/volume.wav filter=lfs diff=lfs merge=lfs -text
ubo_app/services/000-sound/sounds/add.wav filter=lfs diff=lfs merge=lfs -text
ubo_app/services/000-sound/sounds/done.wav filter=lfs diff=lfs merge=lfs -text
ubo_app/services/000-sound/sounds/failure.wav filter=lfs diff=lfs merge=lfs -text
ubo_app/services/000-sound/sounds/scan.wav filter=lfs diff=lfs merge=lfs -text
ubo_app/services/*-audio/sounds/** filter=lfs diff=lfs merge=lfs -text
ubo_app/services/*-voice/models/**/*.onnx filter=lfs diff=lfs merge=lfs -text
2 changes: 1 addition & 1 deletion .github/workflows/integration_delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ jobs:
echo "dashed_suffix=$DASHED_SUFFIX" >> "$GITHUB_OUTPUT"
echo "image_url=$IMAGE_URL" >> "$GITHUB_OUTPUT"
echo "image_checksum_url=$CHECKSUM_URL" >> "$GITHUB_OUTPUT"
IMAGE_SIZE_GB=${{ matrix.suffix == 'lite' && '4.25' || matrix.suffix == '' && '6.25' || '13' }}
IMAGE_SIZE_GB=${{ matrix.suffix == 'lite' && '4.25' || matrix.suffix == '' && '6.5' || '13' }}
IMAGE_SIZE=$(awk -v IMAGE_SIZE_GB=$IMAGE_SIZE_GB 'BEGIN {printf "%.0f", IMAGE_SIZE_GB * 1024 ^ 3}')
echo "image_size=$IMAGE_SIZE" >> "$GITHUB_OUTPUT"
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
- refactor(core): use the new `key` property of ubo-gui `Item`s to keep opened menus open when something changes in the parent menus - closes #145, closes #146, closes #147
- fix(core): make sure logs are set up after reading environment variables and before starting the app
- feat(keypad): add epoch time to keypad actions and events in `time` field
- feat(voice): add piper engine to voice service as the default engine and a menu to select the engine - closes #120
- refactor(notification): add `NotificationExtraInformation` with `text`, `piper_text`, and `orca_text` to replace the simple strings passed to `extra_information` field of the `Notification` object
- refactor(audio): rename sound service to audio service
- refactor(audio): drop `pyaudio` and use `simpleaudio` for playback

## Version 0.15.4

Expand Down
215 changes: 188 additions & 27 deletions poetry.lock

Large diffs are not rendered by default.

21 changes: 14 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ authors = ["Sassan Haradji <[email protected]>"]
license = "Apache-2.0"
readme = "README.md"
packages = [{ include = "ubo_app" }]
include = ["ubo_app/services/*-sound/sounds/*"]
include = [
"ubo_app/services/*-sound/sounds/*",
"ubo_app/services/*-voice/models/*",
]


[[tool.poetry.source]]
Expand All @@ -17,7 +20,7 @@ priority = "primary"
[tool.poetry.dependencies]
python = "^3.11"
psutil = "^6.0.0"
ubo-gui = "^0.12.4"
ubo-gui = "^0.12.5"
headless-kivy = [
{ version = "^0.9.4", markers = "extra=='default'", extras = [
"default",
Expand All @@ -26,11 +29,9 @@ headless-kivy = [
"test",
] },
]
python-redux = "^0.15.10"
pyzbar = "^0.1.9"
sdbus-networkmanager = { version = "^2.0.0", markers = "platform_machine=='aarch64'" }
rpi_ws281x = { version = "^5.0.0", markers = "platform_machine=='aarch64'" }
python-debouncer = "^0.1.5"
pulsectl = "^23.5.2"
aiohttp = "^3.9.1"
semver = "^3.0.2"
Expand All @@ -40,16 +41,23 @@ sentry-sdk = "^1.43.0"
pvorca = "^0.2.1"
platformdirs = "^4.2.0"
dill = "^0.3.8"
simpleaudio = "^1.0.4"

python-redux = "^0.15.10"
python-debouncer = "^0.1.5"
python-strtobool = "^1.0.0"
python-fake = "^0.1.0"

# Adafruit dependencies
adafruit-circuitpython-rgb-display = "^3.11.0"
adafruit-circuitpython-aw9523 = "^1.1.7"
adafruit-circuitpython-neopixel = "^6.3.11"
adafruit-circuitpython-pct2075 = "^1.1.21"
adafruit-circuitpython-veml7700 = "^1.1.22"

# RPi dependencies
rpi-lgpio = { version = "^0.6", markers = "platform_machine=='aarch64'" }
python-fake = "^0.1.0"
piper-tts = { version = "^1.2.0", markers = "sys_platform=='linux'" }

[tool.poetry.group.dev]
optional = true
Expand All @@ -66,7 +74,6 @@ ruff = "^0.5.3"
tenacity = "^8.2.3"
toml = "^0.10.2"
pytest-mock = "^3.14.0"
pyaudio = { version = "^0.2.14", markers = "platform_machine!='aarch64'" }
ipython = "^8.23.0"
pyfakefs = { git = "https://github.com/sassanh/pyfakefs.git", branch = "skip_names" }

Expand Down Expand Up @@ -138,7 +145,7 @@ root = "ubo_app/services/000-keypad"
extraPaths = ["."]

[[tool.pyright.executionEnvironments]]
root = "ubo_app/services/000-sound"
root = "ubo_app/services/000-audio"
extraPaths = ["."]

[[tool.pyright.executionEnvironments]]
Expand Down
2 changes: 1 addition & 1 deletion scripts/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM ubuntu:mantic

ARG DEBIAN_FRONTEND=noninteractive
RUN apt -y update
RUN apt -y install gcc curl git libcap-dev libegl1 libgl1 libmtdev1 libzbar0 python3 python3-dev file
RUN apt -y install gcc curl git libasound2-dev libcap-dev libegl1 libgl1 libmtdev1 libzbar0 python3 python3-dev file --no-install-recommends --no-install-suggests
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH="${PATH}:/root/.local/bin"
WORKDIR /ubo-app
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// store-desktop-000
{
"_id": "e3e70682c2094cac629f6fbed82c07cd",
"audio": {
"capture_volume": 0.5,
"is_capture_mute": false,
"is_playback_mute": false,
"playback_volume": 0.5
},
"camera": {
"current": null,
"is_viewfinder_active": false,
Expand Down Expand Up @@ -332,28 +338,102 @@
"opacity": null,
"progress": null,
"sub_menu": {
"heading": "󰔊 Picovoice",
"items": [
{
"action": "<function:input_access_key>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "󰐲",
"icon": "󰱑",
"is_short": false,
"key": null,
"label": "Set Access Key",
"label": "Voice Engine",
"opacity": null,
"progress": null
"progress": null,
"sub_menu": {
"items": [
{
"action": "<function:_engine_selector>",
"background_color": "#03F7AE",
"color": [
1,
1,
1,
1
],
"icon": "󰱒",
"is_short": false,
"key": null,
"label": "Piper",
"opacity": null,
"progress": null
},
{
"action": "<function:_engine_selector>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "󰄱",
"is_short": false,
"key": null,
"label": "Orca",
"opacity": null,
"progress": null
}
],
"placeholder": null,
"title": "󰱑Voice Engine"
}
},
{
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "󰔊",
"is_short": false,
"key": null,
"label": "Orca Settings",
"opacity": null,
"progress": null,
"sub_menu": {
"heading": "󰔊 Picovoice",
"items": [
{
"action": "<function:input_access_key>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "󰐲",
"is_short": false,
"key": null,
"label": "Set Access Key",
"opacity": null,
"progress": null
}
],
"placeholder": null,
"sub_heading": "Set the access key\nCurrent value: Fake",
"title": "Orca Settings"
}
}
],
"placeholder": null,
"sub_heading": "Set the access key\nCurrent value: Fake",
"title": "Voice Settings"
"title": "󰔊Voice"
}
}
],
Expand Down Expand Up @@ -638,12 +718,6 @@
"value": 0.0
}
},
"sound": {
"capture_volume": 0.5,
"is_capture_mute": false,
"is_playback_mute": false,
"playback_volume": 0.5
},
"ssh": {
"is_active": true,
"is_enabled": true
Expand All @@ -652,7 +726,7 @@
"icons": [
{
"color": "white",
"id": "sound:mic-state",
"id": "audio:mic-state",
"priority": -20,
"symbol": "󰍭"
},
Expand Down Expand Up @@ -683,7 +757,8 @@
"update_status": "up_to_date"
},
"voice": {
"is_access_key_set": false
"is_access_key_set": false,
"selected_engine": "piper"
},
"wifi": {
"connections": [
Expand Down
Loading

0 comments on commit 842ba28

Please sign in to comment.