Changeset 3d9b41b


Ignore:
Timestamp:
Apr 12, 2017, 9:49:46 AM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
Children:
8f1b354
Parents:
3d3d74d
Message:

python/lib/aubio/cmd.py: add -u/--pitch-unit to 'aubio pitch'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/lib/aubio/cmd.py

    r3d3d74d r3d9b41b  
    4747    parser_add_method(subparser, helpstr=helpstr)
    4848    parser_add_threshold(subparser)
     49    parser_add_pitch_unit(subparser)
    4950    parser_add_silence(subparser)
    5051    parser_add_time_format(subparser)
     
    150151            action="store", dest="minioi", default="12ms",
    151152            help="minimum Inter-Onset Interval")
     153
     154def parser_add_pitch_unit(parser, default="Hz"):
     155    help_str = "frequency unit, should be one of Hz, midi, bin, cent"
     156    help_str += " [default=%s]" % default
     157    parser.add_argument("-u", "--pitch-unit",
     158            metavar = "<value>", type=str,
     159            action="store", dest="pitch_unit", default=default,
     160            help=help_str)
    152161
    153162def parser_add_time_format(parser):
     
    240249        self.parse_options(args, self.valid_opts)
    241250        self.pitch = aubio.pitch(**self.options)
     251        if args.pitch_unit is not None:
     252            self.pitch.set_unit(args.pitch_unit)
    242253        if args.threshold is not None:
    243254            self.pitch.set_tolerance(args.threshold)
Note: See TracChangeset for help on using the changeset viewer.