Skip to main content

Requirements

On a server, the API key can be used directly (apiKey: process.env.LOKUTOR_API_KEY). Never send it to a browser: give browsers tickets (Secure browser setup).

Setup

node-record-lpcm16 needs SoX (brew install sox, sudo apt install sox); speaker may need ALSA headers on Linux (sudo apt install libasound2-dev).

Voice agent in a terminal

NodeAudioManager connects the microphone and the speaker for you:
There is no echo cancellation in this path: use headphones, or the agent hears itself through the speakers. To route audio yourself (for example from a telephony bridge), connect without an audio manager, send 16 kHz Int16 mono PCM with client.sendAudio(chunk), and play the 44.1 kHz Int16 mono PCM that arrives on client.on('audio', …).

Save TTS to a file

For a WAV file in one request with no SDK, use POST /tts/synthesize.