feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change
on this file since fe163ad was
fe163ad,
checked in by Paul Brossier <piem@piem.org>, 15 years ago
|
src/pitch: use a string to set pitch method, add a new function to set pitch unit, keep pitch enums private, update pitch methods where they are used
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | from aubio.aubioclass import * |
---|
2 | |
---|
3 | def get_onset_mode(nvalue): |
---|
4 | """ 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 == 'specflux' : |
---|
20 | return aubio_onset_specflux |
---|
21 | elif nvalue == 'dual' : |
---|
22 | return 'dual' |
---|
23 | else: |
---|
24 | import sys |
---|
25 | print "unknown onset detection function selected: %s" % nvalue |
---|
26 | sys.exit(1) |
---|
27 | |
---|
28 | def check_onset_mode(option, opt, value, parser): |
---|
29 | """ wrapper function to convert a list of modes to |
---|
30 | aubio_onsetdetection_type """ |
---|
31 | nvalues = parser.rargs[0].split(',') |
---|
32 | val = [] |
---|
33 | for nvalue in nvalues: |
---|
34 | val.append(get_onset_mode(nvalue)) |
---|
35 | setattr(parser.values, option.dest, val) |
---|
36 | |
---|
37 | def check_pitch_mode(option, opt, value, parser): |
---|
38 | """ utility function to convert a string to aubio_pitchdetection_type""" |
---|
39 | nvalues = parser.rargs[0].split(',') |
---|
40 | val = [] |
---|
41 | for nvalue in nvalues: |
---|
42 | val.append(get_pitch_mode(nvalue)) |
---|
43 | setattr(parser.values, option.dest, val) |
---|
Note: See
TracBrowser
for help on using the repository browser.