-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefaultDataGeneration.py
More file actions
39 lines (32 loc) · 1.02 KB
/
DefaultDataGeneration.py
File metadata and controls
39 lines (32 loc) · 1.02 KB
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
import pickle
from fileinput import input_file
from queue import Queue
from spleeter.separator import Separator
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
global to_process
to_process= Queue()
def enqueue_files(filelist):
for file in filelist:
print(file, "input success")
to_process.put(file)
return
def process(filelist,spl):
enqueue_files(filelist)
A=[]
while not to_process.empty():
file = to_process.get()
print(file, "start process")
res = input_file(file,spl)
print("finish process")
A.append(res)
return A
if __name__=="__main__":
GLOBAL_SPLITTER = Separator('spleeter:2stems', stft_backend='tensorflow', multiprocess=False)
folder_path = 'OriginalSong'
datas = [os.path.join(folder_path, f) for f in os.listdir(folder_path) if f.endswith('.mp3')]
data = process(datas,GLOBAL_SPLITTER)
data.sort(key=lambda x: x.name)
with open(f'./Datas/Defaultlist.dat', 'wb') as file:
pickle.dump(data, file)
del data