opsoro.sound¶
This module defines the interface for communicating with the sound module.
-
class
opsoro.sound.
_Sound
[source]¶ Bases:
object
-
get_file
(filename, tts=False)[source]¶ Returns audio file data according to the given filename.
Parameters: filename (string) – file to return the data from Returns: Soundfile data. Return type: var
-
play_file
(filename)[source]¶ Plays an audio file according to the given filename.
Parameters: filename (string) – file to play Returns: True if sound is playing. Return type: bool
-
opsoro.sound.tts¶
This module defines the interface for communicating with the TTS libraries.
-
class
opsoro.sound.tts.
_TTS
[source]¶ Bases:
object
-
create
(text)[source]¶ Takes a string of text, converts it using the PicoTTS engine, and plays it. Wave files are buffered in /tmp/OnoTTS/<text>.wav. First call blocks while PicoTTS generates the .wav, this may take about a second. Subsequent calls of the same text return immediately. If you wish to avoid this, sound files can be generated on beforehand by using generate_only=True.
Parameters: text (string) – text to convert to speech Returns: path to the sound file Return type: string
-
create_espeak
(text, file_path, language, gender, delay, speed)[source]¶ Convert text to speech using the espeak TTS library.
Parameters: - text (string) – text to convert to speech
- file_path (string) – file path to store the speech soundfile
- language (string) – language initials
- gender (string) – specify gender (m for male, f for female)
- delay (int) – delay between words in ms
- speed (int) – speed in words-per-minute
-