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" (default), "flac", "ogg", "mp3_very_low", "mp3_low", "mp3_medium", "mp3_high", "mp3_very_high"]

  • 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 variable 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.

  • sectionProperties (dict) - This variable takes a dict as its input, whereby each key has the name of the section and its value is another dict with the properties corresponding to that section. We currently support two properties per section: (see more here)
    EndAt: (float) the time in seconds that this section should end at
    Justify: (text) [optional] how the audio content of this section should be justified.

  • matchVoice(boolean) - boolean flag that levels the synthetic speech part with your recorded speech file (see more here). Default value is False

  • channels (int) - Specifies the number of channels in the mastered file. You can either use 1 for mono or 2 for stereo (default)

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);