Websockets
Overview
Rime’s websocket implementation accepts bare text, and responds with audio bytes of the selected format. All synthesis arguments are provided as query parameters when establishing the connection.
The websocket API buffers inputs up to on of the following punctuation characters: .
, ,
, ?
, !
. This is most pertinent for the initial messages sent to the API, as synthesis won’t begin until there are sufficient tokens to generate audio with natural prosody. After the first synthesis of any given utterance, typically enough time has elapsed that subsequent audio contains multiple clauses, and the buffering becomes largely invisible.
Messages
Send
The messages your client will send to the websocket API will be bare (non-serialized) text.
Receive
The messages your client will receive will be raw audio bytes in the audio format specified at connection time.
Commands
There will be times when you want to interact with the API and manipute the stored buffer. These are the current supported commands.
<CLEAR>
This clears the current buffer. Used in the event of interruptions.
<EOS>
This forces whatever buffer exists, if any, to be synthesized, and for the server to close the connection after sending the generated audio.
Variable Parameters
Must be one of the voices listed in our documentation.
The text you’d like spoken
Choose mist
for hyper-realistic conversational voices or v1
for Rime’s first-gen model (default: v1
)
One of mp3
, mulaw
, or pcm
When set to true, adds pauses between words enclosed in angle brackets. The number inside the brackets specifies the pause duration in milliseconds.
Example: “Hi. <200> I’d love to have a conversation with you.” adds a 200ms pause between the first and second sentences.
When set to true, you can specify the phonemes for a word enclosed in curly brackets.
Example: “{h’El.o} World” will pronounce “Hello” as expected. More details on this feature are incoming!
Comma-separated list of speed values applied to words in square brackets. Values < 1.0 speed up speech, > 1.0 slow it down. Example: “This sentence is [really] [fast]” with inlineSpeedAlpha “0.5, 3” will make “really” slow and “fast” fast.
The value, if provided, must be between 4000 and 44100. Default: 22050
Adjusts the speed of speech. Lower than 1.0 is faster than default. Higher than 1.0 is slower than default.
Reduces the latency of response, at the cost of some possible mispronunciation of digits and abbreviations.