Compare commits

..

2 Commits

View File

@ -97,9 +97,7 @@ def chunk(outfolder, length):
for file in os.listdir(outfolder):
infile = os.path.join(outfolder, file)
extension = infile.split(".")[-1]
date = infile.split("_")[-2]
time = infile.split("_")[-1].split(".")[0]
time = date + "_" + time
if not extension in ["wav", "WAV"]:
continue
try:
@ -118,8 +116,8 @@ def chunk(outfolder, length):
temp = data[i*samplerate*length: i *
samplerate*length+samplerate*length]
time_file = datetime.strptime(time, "%Y%m%d_%H%M%S") + timedelta(seconds = 5 * i)
time_file = str(time_file.__format__("%Y%m%d_%H%M%S"))
time_file = datetime.strptime(time, "%H%M%S") + timedelta(seconds = 5 * i)
time_file = str(time_file.time().__format__("%H%M%S"))
filename = infile.replace(f'{time}.wav', f'{time_file}_000.wav')
try:
sf.write(filename, temp, samplerate)