@litomore/win-say
v0.0.1
Published
The Windows built-in text-to-speech interface for JavaScript
Maintainers
Readme
win-say
The Windows built-in text-to-speech interface for JavaScript
Install
npm i @litomore/win-sayUsage
import { say } from "@litomore/win-say";
await say("Hello, world!");
await say("Hello! My name is David.", { voice: "Microsoft David Desktop" });API
say(text, options?)
text
Type: string
The content to be converted to audible speech.
options
Type: SayOptions
Optional. All available options are listed below:
type SayOptions = {
voice?: string;
rate?: number;
volume?: number;
outputFile?: string;
skipRunningCheck?: boolean;
};rate maps to the Windows SpeechSynthesizer range of -10 to 10.
volume maps to the Windows SpeechSynthesizer range of 0 to 100.
outputFile writes a WAV file instead of speaking through the default audio device.
getAudioDevices()
To obtain the default audio output device placeholder.
Returns a Promise<Device[]>.
Windows SpeechSynthesizer speaks through the system default output device and does not expose per-device selection through this API.
getDataFormats(fileFormat)
To obtain a list of audio data formats for a file format specified explicitly or by file name.
Returns a Promise<DataFormat[]>.
Windows SpeechSynthesizer writes WAV output with PCM audio data.
fileForamt
Type: string
getFileFormats()
To obtain a list of writable file formats.
Returns a Promise<FileFormat[]>.
Windows SpeechSynthesizer writes WAV output.
getVoices()
To obtain a list of voices installed in the system.
Returns a Promise<Voice[]>.
checkIfSayIsRunning()
To obtain the information of the active win-say PowerShell process.
Returns a Promise<DefaultTask | undefined>.
killRunningSay()
To kill the active win-say PowerShell process if it's running.
License
MIT
