Created
November 11, 2022 16:37
-
-
Save mprymek/f72474052aa39687af266f572e76675e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This patch makes Rhasspy v2.5.11 work with Porcupine version 2.x (i.e. the version supporting | |
newly generated time-unlimited free-tier wake words). | |
Based on Sturi2011's instructions. | |
--- usr/lib/rhasspy/rhasspy-profile/rhasspyprofile/profiles/defaults.json.orig 2022-11-11 16:55:04.320481943 +0100 | |
+++ usr/lib/rhasspy/rhasspy-profile/rhasspyprofile/profiles/defaults.json 2022-11-11 16:57:20.668415989 +0100 | |
@@ -438,7 +438,8 @@ | |
"compatible": true, | |
"keyword_path": "porcupine.ppn", | |
"sensitivity": 0.5, | |
- "udp_site_info": {} | |
+ "udp_site_info": {}, | |
+ "access_key": "" | |
}, | |
"raven": { | |
"compatible": true, | |
--- usr/lib/rhasspy/rhasspy-supervisor/rhasspysupervisor/__init__.py.orig 2022-11-11 16:58:42.507214649 +0100 | |
+++ usr/lib/rhasspy/rhasspy-supervisor/rhasspysupervisor/__init__.py 2022-11-11 17:01:55.214473747 +0100 | |
@@ -565,6 +565,7 @@ | |
return [] | |
sensitivity = profile.get("wake.porcupine.sensitivity", "0.5") | |
+ access_key = profile.get("wake.porcupine.access_key") | |
wake_command = [ | |
"rhasspy-wake-porcupine-hermes", | |
@@ -572,6 +573,8 @@ | |
shlex.quote(str(keyword)), | |
"--sensitivity", | |
str(sensitivity), | |
+ "--access-key", | |
+ str(access_key), | |
"--keyword-dir", | |
shlex.quote(str(write_path(profile, "porcupine"))), | |
] | |
--- usr/lib/rhasspy/rhasspy-wake-porcupine-hermes/rhasspywake_porcupine_hermes/__init__.py.orig 2022-11-11 17:02:54.343652636 +0100 | |
+++ usr/lib/rhasspy/rhasspy-wake-porcupine-hermes/rhasspywake_porcupine_hermes/__init__.py 2022-11-11 17:05:59.251130210 +0100 | |
@@ -75,6 +75,7 @@ | |
model_ids: typing.List[str], | |
wakeword_ids: typing.List[str], | |
sensitivities: typing.List[float], | |
+ access_key: str = "", | |
keyword_dirs: typing.Optional[typing.List[Path]] = None, | |
site_ids: typing.Optional[typing.List[str]] = None, | |
sample_rate: int = 16000, | |
@@ -100,6 +101,7 @@ | |
self.wakeword_ids = wakeword_ids | |
self.model_ids = model_ids | |
self.sensitivities = sensitivities | |
+ self.access_key = access_key | |
self.keyword_dirs = keyword_dirs or [] | |
@@ -252,6 +254,7 @@ | |
site_info.porcupine = pvporcupine.create( | |
keyword_paths=[str(kw) for kw in self.model_ids], | |
sensitivities=self.sensitivities, | |
+ access_key=self.access_key, | |
) | |
assert site_info.porcupine is not None | |
--- usr/lib/rhasspy/rhasspy-wake-porcupine-hermes/rhasspywake_porcupine_hermes/__main__.py.orig 2022-11-11 17:06:46.580493694 +0100 | |
+++ usr/lib/rhasspy/rhasspy-wake-porcupine-hermes/rhasspywake_porcupine_hermes/__main__.py 2022-11-11 17:09:55.594854050 +0100 | |
@@ -31,6 +31,12 @@ | |
help="Path(s) to one or more Porcupine keyword file(s) (.ppn)", | |
) | |
parser.add_argument( | |
+ "--access-key", | |
+ required=True, | |
+ action="append", | |
+ help="Porcupine access key", | |
+ ) | |
+ parser.add_argument( | |
"--keyword-dir", | |
action="append", | |
default=[], | |
@@ -161,6 +167,7 @@ | |
] | |
# Listen for messages | |
+ access_key = args.access_key[0] | |
client = mqtt.Client() | |
hermes = WakeHermesMqtt( | |
client, | |
@@ -173,6 +180,7 @@ | |
udp_forward_mqtt=args.udp_forward_mqtt, | |
site_ids=args.site_id, | |
lang=args.lang, | |
+ access_key=access_key, | |
) | |
_LOGGER.debug("Connecting to %s:%s", args.host, args.port) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment