Fix example by switching to "enhance_batch"

#3
by pplantinga - opened
Files changed (1) hide show
  1. README.md +5 -2
README.md CHANGED
@@ -67,10 +67,13 @@ enhance_model = SpectralMaskEnhancement.from_hparams(
67
  source="speechbrain/mtl-mimic-voicebank",
68
  savedir="pretrained_models/mtl-mimic-voicebank",
69
  )
70
- enhanced = enhance_model.enhance_file("speechbrain/mtl-mimic-voicebank/example.wav")
 
 
 
71
 
72
  # Saving enhanced signal on disk
73
- torchaudio.save('enhanced.wav', enhanced.unsqueeze(0).cpu(), 16000)
74
  ```
75
 
76
  The system is trained with recordings sampled at 16kHz (single channel).
 
67
  source="speechbrain/mtl-mimic-voicebank",
68
  savedir="pretrained_models/mtl-mimic-voicebank",
69
  )
70
+ noisy = enhance_model.load_audio("speechbrain/mtl-mimic-voicebank/example.wav")
71
+
72
+ # Add batch dimension and enhance
73
+ enhanced = enhance_model.enhance_batch(noisy.unsqueeze(0))
74
 
75
  # Saving enhanced signal on disk
76
+ torchaudio.save('enhanced.wav', enhanced.cpu(), 16000)
77
  ```
78
 
79
  The system is trained with recordings sampled at 16kHz (single channel).