Spaces:
Sleeping
Sleeping
File size: 508 Bytes
168b5c0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import librosa
import numpy as np
from scipy.io import wavfile
def audio_convert(in_filename: str,
out_filename: str,
sample_rate: int = 16000):
signal, _ = librosa.load(in_filename, sr=sample_rate)
signal *= 32768.0
signal = np.array(signal, dtype=np.int16)
wavfile.write(
out_filename,
rate=sample_rate,
data=signal
)
return out_filename
if __name__ == "__main__":
pass
|