---
agentTools:
  projectIndex: https://uberduck.readme.io/llms.txt
---

# Generate Speech Synchronously

Synthesize speech synchronously.

This endpoint returns binary 16-bit wav data with a sample rate of 22050 Hz.

Voice can be specified by providing either `voice` + `model_type`, or
`voicemodel_uuid`.

`Pace`, `duration`, and `pitch` are only supported for voices
that support these controls (a very small subset of voices).

You can check if a given voice supports controls by querying /voice-data or
/voices/<voicemodel-uuid>/detail and looking at the `controls` boolean in
the reponse.

# OpenAPI definition

```json
{
  "openapi": "3.0.2",
  "info": {
    "title": "Uberduck Text To Speech API",
    "version": "0.1.0"
  },
  "servers": [
    {
      "url": "https://api.uberduck.ai"
    },
    {
      "url": "http://localhost:8003"
    }
  ],
  "paths": {
    "/speak-synchronous": {
      "post": {
        "summary": "Generate Speech Synchronously",
        "description": "Synthesize speech synchronously.\n\nThis endpoint returns binary 16-bit wav data with a sample rate of 22050 Hz.\n\nVoice can be specified by providing either `voice` + `model_type`, or\n`voicemodel_uuid`.\n\n`Pace`, `duration`, and `pitch` are only supported for voices\nthat support these controls (a very small subset of voices).\n\nYou can check if a given voice supports controls by querying /voice-data or\n/voices/<voicemodel-uuid>/detail and looking at the `controls` boolean in\nthe reponse.",
        "operationId": "generate_speech_synchronously_speak_synchronous_post",
        "parameters": [
          {
            "required": false,
            "schema": {
              "title": "Uberduck-Id",
              "type": "string",
              "default": "anonymous"
            },
            "name": "uberduck-id",
            "in": "header"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TTSRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBasic": []
          },
          {
            "HTTPBearer": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "HTTPValidationError": {
        "title": "HTTPValidationError",
        "type": "object",
        "properties": {
          "detail": {
            "title": "Detail",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            }
          }
        }
      },
      "TTSRequest": {
        "title": "TTSRequest",
        "required": [
          "speech"
        ],
        "type": "object",
        "properties": {
          "speech": {
            "title": "Speech",
            "maxLength": 1000,
            "minLength": 1,
            "type": "string"
          },
          "voice": {
            "title": "Voice",
            "type": "string",
            "default": "lj"
          },
          "model_type": {
            "title": "Model Type",
            "type": "string"
          },
          "voicemodel_uuid": {
            "title": "Voicemodel Uuid",
            "type": "string"
          },
          "pace": {
            "title": "Pace",
            "type": "number",
            "default": 1
          },
          "duration": {
            "title": "Duration",
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          "pitch": {
            "title": "Pitch",
            "type": "array",
            "items": {
              "type": "number"
            }
          }
        }
      },
      "ValidationError": {
        "title": "ValidationError",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "type": "object",
        "properties": {
          "loc": {
            "title": "Location",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "msg": {
            "title": "Message",
            "type": "string"
          },
          "type": {
            "title": "Error Type",
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "HTTPBasic": {
        "type": "http",
        "scheme": "basic"
      },
      "HTTPBearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 100,
      "1": 90,
      "2": 123,
      "3": 202,
      "4": 119,
      "5": 115,
      "6": 54,
      "7": 49,
      "8": 97,
      "9": 213,
      "10": 116,
      "11": 44
    }
  }
}
```