mn6 / winsynth

Tiny node module for basic windows speech synthesis intended for SAPI use.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WinSynth

Simple and tiny (< 2kb) node module for synthesizing speech through powershell via SAPI.

Warning: this module was made for a very specific project, and thus may be very limited for other use

Usage

  // Example for speech synthesis that cuts itself off
  const synth = require('@mn6/winsynth')
  const events = require('events')
  const emitter = new events.EventEmitter()
  let speaking = null
  emitter.addListener('pid', pid => speaking = pid)

  const say = input => synth.say({
    'voice': 'Microsoft Zira Desktop',
    'rate': 1.2,
    'volume': 100,
    'cutoff': true,
    emitter,
    input,
    speaking
  })

  // Will cut off after 800ms
  say('This is an example message that should have already been cut off by another message.')
  setTimeout(() => say('This is a message that cut off the previous one!'), 800)

About

Tiny node module for basic windows speech synthesis intended for SAPI use.


Languages

Language:JavaScript 100.0%