Skip to main content
curl --request POST \
  --url https://optimize.rime.ai/phonemize \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: audio/wav' \
  --fail \
  --data-binary @speech.wav
{
  "audioId": "9b2d8ad2-0618-4e96-b255-98b2f7488061",
  "phonemeString": "h0El1o !",
  "authed": 1
}

Overview

This API endpoint converts a short audio recording of a word into a phonetic string in the Rime phonetic alphabet. Use it when you know how a word should sound but don’t want to write the phonetic string by hand: record the word (or synthesize it), post the audio, and paste the returned string into a TTS request inside curly brackets with phonemizeBetweenBrackets: true — see Custom pronunciation.
Custom pronunciation strings are supported by Mist v1 and v2 only. For an overview of all the ways to control pronunciation, see Pronunciation control.

Request

Unlike Rime’s other endpoints, the request body is the raw audio bytes — not JSON or multipart form data. Set the Content-Type header to match the audio format. WAV (audio/wav) and MP3 (audio/mpeg) are supported.

Example

Generate or record audio of the word — for example with the Rime CLI:
rime tts -m coda -l en -s astra "hello" -o speech.wav
Then post it to the endpoint:
curl -X POST https://optimize.rime.ai/phonemize \
     -H "Authorization: Bearer $(rime key)" \
     -H "Content-Type: audio/wav" \
     --data-binary @speech.wav
The response includes the phonetic string:
{
  "audioId": "9b2d8ad2-0618-4e96-b255-98b2f7488061",
  "phonemeString": "h0El1o !",
  "authed": 1
}

Response fields

  • audioId — identifier of the uploaded audio clip.
  • phonemeString — the phonetic transcription in the Rime phonetic alphabet. The string may end with a punctuation token (e.g. ! or ?); strip it before using the string inside {}.
  • authed — always 1.
curl --request POST \
  --url https://optimize.rime.ai/phonemize \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: audio/wav' \
  --fail \
  --data-binary @speech.wav
{
  "audioId": "9b2d8ad2-0618-4e96-b255-98b2f7488061",
  "phonemeString": "h0El1o !",
  "authed": 1
}