Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -16,7 +16,7 @@ def parse_args(): · 15 unmodified lines | |||
| 16 | action="store", dest="filename", | 16 | action="store", dest="filename", |
| 17 | help="input sound file") | 17 | help="input sound file") |
| 18 | parser.add_option("-m","--mode", | 18 | parser.add_option("-m","--mode", |
| 19 | action="store", dest="mode", default=['dual'], | 19 | action="store", dest="mode", default='dual', |
| 20 | help="onset detection mode [default=dual] \ | 20 | help="onset detection mode [default=dual] \ |
| 21 | complexdomain|hfc|phase|specdiff|energy|kl|mkl|dual") | 21 | complexdomain|hfc|phase|specdiff|energy|kl|mkl|dual") |
| 22 | parser.add_option("-B","--bufsize", | 22 | parser.add_option("-B","--bufsize", |
| @@ -91,20 +91,22 @@ params.mintol = float(options.mintol) · 68 unmodified lines | |||
| 91 | if options.delay: delay = float(options.delay) | 91 | if options.delay: delay = float(options.delay) |
| 92 | else: delay = 3./params.step | 92 | else: delay = 3./params.step |
| 93 | 93 | ||
| 94 | if options.beat: | ||
| 95 | #onsets = getbeats(filename,threshold,silence,mode=options.mode) | ||
| 96 | exit("not implemented yet") | ||
| 97 | elif options.silencecut: | ||
| 98 | onsets = getsilences(filename,hopsize=hopsize,silence=silence) | ||
| 99 | elif options.plot: params.storefunc=True | ||
| 100 | else: params.storefunc=False | ||
| 101 | 94 | ||
| 102 | lonsets, lofunc = [], [] | 95 | lonsets, lofunc = [], [] |
| 103 | modes = options.mode.split(',') | 96 | modes = options.mode.split(',') |
| 104 | for i in range(len(modes)): | 97 | for i in range(len(modes)): |
| 105 | 98 | ||
| 106 | params.onsetmode = modes[i] | 99 | params.onsetmode = modes[i] |
| 107 | filetask = taskonset(filename,params=params) | 100 | dotask = taskonset |
| 101 | if options.beat: | ||
| 102 | dotask = taskbeat | ||
| 103 | elif options.silencecut: | ||
| 104 | dotask = tasksilence | ||
| 105 | elif options.plot: | ||
| 106 | params.storefunc=True | ||
| 107 | else: | ||
| 108 | params.storefunc=False | ||
| 109 | filetask = dotask(filename,params=params) | ||
| 108 | onsets = filetask.compute_all() | 110 | onsets = filetask.compute_all() |
| 109 | ofunc = filetask.ofunc | 111 | ofunc = filetask.ofunc |
| 110 | #onsets, ofunc = getonsets(filename,threshold,silence, | 112 | #onsets, ofunc = getonsets(filename,threshold,silence, |
| @@ -133,8 +135,7 @@ for i in range(len(modes)): · 22 unmodified lines | |||
| 133 | 135 | ||
| 134 | # print times in second | 136 | # print times in second |
| 135 | if options.verbose: | 137 | if options.verbose: |
| 136 | print modes[i] | 138 | #print modes[i] |
| 137 | maxonset = 0 | ||
| 138 | for i in range(len(onsets)): | 139 | for i in range(len(onsets)): |
| 139 | print onsets[i]*params.step | 140 | print onsets[i]*params.step |
| 140 | 141 | ||