Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

Expose tts volume and pitch to the user code like we do with lang. #185

Merged
merged 5 commits into from Nov 27, 2017
Merged

Expose tts volume and pitch to the user code like we do with lang. #185

merged 5 commits into from Nov 27, 2017

Conversation

divx118
Copy link
Contributor

@divx118 divx118 commented Nov 25, 2017

Like the title says, this will expose the volume and pitch for tts to the user code.
It can be set/get globally with:

aiy.audio.set_tts_volume(50)
volume = aiy.audio.get_tts_volume()
aiy.audio.set_tts_pitch(140)
pitch = aiy.audio.get_tts_pitch()

Or set individually with say:

aiy.audio.say('Good bye!', volume=50, pitch=140)

Copy link
Member

@drigz drigz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

src/aiy/audio.py Outdated
"""
global _tts_volume
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove - these aren't required in this function, as it uses get_*_volume.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sorry about that. Didn't do much python programming yet.

@@ -20,6 +20,7 @@
import subprocess
import tempfile
from aiy import i18n
from aiy import audio
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove - this creates a circular import between the two modules, which could lead to confusing problems later.

return functools.partial(say, player, lang=lang)
volume = audio.get_tts_volume()
pitch = audio.get_tts_pitch()
return functools.partial(say, player, lang=lang, volume=volume, pitch=pitch)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest ignoring volume and pitch here and letting say() handle it.

@drigz drigz merged commit e31c12d into google:voicekit Nov 27, 2017
@drigz
Copy link
Member

drigz commented Nov 27, 2017

Merged - works like a charm! Thank you for contributing.

@divx118
Copy link
Contributor Author

divx118 commented Nov 27, 2017

No problem. This benefits me too :).

@divx118 divx118 deleted the tts-pitch branch November 27, 2017 16:52
drigz added a commit to drigz/aiyprojects-raspbian that referenced this pull request Dec 21, 2017
Summary of changes:
- Fix instructions for using the Voice Kit on Stretch (google#187)
- Make it easier to turn the LED off (google#167)
- Fix crash with trigger sound (google#163)
- Let user code control TTS (google#185)
- Enable hotwording with Cloud Speech (0b4972b)
drigz added a commit to drigz/aiyprojects-raspbian that referenced this pull request Jan 3, 2018
Summary of changes:
- Fix instructions for using the Voice Kit on Stretch (google#187)
- Make it easier to turn the LED off (google#167)
- Fix crash with trigger sound (google#163)
- Let user code control TTS (google#185)
- Enable hotwording with Cloud Speech (0b4972b)

Change-Id: Icfad0fadeaeb63417413c598763eceddb5bd0b9c
drigz added a commit to drigz/aiyprojects-raspbian that referenced this pull request Jan 3, 2018
Summary of changes:
- Fix instructions for using the Voice Kit on Stretch (google#187)
- Make it easier to turn the LED off (google#167)
- Fix crash with trigger sound (google#163)
- Let user code control TTS (google#185)
- Enable hotwording with Cloud Speech (0b4972b)
- Update to Cloud Speech v1 (google#206)
drigz added a commit to drigz/aiyprojects-raspbian that referenced this pull request Jan 3, 2018
Summary of changes:
- Fix instructions for using the Voice Kit on Stretch (google#187)
- Make it easier to turn the LED off (google#167)
- Fix crash with trigger sound (google#163)
- Let user code control TTS (google#185)
- Enable hotwording with Cloud Speech (0b4972b)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants