Waveform.to_numpy()¶
- Waveform.to_numpy()¶
Returns the waveform as a 2D
numpy.ndarray
array with shape(frames, channels)
Babycat internally stores decoded audio as a Rust
Vec<f32>
. This method converts theVec<f32>
into a NumPy array. Babycat does not internally cache the NumPy array, so avoid calling this method multiple times on the sameWaveform
.Babycat is also designed to release the Python Global Interpreter Lock (GIL) when decoding audio into a
Vec<f32>
, but Babycat re-acquires the GIL when converting the theVec<f32>
into a NumPy array.- Returns
A NumPy array with frames as the first axis and channels as the second axis.
- Return type