pplantinga commited on
Commit
e722b6f
1 Parent(s): 0c6c93f

Add example wav and update code example

Browse files
Files changed (2) hide show
  1. README.md +9 -1
  2. example.wav +0 -0
README.md CHANGED
@@ -38,13 +38,21 @@ Please notice that we encourage you to read our tutorials and learn more about
38
  To use the mimic-loss-trained model for enhancement, use the following simple code:
39
 
40
  ```python
 
41
  from speechbrain.pretrained import SpectralMaskEnhancement
42
 
43
  enhance_model = SpectralMaskEnhancement.from_hparams(
44
  source="speechbrain/metricgan-plus-voicebank",
45
  savedir="pretrained_models/metricgan-plus-voicebank",
46
  )
47
- enhance_model.enhance_file("/path/to/file.wav")
 
 
 
 
 
 
 
48
  ```
49
 
50
  ## Referencing MetricGAN+
 
38
  To use the mimic-loss-trained model for enhancement, use the following simple code:
39
 
40
  ```python
41
+ import torch
42
  from speechbrain.pretrained import SpectralMaskEnhancement
43
 
44
  enhance_model = SpectralMaskEnhancement.from_hparams(
45
  source="speechbrain/metricgan-plus-voicebank",
46
  savedir="pretrained_models/metricgan-plus-voicebank",
47
  )
48
+
49
+ # Load and add fake batch dimension
50
+ noisy = enhance_model.load_audio(
51
+ "speechbrain/metricgan-plus-voicebank/example.wav"
52
+ ).unsqueeze(0)
53
+
54
+ # Add relative length tensor
55
+ enhance_model.enhance_batch(noisy, lengths=torch.tensor([1.]))
56
  ```
57
 
58
  ## Referencing MetricGAN+
example.wav ADDED
Binary file (276 kB). View file