Overview

The Audio Block is used to define an audio sample for use with other blocks. It can also convert a binary type into an audio type. The block can either take an input that represents the audio data or use an audio file specified in the block’s settings.

Inputs

Data
binary

The binary data representing the audio. This input is only available if the “Use Data Input” setting is enabled.

Outputs

Audio Data
audio

The audio data converted into a format that can be used by other blocks that accept audio data as input. Contains a Uint8Array of the audio data.

Editor Settings

Audio File
file

The audio file to be used as the audio data. This file will be stored as a base64-encoded string and converted to a Uint8Array during execution.

Use Data Input
boolean
default:false

If enabled, the block will use the data from the “Data” input port as the audio data. If disabled, the block will use the data from the audio file specified in the “Audio File” setting.

Width
number
default:300

The width of the block in pixels.

Example: Using an Audio Block with a File

  1. Add an Audio Block to your flow.
  2. In the block’s settings, click “Pick File” and select an audio file from your local file system.

Error Handling

The Audio Block will throw an error if:

  • The “Use Data Input” setting is enabled but no data is provided to the “Data” input port.
  • The “Use Data Input” setting is disabled but no audio file is specified in the “Audio File” setting.
  • The provided audio data (either from the “Data” input or the specified audio file) cannot be converted to a Uint8Array.

Ensure that the audio data is in a format that can be converted to a Uint8Array to avoid errors.

FAQ

See Also