feat(audio): automatically convert audio to mono

This commit is contained in:
Enno Hermann 2024-11-17 01:29:30 +01:00
parent 627bbe4150
commit 48f5be2ccb
1 changed files with 3 additions and 0 deletions

View File

@ -427,6 +427,9 @@ def load_wav(*, filename: str, sample_rate: int = None, resample: bool = False,
else:
# SF is faster than librosa for loading files
x, _ = sf.read(filename)
if x.ndim != 1:
logger.warning("Found multi-channel audio. Converting to mono: %s", filename)
x = librosa.to_mono(x)
return x