Update audio loader docstrings

This commit is contained in:
mbsantiago 2026-03-08 17:02:35 +00:00
parent ce952e364b
commit bfc88a4a0f

View File

@ -74,9 +74,9 @@ class AudioLoader(Protocol):
Returns Returns
------- -------
xr.DataArray np.ndarray
The loaded and preprocessed audio waveform. Typically loads only The loaded and preprocessed audio waveform as a 1-D NumPy
the first channel. array. Typically loads only the first channel.
Raises Raises
------ ------
@ -105,9 +105,10 @@ class AudioLoader(Protocol):
Returns Returns
------- -------
xr.DataArray np.ndarray
The loaded and preprocessed audio waveform for the specified clip The loaded and preprocessed audio waveform for the specified
duration. Typically loads only the first channel. clip duration as a 1-D NumPy array. Typically loads only the
first channel.
Raises Raises
------ ------
@ -147,4 +148,21 @@ class PreprocessorProtocol(Protocol):
def process_spectrogram(self, spec: torch.Tensor) -> torch.Tensor: ... def process_spectrogram(self, spec: torch.Tensor) -> torch.Tensor: ...
def process_numpy(self, wav: np.ndarray) -> np.ndarray: def process_numpy(self, wav: np.ndarray) -> np.ndarray:
"""Run the full preprocessing pipeline on a NumPy waveform.
This default implementation converts the array to a
``torch.Tensor``, calls :meth:`__call__`, and converts the
result back to a NumPy array. Concrete implementations may
override this for efficiency.
Parameters
----------
wav : np.ndarray
Input waveform as a 1-D NumPy array.
Returns
-------
np.ndarray
Preprocessed spectrogram as a NumPy array.
"""
return self(torch.tensor(wav)).numpy() return self(torch.tensor(wav)).numpy()