@micdrop/gradium

September 7, 2026 ยท View on GitHub

Micdrop website | Documentation

Gradium STT and TTS implementation for @micdrop/server.

Installation

npm install @micdrop/gradium

Gradium TTS (Text-to-Speech)

Usage with MicdropServer

import { GradiumTTS } from '@micdrop/gradium'
import { MicdropServer } from '@micdrop/server'

const tts = new GradiumTTS({
  apiKey: process.env.GRADIUM_API_KEY || '',
  voiceId: 'YTpq7expH9539ERJ', // Gradium voice ID
  modelName: 'default', // Optional: model name
  outputFormat: 'pcm_16000', // Optional: audio format
  region: 'eu', // Optional: 'eu' or 'us'
  jsonConfig: {
    // Optional: advanced voice settings
    temp: 0.7, // Temperature (0-1.4)
    cfg_coef: 2.0, // Voice similarity (1.0-4.0)
    padding_bonus: 0, // Speed control (-4.0 to 4.0)
  },
})

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

Usage without MicdropServer

import { GradiumTTS } from '@micdrop/gradium'
import { Readable } from 'stream'

const tts = new GradiumTTS({
  apiKey: process.env.GRADIUM_API_KEY || '',
  voiceId: 'YTpq7expH9539ERJ',
})

// 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[]Synthesis gave up after its retries, with the text that stayed unspoken.

See the TTS interface for the full contract.

Gradium STT (Speech-to-Text)

Real-time transcription (ASR).

Usage with MicdropServer

import { GradiumSTT } from '@micdrop/gradium'
import { MicdropServer } from '@micdrop/server'

const stt = new GradiumSTT({
  apiKey: process.env.GRADIUM_API_KEY || '',
  modelName: 'default', // Optional: model name
  inputFormat: 'pcm_16000', // Optional: audio format
  language: 'en', // Optional: language hint
  region: 'eu', // Optional: 'eu' or 'us'
})

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

Usage without MicdropServer

import { GradiumSTT } from '@micdrop/gradium'
import { createReadStream } from 'fs'

const stt = new GradiumSTT({
  apiKey: process.env.GRADIUM_API_KEY || '',
  language: 'en',
})

stt.on('Transcript', (text) => console.log('Transcript:', text))
stt.on('Failed', (chunks) => console.error('Failed:', chunks.length, 'chunks'))

// Audio is raw PCM, 16 bits, 16 kHz, mono
stt.transcribe(createReadStream('speech.pcm'))

Events

EventPayloadDescription
TranscriptstringTranscription of one utterance. The text is empty when nothing was recognized.
FailedBuffer[]Transcription gave up after its retries, with the audio chunks left pending.

See the STT interface for the full contract.

Documentation

Read full documentation of the Gradium integration for Micdrop on the website.

License

MIT

Author

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