ref: ada5bafca49cca061545a85ec525fe180cbce1df
parent: c32976a545f1d55f72bb57fecd6bdc7978a0e19f
author: Paul Brossier <piem@altern.org>
date: Thu Dec 22 11:57:50 EST 2005
add beat function add beat function
--- a/python/aubiocut
+++ b/python/aubiocut
@@ -16,7 +16,7 @@
action="store", dest="filename",
help="input sound file")
parser.add_option("-m","--mode",
- action="store", dest="mode", default=['dual'],
+ action="store", dest="mode", default='dual',
help="onset detection mode [default=dual] \
complexdomain|hfc|phase|specdiff|energy|kl|mkl|dual")
parser.add_option("-B","--bufsize",
@@ -91,13 +91,6 @@
if options.delay: delay = float(options.delay)
else: delay = 3./params.step
-if options.beat:
- #onsets = getbeats(filename,threshold,silence,mode=options.mode)
- exit("not implemented yet")
-elif options.silencecut:
- onsets = getsilences(filename,hopsize=hopsize,silence=silence)
-elif options.plot: params.storefunc=True
-else: params.storefunc=False
lonsets, lofunc = [], []
modes = options.mode.split(',')
@@ -104,7 +97,16 @@
for i in range(len(modes)):
params.onsetmode = modes[i]
- filetask = taskonset(filename,params=params)
+ dotask = taskonset
+ if options.beat:
+ dotask = taskbeat
+ elif options.silencecut:
+ dotask = tasksilence
+ elif options.plot:
+ params.storefunc=True
+ else:
+ params.storefunc=False
+ filetask = dotask(filename,params=params)
onsets = filetask.compute_all()
ofunc = filetask.ofunc
#onsets, ofunc = getonsets(filename,threshold,silence,
@@ -133,8 +135,7 @@
# print times in second
if options.verbose:
- print modes[i]
- maxonset = 0
+ #print modes[i]
for i in range(len(onsets)):
print onsets[i]*params.step