def upsample_wav(file, rate): tfm = sox.Transformer() tfm.rate(rate) out_path = file.split('.wav')[0] + "_hr.wav" tfm.build(file, out_path) return out_path