Mastering Resource

Mastering allows you to create and retrieve a mastered audio file of your script. A mastered version contains the speech of the script, a background track, personalised parameters for your audience and a mastering process to enhance the audio quality of the whole track. In order to get a mastered audio file, make sure you requested speech for your script resource first.

Mastering Methods

🚀create()

Creates a mastered version of your script.

Parameters:

  • scriptId *Required (string) - The script resource ID

  • soundTemplate (string) - The sound template name. For the list of available sound templates check apiaudio.Sound.list_sound_templates() call.

  • audience (list) - List of dicts containing the personalisation parameters. This parameter depends on the number of parameters used in your Script. In the script documentation example above, we used 2 parameters: username and location, and in the following example below we want to produce the script for username Antonio with location Barcelona. If audience is not provided, the fallback track will be created.

  • public (boolean) - Boolean flag that allows to store the mastered file in a public s3 folder. Default value is False. Warning - This will cause your mastered files to be public to anyone in the internet. Use this at your own risk.

  • vast (boolean) - Boolean flag that allows to create a VAST file of your mastered file. The vast flag only works if public is True. Default value is False.

  • endFormat (list) - List of audio formats to be produced. Valid formats are: ["wav", "mp3", "mp3_c_128", "flac", "ogg"]

  • forceLength (int) - force the audio length of the mastered track (in seconds).

  • mediaFiles (list) - List of dicts containing the media files. This parameter depends on the media file tags used in the script resource and the media files you have in your account. For example, if the script contains <<media::myrecording>> plus <<media::mysong>>, and you want to attach myrecording to mediaId = "12345", and mysong to mediaId = "67890" then mediaFiles = [{"myrecording":"12345", "mysong":"67890"}].

  • mediaVolumeTrim (float) - Floating point varible that allows you to trim the volume of uploaded media files (in dB). This attribute has a valid range of -12 to 12 dB and applies to all media files included in a single mastering call. Clipping protection is not provided so only make incremental adjustments.

Example:

response = apiaudio.Mastering.create(
    scriptId="id-1234",
    soundTemplate="heatwave",
    audience=[{"username":"linda", "location":"barcelona"}]
)
const mastering = await apiaudio.Mastering.create({ scriptId: script["scriptId"], soundTemplate: template });
console.log(mastering);

🔊 retrieve()

Retrieves the mastered file urls.

Parameters:

  • scriptId *Required (string) - The script resource ID.

  • parameters (dict) - Dictionary containing the audience item you want to retrieve. If parameters are not provided, the fallback track will be retrieved.

  • public (boolean) - Boolean flag that allows to retrieve the mastered file from the public bucket. Use this if you want to retrieve a mastered file created using public=True. Default value is False.

  • vast (boolean) - Boolean flag that allows to retrieve the VAST file of your mastered file. The vast flag only works if public is True. Default value is False.

  • endFormat (list) - List of audio formats to be retrieved. Valid formats are: ["wav", "mp3", "mp3_c_128", "flac", "ogg"]

Example:

mastered_files = apiaudio.Mastering.retrieve(
  scriptId="id-1234",
  parameters={"username":"linda", "location":"barcelona"}
)
const masteringResult = await apiaudio.Mastering.retrieve(script["scriptId"]);
console.log(masteringResult);

⬇️download()

Download the mastered files in your preferred folder.

Parameters:

  • scriptId *Required (string) - The script resource ID.

  • parameters (dict) - Dictionary containing the audience item you want to retrieve. If parameters are not provided, the fallback track will be downloaded.

  • destination (string) - The folder destination path. Default is "." (current folder)

  • public (boolean) - Boolean flag that allows to retrieve the mastered file from the public bucket. Use this if you want to retrieve a mastered file created using public=True. Default value is False.

  • vast (boolean) - Boolean flag that allows to retrieve the VAST file of your mastered file. The vast flag only works if public is True. Default value is False.

Example:

mastered_files = apiaudio.Mastering.download(
  scriptId="id-1234",
  parameters={"username":"antonio", "location":"barcelona"}
  destination="."
)

Did this page help you?