From 0fe9aab4da39efa4585fccb5e3d931389f7ee592 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Wed, 1 Mar 2006 03:18:18 +0000 Subject: [PATCH] simplify aubiopitch simplify aubiopitch --- python/aubiopitch | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/python/aubiopitch b/python/aubiopitch index 4eecdcc2..487f06e2 100755 --- a/python/aubiopitch +++ b/python/aubiopitch @@ -85,12 +85,13 @@ options, args = parse_args() filename = options.filename params = taskparams() -#params.samplerate = float(sndfile(filename).samplerate()) +params.samplerate = float(sndfile(filename).samplerate()) params.hopsize = int(options.hopsize) params.bufsize = int(options.bufsize) -#params.step = float(samplerate)/float(hopsize) +params.step = params.samplerate/float(params.hopsize) params.threshold = float(options.threshold) params.silence = float(options.silence) +params.verbose = options.verbose #mintol = float(options.mintol)*step # default take back system delay if options.delay: delay = float(options.delay) @@ -100,27 +101,14 @@ if options.note: exit("not implemented yet") -pitch = [] +wplot,oplots = [],[] modes = options.mode.split(',') for i in range(len(modes)): + pitch = [] params.pitchmode = modes[i] - dotask = taskpitch - #pitch.append(getpitch(filename, #threshold, - # mode=mode[i], - # omode=options.omode, - # bufsize=bufsize,hopsize=hopsize, - # silence=silence)) - filetask = dotask(filename,params=params) - pitch.append(filetask.compute_all()) - for j in range(len(pitch[i])): - if pitch[i][j] > 10000 or pitch[i][j] < 40: - pitch[i][j] = 0.; + filetask = taskpitch(filename,params=params) + pitch = filetask.compute_all() + #print filetask.eval(pitch[i]) + filetask.plot(pitch,wplot,oplots) - if options.verbose: - for j in range(len(pitch[i])): - print "%f\t" % (j/params.step), - print "%f\t" % pitch[i][j], - print - - if options.plot: - filetask.plot(pitch,outplot=options.outplot) +filetask.plotplot(wplot,oplots,outplot=options.outplot) -- 2.26.2