if current_file["audio"][-4:] == ".sph":
from sphfile import SPHFile
sph = SPHFile(current_file["audio"])
y = sph.content
sample_rate_ = sph.format["sample_rate"]
if sample_rate is not None and sample_rate_ != sample_rate:
y = librosa.resample(y, sample_rate_, sample_rate)
else:
sample_rate = sample_rate_
else:
After Change
sph = SPHFile(current_file["audio"])
with tempfile.NamedTemporaryFile() as f:
sph.write_wav(f.name)
y, sample_rate = librosa.load(f.name, sr=sample_rate, mono=False)
// all other files
else: