diff --git a/src/tadam.py b/src/tadam.py index 3ca2f15..4a32321 100755 --- a/src/tadam.py +++ b/src/tadam.py @@ -22,6 +22,8 @@ import os import sys import numpy as np import getopt +from datetime import datetime +from datetime import timedelta verbose = False @@ -105,10 +107,14 @@ def chunk(outfolder, length): for i in range(sections): if verbose: print( - f"\t {str(i).zfill(len(str(sections)))}/{sections} \t {infile}") - filename = infile.replace('.wav', f'_{str(i).zfill(3)}.wav') + f"\t {str(i + 1).zfill(len(str(sections)))}/{sections} \t {infile}") + temp = data[i*samplerate*length: i * samplerate*length+samplerate*length] + + 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) except: