File size: 1,387 Bytes
17263d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import argparse

from gradio_client import Client, handle_file
import numpy as np
from scipy.io import wavfile


def get_args():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--filename1",
        default=r"E:\牛信文档\语音克隆\多语种语音克隆\voice\英语\English_1.wav",
        type=str,
    )
    parser.add_argument(
        "--filename2",
        default=r"E:\牛信文档\语音克隆\多语种语音克隆\voice\英语\xtts_v2_english_2.wav",
        type=str,
    )
    parser.add_argument(
        "--filename3",
        default=r"E:\牛信文档\语音克隆\多语种语音克隆\voice\英语\English_3.wav",
        type=str,
    )
    args = parser.parse_args()
    return args


def main():
    args = get_args()

    client = Client("http://10.75.27.247:7861/")
    new_filename2, _ = client.predict(
        audio_t=handle_file(args.filename2),
        radio=1,
        decibel=0,
        reference=handle_file(args.filename3),
        engine="by_ffmpy_by_db",
        api_name="/when_click_change_volume"
    )

    _, signal1 = wavfile.read(args.filename1)
    _, signal2 = wavfile.read(new_filename2)
    _, signal3 = wavfile.read(args.filename3)

    signal = np.concat([signal1, signal2, signal3], axis=0)
    print(signal.shape)
    return


if __name__ == '__main__':
    main()