> For the complete documentation index, see [llms.txt](https://docs.noiz.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.noiz.ai/api-documentation/text-to-speech.md).

# Text To Speech

## Convert text to speech

> Convert text to speech using a specified voice. Supports emotion control, speed adjustment, and multiple output formats.

```json
{"openapi":"3.0.3","info":{"title":"Voice API","version":"1.0.0"},"servers":[{"url":"https://noiz.ai/v1","description":"Production server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization"}},"responses":{"UnauthorizedError":{"description":"API Key missing or invalid","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}}}}},"paths":{"/text-to-speech":{"post":{"tags":["Text to Speech"],"summary":"Convert text to speech","description":"Convert text to speech using a specified voice. Supports emotion control, speed adjustment, and multiple output formats.","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["text"],"properties":{"text":{"type":"string","description":"Text to convert (max 5000 chars)"},"voice_id":{"type":"string","description":"Voice ID to use for synthesis"},"file":{"type":"string","format":"binary","description":"Audio file for voice cloning (alternative to voice_id)"},"quality_preset":{"type":"integer","default":3,"description":"Quality preset for synthesis"},"output_format":{"type":"string","enum":["wav","mp3"],"default":"wav","description":"Output audio format (wav/mp3)"},"speed":{"type":"number","default":1,"description":"Speech speed multiplier"},"duration":{"type":"number","default":0,"description":"Target audio duration in seconds"},"target_lang":{"type":"string","description":"Target language code (e.g., \"zh\", \"en\", \"zh+en\")"},"similarity_enh":{"type":"boolean","default":false,"description":"Whether to enhance voice similarity"},"emo":{"type":"string","description":"Emotion parameters as JSON string, e.g., {\"Sadness\":0.2, \"Surprise\":0.5}"},"trim_silence":{"type":"boolean","default":false,"description":"Whether to trim leading and trailing silence from the generated audio"},"save_voice":{"type":"boolean","default":false,"description":"Whether to save the uploaded voice file"}}}}}},"responses":{"200":{"description":"Success — returns audio binary stream","headers":{"X-Timestamp":{"description":"Unix timestamp in milliseconds when the audio was generated","schema":{"type":"integer","format":"int64"}},"X-Audio-Duration":{"description":"Audio duration in seconds","schema":{"type":"string"}}},"content":{"audio/wav":{"schema":{"type":"string","format":"binary"}},"audio/mpeg":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Invalid parameters or processing error","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"402":{"description":"Payment required","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}}},"500":{"description":"Internal server error (TTS synthesis failure)","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}}}}}}}}
```

## Emotion enhancement

> Automatically add emotion annotations to input text. The enhanced text  can be used directly in the text-to-speech API for more expressive speech synthesis.

```json
{"openapi":"3.0.3","info":{"title":"Voice API","version":"1.0.0"},"servers":[{"url":"https://noiz.ai/v1","description":"Production server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization"}},"responses":{"UnauthorizedError":{"description":"API Key missing or invalid","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}}}}},"paths":{"/emotion-enhance":{"post":{"tags":["Text to Speech"],"summary":"Emotion enhancement","description":"Automatically add emotion annotations to input text. The enhanced text  can be used directly in the text-to-speech API for more expressive speech synthesis.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["text"],"properties":{"text":{"type":"string","description":"Text to enhance with emotions (max 5000 chars)"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Status code (0 = success)"},"message":{"type":"string"},"data":{"type":"object","properties":{"emotion_enhance":{"type":"string","description":"Text with emotion annotations added"}}}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"402":{"description":"Payment required","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}}},"429":{"description":"Hard limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}}}}}}}}
```
