@micdrop/piper

September 7, 2026 ยท View on GitHub

Micdrop website | Documentation

Local Piper text to speech for @micdrop/server.

Drives the Piper binary as a subprocess, so no text leaves the machine. Piper voices are small VITS models covering around forty languages including French, which makes this the option to reach for outside English.

Installation

Install the package:

npm install @micdrop/piper

Install the binary:

pip install piper-tts

Download a voice, which comes as a pair of files that have to sit next to each other:

mkdir -p voices && cd voices
BASE=https://huggingface.co/rhasspy/piper-voices/resolve/main/fr/fr_FR/siwis/medium
curl -LO $BASE/fr_FR-siwis-medium.onnx
curl -LO $BASE/fr_FR-siwis-medium.onnx.json

Piper ships a download_voices module, but calling it means finding the exact interpreter pip installed it under, which is rarely the python3 in your path. Downloading the two files is shorter and works the same.

Usage with MicdropServer

import { PiperTTS } from '@micdrop/piper'
import { MicdropServer } from '@micdrop/server'

const tts = new PiperTTS({
  modelPath: './voices/fr_FR-siwis-medium.onnx',
})

// Use with MicdropServer
new MicdropServer(socket, {
  tts,
  // ... other options
})

Usage without MicdropServer

import { PiperTTS } from '@micdrop/piper'
import { Readable } from 'stream'

const tts = new PiperTTS({
  modelPath: './voices/fr_FR-siwis-medium.onnx',
})

// Audio is raw PCM, 16 bits, 16 kHz, mono
tts.on('Audio', (chunk) => console.log('Audio:', chunk.length, 'bytes'))
tts.on('Failed', (texts) => console.error('Failed:', texts))

tts.speak(Readable.from(['Hello! ', 'What can I do for you?']))

Events

EventPayloadDescription
AudioBufferA chunk of audio, PCM 16 bits, 16 kHz, mono, ready to be played.
Failedstring[]The Piper process exited with an error. The payload stays empty.

See the TTS interface for the full contract.

Documentation

Read full documentation of the Piper integration for Micdrop on the website, and the guide on running Micdrop with local models.

License

MIT

Author

Originally developed for Raconte.ai, created and open sourced by Godefroy de Compreignac