Flag of Ukraine
Our /audio/waveform Robot

Generate waveform images from audio

🤖/audio/waveform generates waveform images for your audio files and allows you to change their colors and dimensions.

We recommend that you use an 🤖/audio/encode Step prior to your waveform Step to convert audio files to MP3. This way it is guaranteed that 🤖/audio/waveform accepts your audio file and you can also down-sample large audio files and save some money.

Similarly, if you need the output image in a different format, please pipe the result of this Robot into 🤖/image/resize.

Here is an example waveform image:

Example waveform image

Usage example

Generate a 400×200 waveform in #0099cc color from an uploaded audio file:

{
  "steps": {
    "waveformed": {
      "robot": "/audio/waveform",
      "use": ":original",
      "width": 400,
      "height": 200,
      "outer_color": "0099ccff",
      "center_color": "0099ccff"
    }
  }
}

Parameters

  • use

    String / Array of Strings / Object required

    Specifies which Step(s) to use as input.

    • You can pick any names for Steps except ":original" (reserved for user uploads handled by Transloadit)

    • You can provide several Steps as input with arrays:

      "use": [
        ":original",
        "encoded",
        "resized"
      ]
      

    💡 That’s likely all you need to know about use, but you can view Advanced use cases.

  • output_meta

    Object / Boolean ⋅ default: {}

    Allows you to specify a set of metadata that is more expensive on CPU power to calculate, and thus is disabled by default to keep your Assemblies processing fast.

    For images, you can add "has_transparency": true in this object to extract if the image contains transparent parts and "dominant_colors": true to extract an array of hexadecimal color codes from the image.

    For videos, you can add the "colorspace: true" parameter to extract the colorspace of the output video.

    For audio, you can add "mean_volume": true to get a single value representing the mean average volume of the audio file.

    You can also set this to false to skip metadata extraction and speed up transcoding.

  • format

    String ⋅ default: "image"

    The format of the result file. Can be "image" or "json". If "image" is supplied, a PNG image will be created, otherwise a JSON file.

  • width

    Integer ⋅ default: 256

    The width of the resulting image if the format "image" was selected.

  • height

    Integer ⋅ default: 64

    The height of the resulting image if the format "image" was selected.

  • style

    Integer ⋅ default: 0

    Either a value of 0 or 1, corresponding to using either the legacy waveform tool, or the new tool respectively, with the new tool offering an improved style. Other Robot parameters still function as described, with either tool.

  • antialiasing

    Integer ⋅ default: 0

    Either a value of 0 or 1, corresponding to if you want to enable antialiasing to achieve smoother edges in the waveform graph or not.

  • background_color

    String ⋅ default: "00000000"

    The background color of the resulting image in the "rrggbbaa" format (red, green, blue, alpha), if the format "image" was selected.

  • center_color

    String ⋅ default: "000000ff"

    The color used in the center of the gradient. The format is "rrggbbaa" (red, green, blue, alpha).

  • outer_color

    String ⋅ default: "000000ff"

    The color used in the outer parts of the gradient. The format is "rrggbbaa" (red, green, blue, alpha).

Demos

Related blog posts