Changeset aa17581 for python/aubiopitch


Ignore:
Timestamp:
Aug 22, 2005, 9:52:17 PM (19 years ago)
Author:
Paul Brossier <piem@altern.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, pitchshift, sampler, timestretch, yinfft+
Children:
c29dae2
Parents:
f97445c
Message:

added midi and hertz output modes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/aubiopitch

    rf97445c raa17581  
    2323                          help="pitch detection mode [default=mcomb] \
    2424                          mcomb|yin|fcomb|schmitt")
     25        parser.add_option("-u","--units", action="callback",
     26                          callback=check_pitchm_mode, dest="omode",
     27                          default=aubio_pitchm_freq,
     28                          help="output pitch in units [default=Hz] \
     29                          freq|midi|cent|bin")
    2530        parser.add_option("-B","--bufsize",
    26                           action="store", dest="bufsize", default=1024,
     31                          action="store", dest="bufsize", default=None,
    2732                          help="buffer size [default=1024]")
    2833        parser.add_option("-H","--hopsize",
    29                           action="store", dest="hopsize", default=512,
     34                          action="store", dest="hopsize", default=None,
    3035                          help="overlap size [default=512]")
    3136        parser.add_option("-t","--threshold",
     
    6469                          help="be quiet")
    6570        (options, args) = parser.parse_args()
     71        if not options.bufsize:
     72                if options.mode == aubio_pitch_yin:     options.bufsize = 1024
     73                if options.mode == aubio_pitch_schmitt: options.bufsize = 2048
     74                if options.mode == aubio_pitch_mcomb:   options.bufsize = 4096
     75                if options.mode == aubio_pitch_fcomb:   options.bufsize = 4096
     76        if not options.hopsize:
     77                options.hopsize = float(options.bufsize) / 2
    6678        if not options.filename:
    67                  print "no file name given\n", usage
    68                  sys.exit(1)
     79                print "no file name given\n", usage
     80                sys.exit(1)
    6981        return options, args
    7082
    7183options, args = parse_args()
     84
     85#print options.bufsize, options.hopsize
    7286
    7387filename   = options.filename
     
    86100        exit("not implemented yet")
    87101else:
    88         pitch = getpitch(filename, #threshold,silence,
     102        pitch = getpitch(filename, #threshold,
    89103                mode=options.mode,
    90                 bufsize=bufsize,hopsize=hopsize)
     104                omode=options.omode,
     105                bufsize=bufsize,hopsize=hopsize,
     106                silence=silence)
    91107
    92108## take back system delay
Note: See TracChangeset for help on using the changeset viewer.