harryjulian commited on
Commit
db6d8fd
·
verified ·
1 Parent(s): 59e83c5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -3
README.md CHANGED
@@ -13,7 +13,7 @@ It's main use case is providing a low footprint decoder for on-device TTS.
13
  ```python
14
  import librosa
15
  import torch
16
- import torchaudio
17
  from torchaudio import transforms as T
18
  from neucodec import NeuCodec, NeuCodecOnnxDecoder
19
 
@@ -29,7 +29,7 @@ with torch.no_grad():
29
  fsq_codes = model.encode_code(y)
30
  # fsq_codes = model.encode_code(librosa.ex("libri1")) # or directly pass your filepath!
31
  print(f"Codes shape: {fsq_codes.shape}")
32
- recon = compiled_model.decode_code(fsq_codes).cpu() # (B, 1, T_24)
33
 
34
- torchaudio.save("reconstructed.wav", recon[0, :, :], 24_000)
35
  ```
 
13
  ```python
14
  import librosa
15
  import torch
16
+ import soundfile as sf
17
  from torchaudio import transforms as T
18
  from neucodec import NeuCodec, NeuCodecOnnxDecoder
19
 
 
29
  fsq_codes = model.encode_code(y)
30
  # fsq_codes = model.encode_code(librosa.ex("libri1")) # or directly pass your filepath!
31
  print(f"Codes shape: {fsq_codes.shape}")
32
+ recon = compiled_model.decode_code(fsq_codes) # (B, 1, T_24)
33
 
34
+ sf.write("reconstructed.wav", recon, 24_000)
35
  ```