cough_ai / utils /preprocessing.py
QnxprU69yCNg8XJ
we can start now
44626f7
raw
history blame contribute delete
258 Bytes
import torchaudio
def load_audio(file_path, target_sr=16000):
waveform, sr = torchaudio.load(file_path)
if sr != target_sr:
waveform = torchaudio.transforms.Resample(orig_freq=sr, new_freq=target_sr)(waveform)
return waveform, target_sr