# Audio

The Audio module contains functionality to produce audio from the speakers of the machine on which it runs. It has the following main functionality:

# Audio.say

The say function triggers Manatee to speak the phrase given.

var audio = Module.load("Audio", { version: "v1.2.0" });
audio.say("Hello, world!");

The default voice synthesizer is the built-in Windows Speech API (SAPI) which has english voices and renders the audio on the local machine. You can also choose to use the Google Text-to-Speech API (opens new window) which has support for multiple languages and much higher quality voice synthesis.

Google Text-to-Speech requires internet connectivity

Using Google TTS will send the phrase you want to speak to Google servers, so be aware of this if e.g. your phrase contains sensitive information.

You can choose the Google TTS with the synth option - and you can then select a language with the lang option.

audio.say("Hej, verden!", { lang: 'da-DK', synth: 'Google' });

It is also possible to select a specific voice using the voice option. See Audio.voices for how to list available voices.

# Audio.voices

Lists the available voices.

// List the default set of voices
var voices = audio.voices();
// List Danish Google voices
voices = audio.voices({ lang: "da-DK", synth: "Google" });

# Audio.play

The play function will synchronously play the given .wav file.


# Audio.volume

Controls the volume of the current audio device.

var v = audio.volume;
audio.volume = v + 1;

# Audio.muted

Get/set the muted state of the current audio device.

if (audio.muted) audio.muted = false;
  • Add volume and muted properties
  • Adds Google TTS.
  • Initial release with SAPI voices.