audio-electroma / tasks /lib /preprocessing.py
Arjea's picture
To compute spectrograms and resample audio wave
848403b
raw
history blame contribute delete
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)