core

Audio Embeddings

AudioArray

AudioArray is the main audio representation in auditus. It stores audio data as a NumPy array and the sample rate. It provides utilities for displaying and parsing audio.


source

AudioArray

 AudioArray (a:numpy.ndarray, sr:int)

Representation for audio data.

Here is an example of a pink noise signal.

aa = AudioArray(np.cumsum(np.random.normal(0, 0.01, 32_000*10)), 32_000)
aa
AudioArray(a=array([-0.00378457, -0.01689089, -0.01994183, ...,  2.81427755,
        2.81123667,  2.8191368 ]), sr=32000)
aa.audio()
aa[:5], aa.sr
(array([-0.00378457, -0.01689089, -0.01994183, -0.0144542 , -0.02069945]),
 32000)
test_eq(len(aa), 320000)
test_eq(aa.sr, 32_000)
test_eq(aa.shape, (320000,))