diff --git a/enhancement.py b/enhancement.py index 4da78b809a9e8e094e7e6041c7649b7ea6617247..f7af7209c2604b504a0ef9d0476c5aecea088756 100644 --- a/enhancement.py +++ b/enhancement.py @@ -47,15 +47,15 @@ if __name__ == '__main__': # Enhance files for noisy_file in tqdm(noisy_files): - filename = noisy_file.split('/')[-1] - filename = noisy_file.replace(args.test_dir, "")[1:] # Remove the first character which is a slash - + filename = noisy_file.replace(args.test_dir, "") + filename = filename[1:] if filename.startswith("/") else filename + # Load wav y, sr = load(noisy_file) # Resample if necessary if sr != target_sr: - y = resample(y, orig_sr=sr, target_sr=target_sr) + y = torch.tensor(resample(y.numpy(), orig_sr=sr, target_sr=target_sr)) T_orig = y.size(1)