Speech recognition, translation and synthesis
Complete speech-to-text and text-to-speech using the audio interface.
Speech recognition
Models that support the corresponding capabilities can be requested with multipart:
curl --fail-with-body https://dunduntoken.com/v1/audio/transcriptions \
-H "Authorization: Bearer $DUNDUN_API_KEY" \
-F "model=TRANSCRIPTION_MODEL_ID" -F "file=@./sample.wav"
Recording format, size, language and timestamp capabilities are subject to model. The recognition interface is not a real-time voice WebSocket, so do not send any audio fragments directly there.
Audio Translation
POST /v1/audio/translations uses the multipart parameters of the corresponding model. The target language and output form depend on the model, and it cannot be assumed that arbitrary bidirectional language translation is available.
Text to Speech
curl --fail-with-body https://dunduntoken.com/v1/audio/speech \
-H "Authorization: Bearer $DUNDUN_API_KEY" -H "Content-Type: application/json" \
-d '{"model":"TTS_MODEL_ID","input":"你好,欢迎使用。","voice":"SUPPORTED_VOICE"}' \
--output speech.bin
Replace the model and sound and press Return Content-Type to use the correct extension. Check the response body when the download fails and don’t mistake JSON errors for audio. Use of sounds requires necessary authorization.
Audio translation request
curl --fail-with-body https://dunduntoken.com/v1/audio/translations -H "Authorization: Bearer $DUNDUN_API_KEY" -F "model=TRANSLATION_MODEL_ID" -F "file=@./sample.wav"
The target language of the translation interface is not optional. If you need to “recognize and then translate into a specified language”, the application can hand over the recognized text to the text model for processing, making it clear that these are two calling steps.
Input and return comparison
| Task | Transfer | Read |
|---|---|---|
| Transcriptions | multipart audio files | Read text or time segments in response format |
| Translations | multipart audio files | Support reading translated text by model |
| Speech | JSON text, models and sounds | Binary audio and Content-Type |
The result of transcribing common text is as follows:
{
"text": "你好,欢迎使用。"
}
Acceptance of synthesis results
Start by testing the available sounds with a short text, checking file size, true encoding and playability before increasing the length. Simply changing the extension will not convert the audio format. Streaming, speaking speed, commands, and output formats are model-specific capabilities and are not all supported by default.
FAQ
415 Check whether multipart and JSON are mixed; 413 Check the media size; check the recording content, encoding and model language support without text. When long recordings are segmented, the application maintains the timeline and deduplicates overlaps. Segmented transcription cannot be mistaken for a real-time conversation API.