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

# Music Detection Batch

> Classify music and speech in an audio file. Returns frame-level probabilities, a primary label, and percentage breakdowns of content type.



## OpenAPI

````yaml api/velma_2_music_detection_batch.yaml POST /api/velma-2-music-detection-batch
openapi: 3.1.0
info:
  title: Velma 2 Music Detection Batch API
  description: >
    Batch endpoint for detecting and classifying audio content as music, speech,

    or neither, via HTTP POST. The response contains an ordered list of
    per-frame

    music and speech probabilities - each frame covers a fixed window of

    approximately 192 milliseconds, with contiguous timestamps spanning the full

    duration of the audio - plus an overall primary label and a percentage

    breakdown of how much of the clip is music versus speech.
  version: 0.0.0
servers:
  - url: https://platform.modulate.ai
    description: Modulate Music Detection Batch Server
security:
  - ApiKeyAuth: []
paths:
  /api/velma-2-music-detection-batch:
    post:
      summary: Detect music and speech in an audio file
      description: |
        Accepts an audio file and returns frame-level music and speech
        probabilities, an overall primary label, and percentage breakdowns of
        content type across the clip.
      operationId: detectMusic
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - upload_file
              properties:
                upload_file:
                  type: string
                  format: binary
                  description: |
                    Audio file to analyse. Must be non-empty. Supported formats:
                    `.3g2`, `.3ga`, `.3gp`, `.3gpp`, `.8svx`, `.aa3`, `.aac`,
                    `.ac3`, `.act`, `.adts`, `.aif`, `.aifc`, `.aiff`, `.alac`,
                    `.amb`, `.amr`, `.ape`, `.asf`, `.at3`, `.au`, `.avi`,
                    `.avr`, `.awb`, `.bwf`, `.c2`, `.caf`, `.dss`, `.dts`,
                    `.dtshd`, `.eac3`, `.ec3`, `.f4a`, `.f4b`, `.flac`, `.flv`,
                    `.gsm`, `.iff`, `.m2a`, `.m2ts`, `.m4a`, `.m4b`, `.m4r`,
                    `.m4v`, `.mka`, `.mkv`, `.mlp`, `.mmf`, `.mov`, `.mp+`,
                    `.mp1`, `.mp2`, `.mp3`, `.mp4`, `.mpa`, `.mpc`, `.mpeg`,
                    `.mpg`, `.mpga`, `.mpp`, `.mts`, `.mxf`, `.nist`, `.oga`,
                    `.ogg`, `.ogx`, `.oma`, `.omg`, `.opus`, `.paf`, `.pvf`,
                    `.qcp`, `.ra`, `.rf64`, `.rka`, `.rm`, `.rmvb`, `.sf`,
                    `.shn`, `.snd`, `.sph`, `.svx`, `.tak`, `.thd`,
                    `.ts`, `.tta`, `.vob`, `.voc`, `.vqf`, `.w64`, `.wav`,
                    `.wave`, `.weba`, `.webm`, `.wma`, `.wmv`,
                    `.wv`. Maximum file size: 100 MB.
      responses:
        '200':
          description: Detection completed successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MusicDetectionResponse'
              example:
                filename: my_audio.wav
                duration_s: 5.76
                primary_label: speech
                music_pct: 0
                speech_pct: 86.7
                latency_ms: 1243.5
                frames:
                  - start_time_ms: 0
                    end_time_ms: 192
                    music_prob: 0.0213
                    speech_prob: 0.9888
                  - start_time_ms: 192
                    end_time_ms: 384
                    music_prob: 0.0204
                    speech_prob: 0.9931
        '400':
          description: >
            Bad request - the uploaded file is empty, its format is not
            supported, or the audio could not be decoded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_format:
                  summary: Invalid file format
                  value:
                    detail: >-
                      Unsupported file format. Supported formats: .3g2, .3ga,
                      .3gp, .3gpp, .8svx, .aa3, .aac, .ac3, .act, .adts, .aif,
                      .aifc, .aiff, .alac, .amb, .amr, .ape, .asf, .at3, .au,
                      .avi, .avr, .awb, .bwf, .c2, .caf, .dss, .dts, .dtshd,
                      .eac3, .ec3, .f4a, .f4b, .flac, .flv, .gsm, .iff, .m2a,
                      .m2ts, .m4a, .m4b, .m4r, .m4v, .mka, .mkv, .mlp, .mmf,
                      .mov, .mp+, .mp1, .mp2, .mp3, .mp4, .mpa, .mpc, .mpeg,
                      .mpg, .mpga, .mpp, .mts, .mxf, .nist, .oga, .ogg, .ogx,
                      .oma, .omg, .opus, .paf, .pvf, .qcp, .ra, .rf64, .rka,
                      .rm, .rmvb, .sf, .shn, .snd, .sph, .svx, .tak, .thd, .ts,
                      .tta, .vob, .voc, .vqf, .w64, .wav, .wave, .weba, .webm,
                      .wma, .wmv, .wv.
                empty_file:
                  summary: Empty file
                  value:
                    detail: The uploaded file is empty.
                no_audio_stream:
                  summary: No decodable audio stream
                  value:
                    detail: No decodable audio stream was found in the file.
                unsupported_codec:
                  summary: Unsupported audio codec
                  value:
                    detail: The audio codec is not supported.
                corrupt_file:
                  summary: Corrupted or truncated audio file
                  value:
                    detail: The audio file appears to be corrupted or truncated.
                unprocessable:
                  summary: Audio could not be decoded
                  value:
                    detail: >-
                      The audio could not be processed. It may be corrupted or
                      in an unsupported format.
                bad_value:
                  summary: Malformed request value
                  value:
                    detail: Invalid request.
        '401':
          description: Unauthorized - the API key is missing or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                missing_api_key:
                  summary: Missing API key
                  value:
                    detail: Missing API key.
                invalid_api_key:
                  summary: Invalid API key
                  value:
                    detail: Invalid API key.
        '403':
          description: >
            Forbidden - the request is not permitted, or the API key does not
            have access to this model.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                not_permitted:
                  summary: Request not permitted
                  value:
                    detail: This request is not permitted.
                model_access_denied:
                  summary: No access to this model
                  value:
                    detail: This API key does not have access to this model.
        '413':
          description: Payload too large - the uploaded file exceeds the maximum file size.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                detail: The uploaded file is too large.
        '422':
          description: >
            Unprocessable entity - a required request parameter is missing or
            invalid (for example, the `upload_file` field).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: >
            Too many requests - the request was denied due to insufficient
            credits, a concurrent request limit, or a monthly usage limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                insufficient_credits:
                  summary: Insufficient credits
                  value:
                    detail: Insufficient credits.
                concurrency_limit:
                  summary: Concurrent request limit reached
                  value:
                    detail: >-
                      Concurrent request limit reached. Please retry after your
                      in-flight requests complete.
                monthly_limit:
                  summary: Monthly usage limit reached
                  value:
                    detail: Monthly usage limit reached.
        '500':
          description: Internal server error during processing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                detail: Internal server error
        '503':
          description: Service unavailable - the service is temporarily unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                detail: >-
                  The service is temporarily unavailable. Please try again
                  later.
      security:
        - ApiKeyAuth: []
