esc
Start typing to search the docs
Menu

Asset­Audio

⚠️ This type is unstable and may change significantly in a way that the data won't be backwards compatible. An audio file, stored as-is (.aac, .flac, .m4a, .mp3, .ogg, .wav).

The audio starts playing at the time it was logged, so log it on a temporal timeline (duration or timestamp) at the point where playback should begin. The viewer plays it while time is playing, in an views.AudioView, which also shows the waveform.

The viewer can also open audio files directly, like any other supported file.

Streaming raw PCM samples (e.g. from a microphone) is not supported yet. As a workaround, encode the samples as an in-memory WAV file and log that. For live audio, encode short segments, and log each segment at the time it starts. To plot the raw signal instead of playing it, log the samples as archetypes.Scalars.

Fields

Required

Can be shown in

Example

Simple audio asset

"""Log an audio file at t=0 on the `time` timeline."""

import sys

import rerun as rr

if len(sys.argv) < 2:
    print(f"Usage: {sys.argv[0]} <path_to_audio.[aac|flac|m4a|mp3|ogg|wav]>")
    sys.exit(1)

rr.init("rerun_example_asset_audio", spawn=True)

rr.set_time("time", duration=0.0)
rr.log("audio", rr.AssetAudio(path=sys.argv[1]))