forked from v3ucn/DH_live_webui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel_test.py
More file actions
45 lines (24 loc) · 866 Bytes
/
Copy pathmodel_test.py
File metadata and controls
45 lines (24 loc) · 866 Bytes
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
import torch
from pydub import AudioSegment
import numpy as np
def convert_wav(input_file):
# 加载音频文件
audio = AudioSegment.from_wav(input_file)
# 转换为单声道
audio = audio.set_channels(1)
# 设置采样率为16kHz
audio = audio.set_frame_rate(16000)
# 设置采样位数为16位
audio = audio.set_sample_width(2) # 2 bytes = 16 bits
# 导出处理后的音频
audio.export("new.wav", format="wav")
return "new.wav"
if __name__ == '__main__':
convert_wav("edge_tts.wav")
# checkpoint = torch.load("checkpoint/epoch_160.pth")
# #print(checkpoint['state_dict'].keys())
# print(checkpoint['state_dict']["net_g"].keys())
# print(3333)
# checkpoint = torch.load("checkpoint/render.pth")
# print(checkpoint.keys())
# print(checkpoint['state_dict']["net_g"].keys())