freevc plugin
Browse files
README.md
CHANGED
@@ -33,7 +33,37 @@ pip install -r requirements.txt
|
|
33 |
|
34 |
Then you can use the model with the following code:
|
35 |
|
36 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
```python
|
39 |
import torch
|
|
|
33 |
|
34 |
Then you can use the model with the following code:
|
35 |
|
36 |
+
- DreamVoice Plugin for OpenVoice (DreamVG + FreeVC)
|
37 |
+
|
38 |
+
```python
|
39 |
+
import torch
|
40 |
+
import librosa
|
41 |
+
import soundfile as sf
|
42 |
+
from dreamvoice import DreamVoice_Plugin
|
43 |
+
from dreamvoice.freevc_wrapper import get_freevc_models, convert
|
44 |
+
|
45 |
+
freevc, cmodel, hps = get_freevc_models('ckpts_freevc/', 'dreamvoice/', 'cuda')
|
46 |
+
device = 'cuda'
|
47 |
+
|
48 |
+
# init dreamvoice
|
49 |
+
dreamvoice = DreamVoice_Plugin(config='plugin_freevc.yaml', device=device)
|
50 |
+
|
51 |
+
# generate speaker
|
52 |
+
prompt = "old female's voice, deep and dark"
|
53 |
+
target_se = dreamvoice.gen_spk(prompt)
|
54 |
+
|
55 |
+
# content source
|
56 |
+
source_path = 'examples/test1.wav'
|
57 |
+
audio_clip = librosa.load(source_path, sr=16000)[0]
|
58 |
+
audio_clip = torch.tensor(audio_clip).unsqueeze(0).to(device)
|
59 |
+
|
60 |
+
content = cmodel(audio_clip).last_hidden_state.transpose(1, 2).to(device)
|
61 |
+
|
62 |
+
output, out_sr = convert(freevc, content, target_se)
|
63 |
+
sf.write('output.wav', output, out_sr)
|
64 |
+
```
|
65 |
+
|
66 |
+
- DreamVoice Plugin for OpenVoice (DreamVG + [Opnevoice](https://github.com/myshell-ai/OpenVoice))
|
67 |
|
68 |
```python
|
69 |
import torch
|