1. Overview and quickstart
MyVocal AI语音大模型API文档
English
  • 中文
  • English
  • 文字转语音大模型
    • API reference
      • Voice management
        • List voices
        • Create a voice
        • Delete a voice
      • HTTP synthesis
        • Streaming HTTP synthesis
        • Non-streaming HTTP synthesis
      • WebSocket synthesis
        • Standard TTS · Single connection
        • Standard TTS · Multiple contexts
        • Dialogue · Multiple contexts
      • Usage and request history
        • Get master key usage
        • Look up a request by ID
        • Get usage by voice
      • Sub-key management
        • Create a sub-key
        • List sub-keys
        • Get sub-key details
        • Update a sub-key
        • Get sub-key usage
    • Overview and quickstart
      • Models
      • Choose a model and endpoint
      • Supported languages
      • Audio formats and playback
      • FAQ
      • SDKs and examples
  • 金融行业定制TTS模型
    • Skyblight text to speech
      • Streaming text to speech
      • Non-streaming text to speech
      • List voices
      • Delete a voice
      • Create a voice
      • Get usage
    • Full-duplex communication
      • WebSocket integration guide
      • V2 bidirectional streaming synthesis (WebSocket)
  • 语音转文字ASR
    • Overview and quickstarts
      • Realtime transcription quickstart
      • File transcription quickstart
      • Models and capabilities
      • Changelog
    • API reference
      • Realtime transcription over WebSocket
      • Create a file transcription
      • Get ASR usage
  • 企业客户声音定制服务
    • Your custom brand voice
  1. Overview and quickstart

Audio formats and playback

Choose a format for your player or phone system. Then choose a sample rate and bitrate from the values supported by the endpoint.
Use caseFormat
Download, storage or ordinary playbackMP3
Custom decoding, audio processing or real-time audio pipelinesPCM
Telephone lineUse 8 kHz PCM or μ-law, depending on the line.

Settings for your first request#

Streaming and non-streaming HTTP: format=mp3_44100_128.
Dialogue WebSocket: format=mp3_128.
Standard TTS WebSocket: choose a format listed for that endpoint.
Even MP3 has different format identifiers across endpoints. Choose an endpoint.

HTTP audio formats#

Common options are mp3_44100_64, mp3_44100_96, mp3_44100_128, mp3_44100_192, pcm_8000, pcm_16000, pcm_22050, pcm_24000, pcm_44100 and ulaw_8000. See the endpoint’s format field for all values and model restrictions.
For PCM, match the sample rate, bit depth and channels. The HTTP direct parameter controls framing. The default includes a WAV header. Use direct=1 for raw PCM. Changing the file extension to MP3 does not encode the audio.

Handle the audio response#

Non-streaming HTTP: check the status and content type, then save the response body as audio.
Streaming HTTP: feed response bytes to a streaming decoder in arrival order. A network chunk may contain only part of an audio frame.
WebSocket: JSON audio is usually Base64. Decode it and assemble the chunks in order for each task. Process binary frames according to the endpoint protocol.
If you receive a JSON error, handle it before deciding whether to retry.

When is synthesis complete?#

For HTTP, read to the end of the response body. For WebSocket, follow the endpoint’s final-event and close rules. In the dialogue protocol, a turn can end while the context remains open. See the API reference.
上一页
Supported languages
下一页
FAQ
Built with