Use the vessl.Audio class to log audio data. This takes the audio data and saves it as a local WAV file in the vessl-media/audio directory with randomly generated names.

ParameterDescription
data_or_path

Supported types - numpy.ndarray : the audio data

- str: the audio path

sample_rateThe sample rate of the audio file. Required if the numpy.ndarray of audio data is provided as data_or_path
captionLabel of the given audio

numpy.ndarray

import vessl
import soundfile as sf

audio_path = "sample.wav"
data, sample_rate = sf.read(audio_path)


# Sample rate is required if numpy.ndarray is provided 
vessl.log(
  payload={
    "test-audio": [
      vessl.Audio(data, sample_rate=sample_rate, caption="audio with data example")
    ]
  }
)

str

import vessl 

vessl.log(
  payload={
    "test-audio": [
      vessl.Audio(audio_path, caption="audio with path example")
    ]
  }
)