Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/scripts/aubiocut

    r7fc5ba2 rdee4164  
    99
    1010usage = "usage: %s [options] -i soundfile" % sys.argv[0]
    11 usage += "\n help: %s -h" % sys.argv[0]
     11usage += "\nhelp: %s -h" % sys.argv[0]
    1212
    1313def parse_args():
     
    2222                    complexdomain|hfc|phase|specdiff|energy|kl|mkl")
    2323    # cutting methods
     24    """
    2425    parser.add_option("-b","--beat",
    2526            action="store_true", dest="beat", default=False,
    2627            help="use beat locations")
    27     """
    2828    parser.add_option("-S","--silencecut",
    2929            action="store_true", dest="silencecut", default=False,
     
    4141    parser.add_option("-B","--bufsize",
    4242            action="store", dest="bufsize", default=512,
    43             metavar = "<size>", type='int',
     43            metavar = "<size>",
    4444            help="buffer size [default=512]")
    4545    parser.add_option("-H","--hopsize",
    46             metavar = "<size>", type='int',
     46            metavar = "<size>",
    4747            action="store", dest="hopsize", default=256,
    4848            help="overlap size [default=256]")
     
    127127    source_file = options.source_file
    128128
    129     from aubio import onset, tempo, source, sink
     129    from aubio import onset, source, sink
    130130
    131131    s = source(source_file, samplerate, hopsize)
    132132    if samplerate == 0: samplerate = s.get_samplerate()
    133133
    134     if options.beat:
    135         o = tempo(options.onset_method, bufsize, hopsize)
    136     else:
    137         o = onset(options.onset_method, bufsize, hopsize)
     134    o = onset(options.onset_method, bufsize, hopsize)
    138135    o.set_threshold(options.threshold)
    139136
     
    144141        samples, read = s()
    145142        if o(samples):
    146             timestamps.append (o.get_last())
    147             if options.verbose: print "%.4f" % o.get_last_s()
     143            this_onset = o.get_last_onset()
     144            if options.verbose: print "%.4f" % o.get_last_onset_s()
     145            timestamps.append (this_onset)
    148146        total_frames += read
    149147        if read < hopsize: break
    150     del s
     148
    151149    # print some info
    152150    nstamps = len(timestamps)
     
    164162            return source_base_name + '_%02.3f' % (timestamp) + '.wav'
    165163        # reopen source file
     164        del s
    166165        s = source(source_file, samplerate, hopsize)
    167         if samplerate == 0: samplerate = s.get_samplerate()
    168166        # create first sink at 0
    169167        g = sink(new_sink_name(source_base_name, 0.), samplerate)
Note: See TracChangeset for help on using the changeset viewer.