Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -93,11 +93,12 @@ options, args = parse_args() · 92 unmodified lines | ||
| 93 | 93 | |
| 94 | 94 | filename = options.filename |
| 95 | 95 | samplerate = float(sndfile(filename).samplerate()) |
| 96 | −hopsize = float(options.hopsize) | |
| 97 | −bufsize = float(options.bufsize) | |
| 96 | +hopsize = int(options.hopsize) | |
| 97 | +bufsize = int(options.bufsize) | |
| 98 | +step = float(samplerate)/float(hopsize) | |
| 98 | 99 | threshold = float(options.threshold) |
| 99 | 100 | silence = float(options.silence) |
| 100 | −mintol = float(options.mintol)*samplerate/hopsize | |
| 101 | +mintol = float(options.mintol)*step | |
| 101 | 102 | delay = float(options.delay) |
| 102 | 103 | |
| 103 | 104 | if options.beat: |
| @@ -111,7 +112,7 @@ else: · 7 unmodified lines | ||
| 111 | 112 | # take back system delay |
| 112 | 113 | if delay != 0: |
| 113 | 114 | for i in range(len(onsets)): |
| 114 | − onsets[i] -= delay*samplerate/hopsize | |
| 115 | + onsets[i] -= delay*step | |
| 115 | 116 | |
| 116 | 117 | # prune doubled |
| 117 | 118 | if mintol > 0: |
| @@ -125,7 +126,7 @@ if mintol > 0: · 7 unmodified lines | ||
| 125 | 126 | |
| 126 | 127 | # print times in second |
| 127 | 128 | if options.verbose: |
| 128 | − for i in onsets: print "%f" % (i*hopsize/samplerate) | |
| 129 | + for i in onsets: print "%f" % (i/step) | |
| 129 | 130 | |
| 130 | 131 | if options.cut: |
| 131 | 132 | cutfile(filename,onsets,bufsize=bufsize,hopsize=hopsize) |