components:
  schemas:
    MusicDetectionResponse:
      type: object
      required:
        - filename
        - duration_s
        - primary_label
        - music_pct
        - speech_pct
        - latency_ms
        - frames
      properties:
        filename:
          type: string
          description: >
            Name of the submitted audio file. Empty string if no filename was
            provided in the upload.
          example: my_audio.wav
        duration_s:
          type: number
          format: double
          minimum: 0
          description: Total duration of the analysed audio in seconds.
          example: 5.76
        primary_label:
          type: string
          enum:
            - music
            - speech
            - neither
            - unknown
          description: |
            Overall classification of the clip:
            - `music` - music covers at least as much of the clip as
              speech, and more than zero.
            - `speech` - speech covers more of the clip than music, and
              more than zero.
            - `neither` - neither music nor speech reached the dominant
              threshold for any portion of the clip.
            - `unknown` - no frames could be produced from the audio.
          example: speech
        music_pct:
          type: number
          format: double
          minimum: 0
          maximum: 100
          description: |
            Percentage of the clip classified as containing music.
          example: 0
        speech_pct:
          type: number
          format: double
          minimum: 0
          maximum: 100
          description: |
            Percentage of the clip classified as containing speech.
          example: 86.7
        latency_ms:
          type: number
          format: double
          minimum: 0
          description: End-to-end inference time in milliseconds.
          example: 1243.5
        frames:
          type: array
          description: >
            Ordered list of per-frame classification results covering the full
            duration of the clip.
          items:
            $ref: '#/components/schemas/FrameResult'
    ErrorResponse:
      type: object
      required:
        - detail
      properties:
        detail:
          type: string
          description: Human-readable error message.
    HTTPValidationError:
      type: object
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    FrameResult:
      type: object
      required:
        - start_time_ms
        - end_time_ms
        - music_prob
        - speech_prob
      properties:
        start_time_ms:
          type: integer
          minimum: 0
          description: Frame start time in milliseconds.
          example: 0
        end_time_ms:
          type: integer
          minimum: 0
          description: Frame end time in milliseconds.
          example: 192
        music_prob:
          type: number
          format: double
          minimum: 0
          maximum: 1
          description: Probability that this frame contains music.
          example: 0.0213
        speech_prob:
          type: number
          format: double
          minimum: 0
          maximum: 1
          description: >
            Probability that this frame contains speech. Music and speech are
            not mutually exclusive - both probabilities can be high for the same
            frame.
          example: 0.9888
    ValidationError:
      type: object
      required:
        - loc
        - msg
        - type
      properties:
        loc:
          type: array
          items:
            anyOf:
              - type: string
              - type: integer
        msg:
          type: string
        type:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key used for authentication and usage tracking.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.