Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Added Possibility for ESpeak Config #3020

Merged
merged 5 commits into from
Nov 9, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions mycroft/tts/espeak_tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,32 @@ def get_tts(self, sentence, wav_file):
Returns:
tuple ((str) file location, None)
"""
subprocess.call(['espeak', '-v', self.lang + '+' + self.voice,
'-w', wav_file, sentence])

# Create Argument String for Espeak
arguments = ['espeak', '-v', self.lang + '+' + self.voice]
argument = self.config.get("amplitude")
if argument:
Copy link
Contributor

Choose a reason for hiding this comment

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

I know it's not a complex function, however I think we can make it clearer by using the name of each argument as the variable names eg:

amplitude = self.config.get...
if amplitude:
  ...
gap = ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the Feedback :)
Improved it

arguments.append("-a "+argument)

argument = self.config.get("gap")
Copy link
Contributor

Choose a reason for hiding this comment

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

The rest of this module is using single quotes - would be great to keep that consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also thanks for the Feedback :)
Updated it.

if argument:
arguments.append("-g "+argument)

argument = self.config.get("capital")
if argument:
arguments.append("-k "+argument)

argument = self.config.get("pitch")
if argument:
arguments.append("-p "+argument)

argument = self.config.get("speed")
if argument:
arguments.append("-s "+argument)

arguments.extend(['-w', wav_file, sentence])

subprocess.call(arguments)
return wav_file, None


Expand Down