Speech

The Speech service speaks text with the system voices. Access it via app.speech. Speaking does not block: say returns at once and the voice goes on.

app.speech.say("Il caffè è pronto", voice="it-IT")

Methods

say(text, voice=None, rate=None, pitch=None, volume=None, interrupt=True)

Parameter Type Description
text str What to say
voice str A voice id from voices(), or a language such as "it-IT" for that language's default voice. An unknown one raises nib.ServiceError
rate float From 0.0 to 1.0; 0.5 is the normal rate
pitch float From 0.5 to 2.0; 1.0 is the voice's own pitch
volume float From 0.0 to 1.0
interrupt bool Stop what is being said first. With False the text waits its turn

stop(), speaking()

stop() stops at once and returns True if something was being said. speaking() asks whether something is being said now.

voices(language=None)

The installed voices as Voice (id, name, language, quality), optionally only those of a language such as "it". quality is "default", "enhanced" or "premium"; better voices are downloaded in System Settings > Accessibility > Spoken Content.

  • Sound: alert sounds and audio files
  • Language: detect the language to pick a voice