History

add beat function add beat function

Paul Brossier committed 20 years ago

Commit ada5baf1 parent c32976a1 file · +12 −11Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/aubiocut+12−11
@@ -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
91if options.delay: delay = float(options.delay)91if options.delay: delay = float(options.delay)
92else: delay = 3./params.step92else: delay = 3./params.step
93 93
94if options.beat:
95 #onsets = getbeats(filename,threshold,silence,mode=options.mode)
96 exit("not implemented yet")
97elif options.silencecut:
98 onsets = getsilences(filename,hopsize=hopsize,silence=silence)
99elif options.plot: params.storefunc=True
100else: params.storefunc=False
101 94
102lonsets, lofunc = [], []95lonsets, lofunc = [], []
103modes = options.mode.split(',')96modes = options.mode.split(',')
104for i in range(len(modes)):97for 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.ofunc111 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 second136 # 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.step140 print onsets[i]*params.step
140 141

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t