Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -85,12 +85,13 @@ options, args = parse_args() · 84 unmodified lines | ||
| 85 | 85 | |
| 86 | 86 | filename = options.filename |
| 87 | 87 | params = taskparams() |
| 88 | −#params.samplerate = float(sndfile(filename).samplerate()) | |
| 88 | +params.samplerate = float(sndfile(filename).samplerate()) | |
| 89 | 89 | params.hopsize = int(options.hopsize) |
| 90 | 90 | params.bufsize = int(options.bufsize) |
| 91 | −#params.step = float(samplerate)/float(hopsize) | |
| 91 | +params.step = params.samplerate/float(params.hopsize) | |
| 92 | 92 | params.threshold = float(options.threshold) |
| 93 | 93 | params.silence = float(options.silence) |
| 94 | +params.verbose = options.verbose | |
| 94 | 95 | #mintol = float(options.mintol)*step |
| 95 | 96 | # default take back system delay |
| 96 | 97 | if options.delay: delay = float(options.delay) |
| @@ -100,27 +101,14 @@ if options.note: · 3 unmodified lines | ||
| 100 | 101 | exit("not implemented yet") |
| 101 | 102 | |
| 102 | 103 | |
| 103 | −pitch = [] | |
| 104 | +wplot,oplots = [],[] | |
| 104 | 105 | modes = options.mode.split(',') |
| 105 | 106 | for i in range(len(modes)): |
| 107 | + pitch = [] | |
| 106 | 108 | params.pitchmode = modes[i] |
| 107 | − dotask = taskpitch | |
| 108 | − #pitch.append(getpitch(filename, #threshold, | |
| 109 | − # mode=mode[i], | |
| 110 | − # omode=options.omode, | |
| 111 | − # bufsize=bufsize,hopsize=hopsize, | |
| 112 | − # silence=silence)) | |
| 113 | − filetask = dotask(filename,params=params) | |
| 114 | − pitch.append(filetask.compute_all()) | |
| 115 | − for j in range(len(pitch[i])): | |
| 116 | − if pitch[i][j] > 10000 or pitch[i][j] < 40: | |
| 117 | − pitch[i][j] = 0.; | |
| 109 | + filetask = taskpitch(filename,params=params) | |
| 110 | + pitch = filetask.compute_all() | |
| 111 | + #print filetask.eval(pitch[i]) | |
| 112 | + filetask.plot(pitch,wplot,oplots) | |
| 118 | 113 | |
| 119 | − if options.verbose: | |
| 120 | − for j in range(len(pitch[i])): | |
| 121 | − print "%f\t" % (j/params.step), | |
| 122 | − print "%f\t" % pitch[i][j], | |
| 123 | ||
| 124 | − | |
| 125 | − if options.plot: | |
| 126 | − filetask.plot(pitch,outplot=options.outplot) | |
| 114 | +filetask.plotplot(wplot,oplots,outplot=options.outplot) | |