Skip to main content

<Audio>

Category: Object tag

The Audio tag plays audio and shows its waveform. Use for audio annotation tasks where you want to label regions of audio, see the waveform, and manipulate audio during annotation.

Use with the following data types: audio

Attributes​

AttributeTypeRequiredDefaultDescription
namestringyes—Name of the element
valuestringyes—Data field containing path or a URL to the audio.
defaultspeedstringno1Default speed level (from 0.5 to 2).
defaultscalestringno1Audio pane default y-scale for waveform.
defaultzoomstringno1Default zoom level for waveform. (from 1 to 1500).
defaultvolumestringno1Default volume level (from 0 to 1).
hotkeystringno—Hotkey used to play or pause audio.
syncstringno—Object name to sync with.
heightstringno96Total height of the audio player.
waveheightstringno32Minimum height of a waveform when in splitchannels mode with multiple channels to display.
spectrogramtrue,falsenofalseDetermines whether an audio spectrogram is automatically displayed upon loading.
splitchannelstrue,falsenofalseDisplay multiple audio channels separately, if the audio file has more than one channel. (NOTE: Requires more memory to operate.)
decoderstringnowebaudioDecoder type to use to decode audio data. ("webaudio", "ffmpeg", or "none" for no decoding - provides fast loading for large files but disables waveform visualization)
playerstringnohtml5Player type to use to play audio data. ("html5" or "webaudio")

Long recordings: a waveform outline​

To draw its waveform the player downloads and decodes the whole recording, which is slow for a long file and can run a phone out of memory. A task can carry a waveform outline instead: a small file of the recording's highs and lows, worked out ahead of time. With one, the player draws the waveform from the outline at once and streams the sound as it plays.

Put the outline's address in the task beside the audio field, under the field's name followed by __waveform:

{
"audio": "s3://my-bucket/interview.wav",
"audio__waveform": "https://example.org/outlines/interview.json"
}

The address answers JSON:

{ "rate": 100, "data": "<base64>" }

data is signed bytes (-127 to 127), a low then a high for each slice of the recording, base64-encoded; rate is how many of those values there are for one second of sound (100 means fifty slices a second). The address must be readable by the browser of the person labeling.

With an outline the tag behaves as with decoder="none": no spectrogram and no separate channels, since the file itself is not decoded. Segments, playback and seeking work as usual.

Examples​

Play audio on the labeling interface​

<View>
<Audio name="audio" value="$audio" />
</View>

Play audio with multichannel support​

<View>
<Audio name="audio" value="$audio" splitchannels="true" />
</View>

Audio classification​

<View>
<Audio name="audio" value="$audio" />
<Choices name="ch" toName="audio">
<Choice value="Positive" />
<Choice value="Negative" />
</Choices>
</View>

Audio transcription​

<View>
<Audio name="audio" value="$audio" />
<TextArea name="ta" toName="audio" />
</View>

Labeling configuration to label regions of audio and rate the audio sample​

<View>
<Labels name="lbl-1" toName="audio-1">
<Label value="Guitar" />
<Label value="Drums" />
</Labels>
<Rating name="rate-1" toName="audio-1" />
<Audio name="audio-1" value="$audio" />
</View>

Sync with video​

<View>
<Video name="video-1" value="$video" sync="audio-1" />
<Labels name="lbl-1" toName="audio-1">
<Label value="Guitar" />
<Label value="Drums" />
</Labels>
<Audio name="audio-1" value="$video" sync="video-1" />
</View>

Sync with paragraphs​

<View>
<Labels name="lbl-1" toName="audio-1">
<Label value="Guitar" />
<Label value="Drums" />
</Labels>
<Audio name="audio-1" value="$audio" sync="txt-1" />
<Paragraphs audioUrl="$audio" sync="audio-1" name="txt-1" value="$text" layout="dialogue" showplayer="true" />
</View>

Also accepted as <AudioPlus> — a legacy alias of the same tag.