> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wav.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Voice Changer

> Convert the voice from an audio file or URL to a different voice.

Convert the voice from an audio file or URL to a different voice using AI voice models.

The **VoiceChanger** endpoint provides real-time voice transformation by modifying the pitch, removing background noise, and converting the voice using a selected model. Ideal for creative content, dubbing, or personalized audio experiences.

***

## Endpoint

```http theme={null}
POST /v1/VoiceChanger
```

This is the primary endpoint for initiating voice conversion tasks.

***

## Sample Output

Listen to a real sample output:
<audio controls="1" controlslist="nodownload nofullscreen noremoteplayback" src="https://cdn1.wav.com/projects/67092f68-045d-4e3c-8006-532f144dd610.mp3">Your browser does not support the audio playback.</audio>

Output File:
<a href="https://cdn1.wav.com/projects/67092f68-045d-4e3c-8006-532f144dd610.wav" target="_blank">Download Audio</a>

***

## Try it Yourself

Visit the [VoiceChanger Endpoint Explorer](/api-documentation/endpoint/voicetovoice) to test it live. Upload a sample, pick a voice, and experience real-time voice transformation.

***

## Request Parameters

| Parameter           | Type      | Required | Description                                                                          |
| ------------------- | --------- | -------- | ------------------------------------------------------------------------------------ |
| `audio_url`         | `String`  | Optional | URL of the audio file. Either `audio_url` or `audio_file` must be provided.          |
| `audio_file`        | `File`    | Optional | Upload the audio file directly. Either `audio_url` or `audio_file` must be provided. |
| `voice_id`          | `String`  | ✅ Yes    | Voice model to convert the audio into.                                               |
| `remove_background` | `Integer` | Optional | Set to `1` to remove background noise. Default is `0`.                               |
| `pitch`             | `Integer` | Optional | Adjust pitch between -12 and 12 semitones. Default is `0`.                           |
| `webhook_url`       | `String`  | Optional | Callback URL for async response.                                                     |

> **Note:** Either audio\_file or audio\_url must be provided.

> **content-type:** multipart/form-data

***

## Sample Request

### cURL

```bash theme={null}
curl -X POST "https://api.wav.com/api/public/v1/VoiceChanger" \
  -H "Authorization: <API_KEY>" \
  -F "voice_id=e0bb585f-b798-4bac-ac4e-de7fff38f9d75" \
  -F "remove_background=1" \
  -F "pitch=0" \
  -F "webhook_url=https://example.com/my-webhook" \
  -F "audio_url=<YOUR_AUDIO_URL>"
```

### Python

```python theme={null}
import requests

url = "https://api.wav.com/api/public/v1/VoiceChanger"

headers = {
    "Authorization": "<API_KEY>"
}

data = {
    "voice_id": "e0bb585f-b798-4bac-ac4e-de7fff38f9d75",
    "remove_background": 1,
    "pitch": 0,
    "webhook_url": "https://example.com/my-webhook"
}

# Option 1: audio_url
data["audio_url"] = "<YOUR_AUDIO_URL>"
response = requests.post(url, headers=headers, data=data)

# Option 2: File Upload
# with open("song.mp3", "rb") as f:
#     files = {"audio_file": f}
#     response = requests.post(url, headers=headers, data=data, files=files)

print(response.json())
```

***

## Sample Response

### Success (200 OK)

```json theme={null}
{
  "success":true,
  "task_id": "fdcca59e-9788-43fc-9ee6-e9983064c432",  
  "conversion_id":"3b8dd3e8-104a-4a2f-86ba-3ed722f5190a",
  "eta":16,
  "credit_estimate":1.07,
  "message":"",
  "status":"IN_QUEUE"
}
```

***

## Webhook Response

```json theme={null}
{
  "success": true, 
  "conversion_type": "Voice Conversion", 
  "task_id": "fdcca59e-9788-43fc-9ee6-e9983064c432", 
  "conversion_id": "67092f68-045d-4e3c-8006-532f144dd610", 
  "conversion_path": "https://cdn1.wav.com/projects/standard/ffa2da3a-af79-4cbd-9cf6-ea178c9b2f90.mp3",
  "conversion_cost": "0.78", 
  "conversion_duration": 272.44,
  "message": "Conversion Completed",
}
```

***

## Common Errors

* **400 Bad Request**: Invalid or missing input file.
* **402 Payment Required**: Your credit balance is insufficient.
* **422 Unprocessable Entity**: No `audio_url` or `audio_file` provided.
* **500 Internal Server Error**: Something went wrong on our end.

***

## Payload and Request Formation


## OpenAPI

````yaml POST /v1/VoiceChanger
openapi: 3.1.0
info:
  title: WAV API
  version: 1.0.0
  description: API for retrieving conversion details by ID.
servers:
  - url: https://api.wav.com/api/public
    description: Production server
