@lumiastream/say
v0.0.9
Published
TTS (Text To Speech) Module for Node.js
Downloads
173
Readme
Installing say.js
npm install sayUsage
// automatically pick platform
const say = require("say");
// or, override the platform
const Say = require("say").Say;
const say = new Say("darwin" || "win32" || "linux");
// Get voices
console.log(
"await say.getInstalledVoices();: ",
await say.getInstalledVoices()
);
// Use default system voice and speed
say.speak("Hello!");
// Stop the text currently being spoken
say.stop()(async () => {
// with a promise
try {
await say.speak({ text: "whats up, dog?", voice: "Good News", speed: 1.0 });
await say.speak({
text: "How are you today?",
voice: "Good News",
speed: 1.0,
});
} catch (error) {
console.log(error);
}
console.log("text to speech complete");
})();Methods
Speak:
- Speed: 1 = 100%, 0.5 = 50%, 2 = 200%, etc
say.speak(text, voice || null, speed || null, callback || null);Stop Speaking:
say.stop();Get List of Installed Voice(s):
const voices = await say.getInstalledVoices();