-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspleeter.py
79 lines (71 loc) · 2.8 KB
/
spleeter.py
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# spleeter separate -i 1.mp3 -p spleeter:2stems -o output
import os
import shutil
#人声背景声分离
# out_path = "output_normal/"
# if not os.path.exists(out_path):
# os.mkdir(out_path)
# dirs_list = os.listdir(out_path)
# for root, dirs, files in os.walk("normal/"):
# # count = 0
# for file in files:
# file_name = file.split('.')[0]
# if file_name in dirs_list:
# print(file_name + "存在")
# # count = count +1
# else:
# audio_name = root + file
# str = "spleeter separate -i " + audio_name + " -p spleeter:2stems -o " + out_path
# val = os.system(str)
#
# dirs_list = os.listdir("output_robot/")
# for root, dirs, files in os.walk("robot/"):
# for file in files:
# file_name = file.split('.')[0]
# if file_name in dirs_list:
# print(file_name + "存在")
# else:
# audio_name = root + file
# str = "spleeter separate -i " + audio_name + " -p spleeter:2stems -o output_robot"
# val = os.system(str)
# val = os.system("spleeter separate -i 1.mp3 -p spleeter:2stems -o output")
# print(val)
# import spleeter
# spleeter separate -i normal/226337.wav -p spleeter:2stems -o output
#找出分离之后的人声
if not os.path.exists("output_temp_copy"):
os.makedirs("output_temp_copy")
for root, dirs, files in os.walk("output_temp/"):
for dir in dirs:
path = root + dir
for root1, dirs1, files1 in os.walk(path + "/"):
for file1 in files1:
if file1 == "vocals.wav":
input_file = path + "/" + file1
output_file = "output_temp_copy/" + dir + "_deal.wav"
shutil.copy(input_file, output_file)
print("deno")
# if not os.path.exists("output_normal_copy"):
# os.makedirs("output_normal_copy")
# for root, dirs, files in os.walk("output_normal/"):
# for dir in dirs:
# path = root + dir
# for root1, dirs1, files1 in os.walk(path + "/"):
# for file1 in files1:
# if file1 == "vocals.wav":
# input_file = path + "/" + file1
# output_file = "output_normal_copy/" + dir + "_deal.wav"
# shutil.copy(input_file, output_file)
# print("deno")
# if not os.path.exists("output_robot_copy"):
# os.makedirs("output_robot_copy")
# for root, dirs, files in os.walk("output_robot/"):
# for dir in dirs:
# path = root + dir
# for root1, dirs1, files1 in os.walk(path + "/"):
# for file1 in files1:
# if file1 == "vocals.wav":
# input_file = path + "/" + file1
# output_file = "output_robot_copy/" + dir + "_deal.wav"
# shutil.copy(input_file, output_file)
# print("deno")