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 | filename = options.filename | 94 | filename = options.filename |
| 95 | samplerate = float(sndfile(filename).samplerate()) | 95 | samplerate = float(sndfile(filename).samplerate()) |
| 96 | hopsize = float(options.hopsize) | 96 | hopsize = int(options.hopsize) |
| 97 | bufsize = float(options.bufsize) | 97 | bufsize = int(options.bufsize) |
| 98 | step = float(samplerate)/float(hopsize) | ||
| 98 | threshold = float(options.threshold) | 99 | threshold = float(options.threshold) |
| 99 | silence = float(options.silence) | 100 | silence = float(options.silence) |
| 100 | mintol = float(options.mintol)*samplerate/hopsize | 101 | mintol = float(options.mintol)*step |
| 101 | delay = float(options.delay) | 102 | delay = float(options.delay) |
| 102 | 103 | ||
| 103 | if options.beat: | 104 | if options.beat: |
| @@ -111,7 +112,7 @@ else: · 7 unmodified lines | |||
| 111 | # take back system delay | 112 | # take back system delay |
| 112 | if delay != 0: | 113 | if delay != 0: |
| 113 | for i in range(len(onsets)): | 114 | for i in range(len(onsets)): |
| 114 | onsets[i] -= delay*samplerate/hopsize | 115 | onsets[i] -= delay*step |
| 115 | 116 | ||
| 116 | # prune doubled | 117 | # prune doubled |
| 117 | if mintol > 0: | 118 | if mintol > 0: |
| @@ -125,7 +126,7 @@ if mintol > 0: · 7 unmodified lines | |||
| 125 | 126 | ||
| 126 | # print times in second | 127 | # print times in second |
| 127 | if options.verbose: | 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 | if options.cut: | 131 | if options.cut: |
| 131 | cutfile(filename,onsets,bufsize=bufsize,hopsize=hopsize) | 132 | cutfile(filename,onsets,bufsize=bufsize,hopsize=hopsize) |