denote.util¶
Audio loading and utility functions for denote.
Functions
|
Ensure audio is available as a file path. |
|
Load audio from a file path or validate an existing array. |
- denote.util.ensure_file_path(audio, *, sr=None)[source]¶
Ensure audio is available as a file path.
If audio is already a path, return it as a string. If it’s an array, write to a temporary WAV file and return the path.
- Return type:
- denote.util.load_audio(audio, *, sr=None, mono=True, target_sr=None)[source]¶
Load audio from a file path or validate an existing array.
- Parameters:
- Return type:
- Returns:
Tuple of (audio_array, sample_rate).
- Raises:
ValueError – If audio is an array and sr is not provided.
FileNotFoundError – If audio is a path that doesn’t exist.