669
669
time_prefix = cur_ctime.strftime('%Y-%m-%d-%H-%M-%S-')
674
rawfile = time_prefix + 'screen2log.raw'
675
outfile = time_prefix + 'screen2log.wav'
676
# output = wave.open(rawfile, 'wb')
677
output = open(rawfile, 'wb')
681
for num, infile in enumerate(wav_filenames):
683
w = wave.open(infile, 'rb')
685
channels = w.getnchannels()
686
bites = w.getsampwidth()*8
687
rate = w.getframerate()
688
toolsdir = self.toolsdir
690
r'%(toolsdir)s\sox\sox.exe -t raw '
691
' -c %(channels)d -r %(rate)d -b %(bites)d '
692
' -e signed-integer "%(rawfile)s" '
693
' -t w64 "%(outfile)s" '
697
# output.setparams(w.getparams())
698
# normalnumframes = w.getnframes()
699
numframes = w.getnframes()
700
#output.writeframesraw(w.readframes(numframes))
701
output.write(w.readframes(numframes))
702
print 'process ', infile
705
print 'skip ', infile
713
def build_screen2log_wav2(self, directory):
715
Write AVS-script for a bunch of small wav files
718
re_s2l = re.compile("\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d\[(?P<slot>\d\d\d)]\.wav$")
719
for root, _dirnames, filenames in os.walk(directory):
720
for filename in filenames:
721
m = re_s2l.match(filename)
723
wav_filenames.append(os.path.join(root, filename))
726
if not wav_filenames:
729
wav_filenames = wav_filenames[:10000]
731
cur_ctime = ut.guess_creation_time_by_name(wav_filenames[0])
735
time_prefix = cur_ctime.strftime('%Y-%m-%d-%H-%M-%S-')
671
737
sourcewavavslines = ['function screen2log_audio(){ ']
672
738
for line, wav in enumerate(wav_filenames):