security: []
paths:
  /v1/VoiceChanger:
    post:
      summary: Convert voice from audio file or URL
      description: Convert the voice from an audio file or URL to a different voice.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                audio_url:
                  type: string
                  description: 'Input audio URL (supported format: YouTube URL).'
                  example: https://example.com/audio.wav
                audio_file:
                  type: string
                  format: binary
                  description: Audio file to upload
                voice_id:
                  type: string
                  description: Voice model ID
                  example: demo-voice-id
                remove_background:
                  type: integer
                  description: 1 to remove background noise, 0 to keep
                  default: 0
                  enum:
                    - 0
                    - 1
                pitch:
                  type: integer
                  description: Pitch adjustment (-12 to +12)
                  default: 0
                  minimum: -12
                  maximum: 12
                webhook_url:
                  type: string
                  description: Callback URL
                  example: https://example.com/callback
              required:
                - voice_id
              anyOf:
                - required:
                    - audio_url
                - required:
                    - audio_file
      responses:
        '200':
          description: Successfully initiated task
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  task_id:
                    type: string
                  conversion_id:
                    type: string
                  eta:
                    type: integer
                  credit_estimate:
                    type: number
                  message:
                    type: string
                  status:
                    type: string
                example:
                  success: true
                  task_id: fdcca59e-9788-43fc-9ee6-e9983064c432
                  conversion_id: 3b8dd3e8-104a-4a2f-86ba-3ed722f5190a
                  eta: 16
                  credit_estimate: 1.07
                  message: ''
                  status: IN_QUEUE
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error:
                    type: string
              example:
                success: false
                error: The file could not be downloaded from the provided URL
        '402':
          description: Payment Required
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error:
                    type: string
              example:
                success: false
                error: Insufficient credit balance
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error:
                    type: string
              example:
                success: false
                error: Both audio_url and audio_file cannot be None
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error:
                    type: string
              example:
                success: false
                error: Internal Server Error
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: Python
          source: >-
            import requests


            url = "https://api.wav.com/api/public/v1/VoiceChanger"


            headers = {
                "Authorization": "<API_KEY>"
            }


            data = {
                "voice_id": "e0bb585f-b798-4bac-ac4e-de7fff38f9d75",
                "remove_background": 1,
                "pitch": 0,
                "webhook_url": "https://example.com/my-webhook"
            }


            # Option 1: audio_url

            data["audio_url"] = "<YOUR_AUDIO_URL>"

            response = requests.post(url, headers=headers, data=data)


            # Option 2: File Upload

            # with open("song.mp3", "rb") as f:

            #     files = {"audio_file": f}

            #     response = requests.post(url, headers=headers, data=data,
            files=files)


            print(response.json())
        - lang: PHP
          source: |-
            <?php
            $url = "https://api.wav.com/api/public/v1/VoiceChanger";
            $apiKey = "<API_KEY>";

            $data = [
                "voice_id" => "voice_12345",
                "remove_background" => 1,
                "pitch" => 0,
                "webhook_url" => "https://example.com/my-webhook"
            ];

            // Option 1: audio_url
            $data["audio_url"] = "<YOUR_AUDIO_URL>";

            // Option 2: File Upload
            // $data["audio_file"] = new CURLFile("song.mp3");

            $headers = [
                "Authorization: " . $apiKey
            ];

            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

            $response = curl_exec($ch);
            curl_close($ch);

            echo $response;
            ?>
        - lang: Go
          source: "package main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"mime/multipart\"\n\t\"net/http\"\n\t\"os\"\n)\n\nfunc main() {\n\turl := \"https://api.wav.com/api/public/v1/VoiceChanger\"\n\tapiKey := \"<API_KEY>\"\n\n\tpayload := map[string]string{\n\t\t\"voice_id\": \"voice_12345\",\n\t\t\"remove_background\": \"1\",\n\t\t\"pitch\": \"0\",\n\t\t\"webhook_url\": \"https://example.com/my-webhook\",\n\t}\n\n\tbody := &bytes.Buffer{}\n\twriter := multipart.NewWriter(body)\n\n\tfor key, val := range payload {\n\t\t_ = writer.WriteField(key, val)\n\t}\n\n\t// Option 1: audio_url\n\twriter.WriteField(\"audio_url\", \"<YOUR_AUDIO_URL>\")\n\n\t// Option 2: File Upload\n\t// file, _ := os.Open(\"song.mp3\")\n\t// defer file.Close()\n\t// part, _ := writer.CreateFormFile(\"audio_file\", \"song.mp3\")\n\t// io.Copy(part, file)\n\n\twriter.Close()\n\n\treq, _ := http.NewRequest(\"POST\", url, body)\n\treq.Header.Set(\"Authorization\", apiKey)\n\treq.Header.Set(\"Content-Type\", writer.FormDataContentType())\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tresponse, _ := io.ReadAll(resp.Body)\n\tfmt.Println(string(response))\n}"
        - lang: Java
          source: |-
            import okhttp3.*;

            import java.io.File;
            import java.io.IOException;

            public class VoiceChanger {
                public static void main(String[] args) throws IOException {
                    String url = "https://api.wav.com/api/public/v1/VoiceChanger";
                    String apiKey = "<API_KEY>";

                    // Option 1: audio_url
                    RequestBody requestBody = new FormBody.Builder()
                            .add("audio_url", "<YOUR_AUDIO_URL>")
                            .add("voice_id", "voice_12345")
                            .add("remove_background", "1")
                            .add("pitch", "0")
                            .add("webhook_url", "https://example.com/my-webhook")
                            .build();

                    // Option 2: File Upload
                    // File audioFile = new File("song.mp3");
                    // RequestBody requestBody = new MultipartBody.Builder()
                    //         .setType(MultipartBody.FORM)
                    //         .addFormDataPart("voice_id", "voice_12345")
                    //         .addFormDataPart("remove_background", "1")
                    //         .addFormDataPart("pitch", "0")
                    //         .addFormDataPart("webhook_url", "https://example.com/my-webhook")
                    //         .addFormDataPart("audio_file", audioFile.getName(),
                    //                 RequestBody.create(audioFile, MediaType.parse("audio/mpeg")))
                    //         .build();

                    Request request = new Request.Builder()
                            .url(url)
                            .post(requestBody)
                            .header("Authorization", apiKey)
                            .build();

                    OkHttpClient client = new OkHttpClient();
                    try (Response response = client.newCall(request).execute()) {
                        System.out.println(response.body().string());
                    }
                }
            }
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````