read_audio()

audinterface.utils.read_audio(file, *, start=None, end=None, root=None)[source]

Reads (segment of an) audio file.

Parameters
Return type

Tuple[ndarray, int]

Returns

  • array with signal values in shape (channels, samples)

  • sampling rate in Hz

Examples

>>> import audb
>>> media = audb.load_media(
...     "emodb",
...     "wav/03a01Fa.wav",
...     version="1.3.0",
...     verbose=False,
... )
>>> signal, sampling_rate = read_audio(media[0], end=pd.Timedelta(0.01, unit="s"))
>>> signal.shape
(1, 160)