Skip to content

Use speak2mary for MaryTTS integration and enable sound effects#30805

Merged
pvizeli merged 2 commits into
home-assistant:devfrom
Poeschl:marytts
Jan 23, 2020
Merged

Use speak2mary for MaryTTS integration and enable sound effects#30805
pvizeli merged 2 commits into
home-assistant:devfrom
Poeschl:marytts

Conversation

@Poeschl
Copy link
Copy Markdown
Contributor

@Poeschl Poeschl commented Jan 15, 2020

Breaking Change:

The codec and locale configuration changed to the official config keys from MaryTTS.

en-GB, en-US -> en_GB,en_US
aiff,au,wav -> AIFF_FILE,AU_FILE,WAVE_FILE

Description:

I extracted the MaryTTS network logic into a external package and added the effects settings.

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#11759

Example entry for configuration.yaml (if applicable):

# Example configuration.yaml entry
tts:
  - platform: marytts
    host: 'localhost'
    port: 59125
    codec: 'WAVE_FILE'
    voice: 'cmu-slt-hsmm'
    language: 'en_US'
    effect:
      Volume: "amount:2.0;",
      TractScaler: "amount:1.5;",
      F0Scale: "f0Scale:2.0;",
      F0Add: "f0Add:50.0;",
      Rate: "durScale:1.5;",
      Robot: "amount:100.0;",
      Whisper: "amount:100.0;",
      Stadium: "amount:100.0",
      Chorus: "delay1:466;amp1:0.54;delay2:600;amp2:-0.10;delay3:250;amp3:0.30",
      FIRFilter: "type:3;fc1:500.0;fc2:2000.0",
      JetPilot: ""

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

Comment thread homeassistant/components/marytts/tts.py Outdated
@property
def default_options(self):
"""Return dict include default options."""
return {CONF_EFFECT: DEFAULT_EFFECTS}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is that static? The user can overwrite the defaults per initial config

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Jup, you are correct. With the latest commit, the defaults are the initial effect settings

@Poeschl Poeschl requested a review from pvizeli January 19, 2020 10:00
Comment thread homeassistant/components/marytts/tts.py Outdated
return (None, None)
data = await request.read()
if options is not None and CONF_EFFECT in options:
effects.update(options[CONF_EFFECT])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

that means, you will be never able to overwrite the effects from config. Maybe:
effects = options[CONF_EFFECT]?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I understood the options parameter as additional options during the service call.
Can you explain where the options parameter get its value?

I intended to use the config from yaml and let it be overwritten by service call options.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

options are they from the service call. I want only prevent to have a bug :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Since the file config is coming as default, it will change it to your suggestion.

@Poeschl Poeschl requested a review from pvizeli January 21, 2020 18:53
@pvizeli pvizeli merged commit 7fed328 into home-assistant:dev Jan 23, 2020
@lock lock Bot locked and limited conversation to collaborators Jan 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants