Spaces:
Sleeping
Sleeping
Download tasks/lib/preprocessing.py from electroma/submission-template: direct link, hf CLI and curl.
- Browser
- Download file 251 Bytes
-
https://huggingface.co/spaces/electroma/submission-template/resolve/main/tasks/lib/preprocessing.py
- Command line
-
hf download hf://spaces/electroma/submission-template/tasks/lib/preprocessing.py
-
curl -L -o preprocessing.py https://huggingface.co/spaces/electroma/submission-template/resolve/main/tasks/lib/preprocessing.py
251 Bytes
| import librosa | |
| import numpy as np | |
| def resample_audio(raw_wave: np.ndarray, orig_sr: int, target_sr: int) -> np.ndarray: | |
| if orig_sr == target_sr: | |
| return raw_wave | |
| return librosa.resample(raw_wave, orig_sr=orig_sr, target_sr=target_sr) | |