History

separate get_onset_mode separate get_onset_mode

Paul Brossier committed 20 years ago

Commit 74730741 parent 61680aa1 file · +26 −21Browse files

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

Unified · Split

python/aubio/tasks.py+26−21
@@ -1,30 +1,35 @@
11 from aubioclass import *
22
3−def check_onset_mode(option, opt, value, parser):
3+def get_onset_mode(nvalue):
44 """ utility function to convert a string to aubio_onsetdetection_type """
5+ if nvalue == 'complexdomain' or nvalue == 'complex' :
6+ return aubio_onset_complex
7+ elif nvalue == 'hfc' :
8+ return aubio_onset_hfc
9+ elif nvalue == 'phase' :
10+ return aubio_onset_phase
11+ elif nvalue == 'specdiff' :
12+ return aubio_onset_specdiff
13+ elif nvalue == 'energy' :
14+ return aubio_onset_energy
15+ elif nvalue == 'kl' :
16+ return aubio_onset_kl
17+ elif nvalue == 'mkl' :
18+ return aubio_onset_mkl
19+ elif nvalue == 'dual' :
20+ return 'dual'
21+ else:
22+ import sys
23+ print "unknown onset detection function selected"
24+ sys.exit(1)
25+
26+def check_onset_mode(option, opt, value, parser):
27+ """ wrapper function to convert a list of modes to
28+ aubio_onsetdetection_type """
529 nvalues = parser.rargs[0].split(',')
630 val = []
731 for nvalue in nvalues:
8− if nvalue == 'complexdomain' or nvalue == 'complex' :
9− val.append(aubio_onset_complex)
10− elif nvalue == 'hfc' :
11− val.append(aubio_onset_hfc)
12− elif nvalue == 'phase' :
13− val.append(aubio_onset_phase)
14− elif nvalue == 'specdiff' :
15− val.append(aubio_onset_specdiff)
16− elif nvalue == 'energy' :
17− val.append(aubio_onset_energy)
18− elif nvalue == 'kl' :
19− val.append(aubio_onset_kl)
20− elif nvalue == 'mkl' :
21− val.append(aubio_onset_mkl)
22− elif nvalue == 'dual' :
23− val.append('dual')
24− else:
25− import sys
26− print "unknown onset detection function selected"
27− sys.exit(1)
32+ val.append(get_onset_mode(nvalue))
2833 setattr(parser.values, option.dest, val)
2934
3035 def check_pitch_mode(option, opt, value, parser):

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