-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Text to speech mixin #405
base: master
Are you sure you want to change the base?
Conversation
Any raspberry pi with speaker connected will work
Codecov Report
@@ Coverage Diff @@
## master #405 +/- ##
==========================================
- Coverage 58.56% 54.58% -3.98%
==========================================
Files 72 81 +9
Lines 2756 3270 +514
==========================================
+ Hits 1614 1785 +171
- Misses 1142 1485 +343
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
@@ -21,3 +21,4 @@ spidev python3-spidev; PEP386 | |||
systemd_python python3-systemd; PEP386 | |||
wget python3-wget; PEP386 | |||
pyzmq python3-zmq; PEP386 | |||
pyfestival python3-pt-pyfestival |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pyfestival python3-pt-pyfestival | |
pyfestival python3-pyfestival; PEP386 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PEP386
flag will make the dependency versioned, which we want in most cases.
@@ -82,6 +82,9 @@ Replaces: | |||
pt-device-manager (<< 4.0.0), | |||
# pt-oled | |||
python3-pt-oled (<< 3.0.0), | |||
# Festival speech engine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is currently under Replaces:
field, which is definitely not what you want to be doing.
Are you trying to make this a core dependency, an optional dependency or a dependency of the full SDK?
################## | ||
# Text to Speech # | ||
################## | ||
"pt-pyfestival", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"pt-pyfestival", | |
"pyfestival", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not install correctly for people installing via Python on RPi for now, but we want tackle that later on.
I am not convinced with the design pattern. Why should the user need to know anything about festival? Why does the user need to handle the importing and management of TTS directly?
seems like a much more sensible way to approach this. |
This is currently failing to build the package as there is a spelling mistake in this commit's message that is propagating into the snapshot version changelog. This draft PR provides an easy way for all package builds to ignore changelog spelling mistakes for snapshot builds with a simple boolean input. This hasn't been tested, and this PR is a good test of this functionality. We should update this PR to use this experimental branch until it passes, then merge in and build against this new master commit. Once this is working here, we can update ALL package build workflows to ignore typos for snapshot builds moving forwards. |
Yeah this is exactly how it is now, though I do like the “speaker” idea as we can add more speaker-specific commands to that too (beeps, songs, pre-recorded voices etc) |
We will need to create a patch for the changes needed for this build to pass in CI. |
Closes #376
Note on dependencies
pyfestival
Python dependency is provided here into our apt repository, with a patch that is needed in order for import to work on RPi. Workflow run that added it into the apt repo is here. There should be no need to keep https://github.com/pi-top/pyfestival/ at this point.Example Usage
Architecture
Uses a generalized object factory that registers backend services we wish to make available - currently we only have "DEFAULT" and "FESTIVAL" but in future we'll ideally have "GOOGLE", "AMAZON" etc. The builders will accept the kwargs relevant to that service and ignore the rest, this should make it flexible when we add new services that require API keys etc.
Options for changing tts backend
One downside to this approach is that the speech service can't be changed easily from the
Pitop()
class, one way to do it is as follows:Alternatively, we could pass in the speech service to Pitop class:
But it feels a shame to add parameters to the
Pitop()
class. We could also use a class method:which is probably a cleaner approach.
To do
Use a factory pattern for allowing different speech backends to be swapped in as it's very likely we'll want to change the TTS engine in future (for compatibility or general improvement)Pitop.from_config()
usageFixSIOD ERROR: the currently assigned stack limit has been exceeded
error when using the non-blocking mode (thread)