Muzaic API docs
More about MuzaicCall us
  • Welcome!
  • Accesing Muzaic API
  • Checking API usage and balance
  • Reference
    • ๐Ÿ”ŽWorking with tags
    • ๐ŸŽธGetting the music
      • Quickly getting an audio file
      • Advanced soundtracking
    • ๐ŸŽ›๏ธUsing music parameters
      • ๐Ÿ’ฆIntensity parameter
      • ๐ŸƒTempo parameter
      • ๐Ÿ’ƒRhythm parameter
      • ๐ŸŽ†Tone parameter
      • ๐Ÿคนโ€โ™€๏ธVariation parameter
    • โš™๏ธAPI Reference
      • accountDetails
      • audioFromHash
      • getTags
      • singleFile
      • soundtrack
  • More about Muzaic
  • Call us
Powered by GitBook
On this page
  • Getting the mp3 file using /singleFile endpoint
  • singleFile
  • Example requests
  • Response handling
  • Getting similar music

Was this helpful?

  1. Reference
  2. Getting the music

Quickly getting an audio file

Getting the mp3 file using /singleFile endpoint

When requesting for music you can use singleFile endpoint. It accepts different parameters.

singleFile

POST /singleFile

The endpoint generates a single region MP3 file based on the provided parameters.

Request Body

Name
Type
Description

params

JSON Object

duration

int

Requested composition time in seconds. If no parameter value is passed, the default time value is 60 seconds. Currently, there is a limit set at 1200 seconds.

tags

Array (int)

An array of integers representing tag id's.

{
    "mp3": "https://api.muzaic.ai/result/2024-01-17/57c1bc6585f67ab2cf328b8fb1376e1b.mp3",
    "motiveId": 16,
    "status": "action: generate",
    "tokensUsed": 48,
    "executionTime": 9.0536079406738
}
{
    "Error":"No MuzaicAPI Secret Key"
}
{
    "Error":"Wrong request JSON Object"
}

Example requests

Good to know: All the parameters are optional, so you don't need to pass anything to get music! However, it's worth noting that this may not be the best strategy to get the music you need. The more data you pass, the more control you have. Conversely, the less data you pass, the more automated the process becomes. Ultimately, you decide what you need the most!

Simple request with duration and tags

Here's a typical request for 48 seconds of 'dynamic Latin' music (tags nos 11 and 17).

{
    "duration":48,
    "tags":[11,17]
}

Request with duration, tags and params

This request is for 2 minutes and 2 seconds of 'dreamy electronic ambient' music (tags no 2, 5 and 10). It also includes a manual music parameter setup.

{
    "duration":122,
    "tags":[2, 5, 10],
    "params": {
        "intensity":3,
        "tempo":5,
        "rhythm":5,
        "tone":9,
        "variance":5
    }
}

Good to know: All the parameters have default values. The default value for duration is 60 seconds, default for tags is empty array, and default params values equal 5.

Response handling

Example response

{
    "apiVersion":"1.2.0",
    "mp3": "https://api.muzaic.ai/result/2024-01-17/57c1bc6585f67ab2cf328b8fb1376e1b.mp3",
    "hash": "9191593eb3992ba7c4307455c0e1b5ca",
    "status": "no params object",
    "tokensUsed": 48,
    "executionTime": 9.0536079406738
}

Getting similar music

PreviousGetting the musicNextAdvanced soundtracking

Last updated 1 year ago

Was this helpful?

an object containing user music params values: intensity, tempo, rhythm, tone , variance. These values are either integers ranging from 1 to 9 (mean parameter value) or (except tempo).

In the endpoint response, you will always receive a URL to the created MP3 file (mp3). Additionally, you will find a hash of created music piece which is necessary when there is a need for a similar piece of music in the next calls, and a status field indicating the processed request's status. The status field may contain regarding the result of the API call. You can use it to verify whether you provided the proper data in your request. Additional fields will inform you about used tokens, current API version and endpoint execution time.

When using the Muzaic API, you may encounter the need for something similar but slower in tempo. If you wish to obtain music that is similar but with different parameters, just make another call with the same or similar settings. If you need more control over this process, like copying, extending or regenerating the music, try the endpoint, which is the perfect way to achieve almost everything you wish.

๐ŸŽธ
soundtrack
keyframes arrays
warnings and other information