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

# Audio Speed Changer

> Processes an audio file to change its playback speed based on a speed factor.



## OpenAPI

````yaml POST /v1/audio_speed_changer
openapi: 3.1.0
info:
  title: Musicgpt API
  version: 1.0.0
  description: API for retrieving conversion details by ID.
servers:
  - url: https://api.musicgpt.com/api/public
    description: Production server
security: []
paths:
  /v1/audio_speed_changer:
    post:
      summary: Change the speed of an audio file
      description: >-
        Processes an audio file to change its playback speed based on a speed
        factor.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                audio_url:
                  type: string
                  description: URL of the input audio to change speed.
                  example: https://example.com/input_audio.mp3
                audio_file:
                  type: string
                  format: binary
                  description: Audio file to upload and process directly.
                speed_change_factor:
                  type: number
                  description: 'Factor to change the audio speed (min: 0.25, max: 4.0)'
                  minimum: 0.25
                  maximum: 4
                  example: 1.5
                output_extension:
                  type: string
                  enum:
                    - mp3
                    - wav
                    - flac
                    - ogg
                    - aac
                    - webm
                  description: Desired output format.
                  example: mp3
                webhook_url:
                  type: string
                  description: Callback URL for async processing results.
                  example: http://your-webhook-url.com/callback
              required:
                - speed_change_factor
              anyOf:
                - required:
                    - audio_url
                - required:
                    - audio_file
      responses:
        '200':
          description: Successfully initiated audio speed change
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  conversion_id:
                    type: string
                  credit_estimate:
                    type: number
                    format: float
                  conversion_path:
                    type: string
                  message:
                    type: string
                example:
                  success: true
                  conversion_id: conv999
                  credit_estimate: 45
                  conversion_path: https://example.com/output/converted_audio.mp3
                  message: Speed change task queued successfully
        '400':
          description: Invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Invalid speed_change_factor
        '401':
          description: Invalid authentication
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Authentication failed
        '402':
          description: Insufficient credits
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Insufficient credits for this operation
                  required_credits:
                    type: number
                    example: 45
                  available_credits:
                    type: number
                    example: 30
        '404':
          description: User or plan not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: User subscription plan not found
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Internal server error during processing
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: Python
          source: |-
            import requests

            url = "https://api.musicgpt.com/api/public/v1/audio_speed_changer"
            headers = {"Authorization": "<API_KEY>"}

            # Option 1: Use audio URL
            payload = {
                "audio_url": "https://example.com/input_audio.mp3",
                "speed_change_factor": 1.5,
                "output_extension": "mp3"
            }
            response = requests.post(url, headers=headers, data=payload)
            print(response.json())

            # Option 2: Upload local audio file
            payload = {
                "speed_change_factor": 1.25,
                "output_extension": "wav"
            }
            with open("input_audio.mp3", "rb") as f:
                files = {"audio_file": f}
                response = requests.post(url, headers=headers, data=payload, files=files)
            print(response.json())
        - lang: PHP
          source: |-
            <?php
            $url = 'https://api.musicgpt.com/api/public/v1/audio_speed_changer';
            $headers = ['Authorization: <API_KEY>'];

            $data = [
                'audio_url' => 'https://example.com/input_audio.mp3',
                'speed_change_factor' => 1.5,
                'output_extension' => 'mp3'
            ];

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            $response = curl_exec($ch);
            curl_close($ch);
            echo $response;
        - lang: Go
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\turl := \"https://api.musicgpt.com/api/public/v1/audio_speed_changer\"\n\ttoken := \"<API_KEY>\"\n\tdata := \"audio_url=https://example.com/input_audio.mp3&speed_change_factor=1.5&output_extension=mp3\"\n\n\treq, _ := http.NewRequest(\"POST\", url, strings.NewReader(data))\n\treq.Header.Add(\"Authorization\", token)\n\tres, _ := http.DefaultClient.Do(req)\n\tdefer res.Body.Close()\n\tbody, _ := io.ReadAll(res.Body)\n\tfmt.Println(string(body))\n}"
        - lang: Java
          source: // Java version omitted for brevity; request if needed.
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````