Changeset dc467b5d for python


Ignore:
Timestamp:
Oct 27, 2013, 12:44:29 PM (11 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, pitchshift, sampler, timestretch, yinfft+
Children:
8247249
Parents:
dd15573 (diff), 7fc5ba2 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'develop' of aubio.org:/git/aubio/aubio into wavetable

Location:
python
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • python/demos/demo_waveform_plot.py

    rdd15573 rdc467b5d  
    55from numpy import zeros, hstack
    66
    7 def get_waveform_plot(filename, samplerate = 0, block_size = 4096, ax = None):
     7def get_waveform_plot(filename, samplerate = 0, block_size = 4096, ax = None, downsample = 2**4):
    88    import matplotlib.pyplot as plt
    99    if not ax:
     
    1313
    1414    allsamples_max = zeros(0,)
    15     downsample = 2**4  # to plot n samples / hop_s
     15    downsample = downsample  # to plot n samples / hop_s
    1616
    1717    a = source(filename, samplerate, hop_s)            # source file
  • python/lib/generator.py

    rdd15573 rdc467b5d  
    3434  generated_objects = []
    3535  cpp_output, cpp_objects = get_cpp_objects()
    36   skip_objects = ['fft',
     36  skip_objects = [
     37      # already in ext/
     38      'fft',
    3739      'pvoc',
    3840      'filter',
    3941      'filterbank',
     42      #'resampler',
     43      # AUBIO_UNSTABLE
     44      'hist',
     45      'scale',
     46      'beattracking',
    4047      'resampler',
    4148      'sndfile',
     49      'peakpicker',
     50      'pitchfcomb',
     51      'pitchmcomb',
     52      'pitchschmitt',
     53      'pitchyin',
     54      'pitchyinfft',
    4255      'sink_apple_audio',
    4356      'sink_sndfile',
    4457      'source_apple_audio',
    45       'source_sndfile']
     58      'source_sndfile',
     59      #'sampler',
     60      'audio_unit',
     61      ]
    4662
    4763  write_msg("-- INFO: %d objects in total" % len(cpp_objects))
     
    180196  s = """// generated list of objects created with generator.py
    181197
    182 #include "Python.h"
     198#include <Python.h>
    183199
    184200"""
  • python/scripts/aubiocut

    rdd15573 rdc467b5d  
    99
    1010usage = "usage: %s [options] -i soundfile" % sys.argv[0]
    11 usage += "\nhelp: %s -h" % sys.argv[0]
     11usage += "\n help: %s -h" % sys.argv[0]
    1212
    1313def parse_args():
     
    2222                    complexdomain|hfc|phase|specdiff|energy|kl|mkl")
    2323    # cutting methods
    24     """
    2524    parser.add_option("-b","--beat",
    2625            action="store_true", dest="beat", default=False,
    2726            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>",
     43            metavar = "<size>", type='int',
    4444            help="buffer size [default=512]")
    4545    parser.add_option("-H","--hopsize",
    46             metavar = "<size>",
     46            metavar = "<size>", type='int',
    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, source, sink
     129    from aubio import onset, tempo, source, sink
    130130
    131131    s = source(source_file, samplerate, hopsize)
    132132    if samplerate == 0: samplerate = s.get_samplerate()
    133133
    134     o = onset(options.onset_method, bufsize, hopsize)
     134    if options.beat:
     135        o = tempo(options.onset_method, bufsize, hopsize)
     136    else:
     137        o = onset(options.onset_method, bufsize, hopsize)
    135138    o.set_threshold(options.threshold)
    136139
     
    141144        samples, read = s()
    142145        if o(samples):
    143             this_onset = o.get_last_onset()
    144             if options.verbose: print "%.4f" % o.get_last_onset_s()
    145             timestamps.append (this_onset)
     146            timestamps.append (o.get_last())
     147            if options.verbose: print "%.4f" % o.get_last_s()
    146148        total_frames += read
    147149        if read < hopsize: break
    148 
     150    del s
    149151    # print some info
    150152    nstamps = len(timestamps)
     
    162164            return source_base_name + '_%02.3f' % (timestamp) + '.wav'
    163165        # reopen source file
    164         del s
    165166        s = source(source_file, samplerate, hopsize)
     167        if samplerate == 0: samplerate = s.get_samplerate()
    166168        # create first sink at 0
    167169        g = sink(new_sink_name(source_base_name, 0.), samplerate)
  • python/tests/run_all_tests

    rdd15573 rdc467b5d  
    88    if curdir == '': curdir = '.'
    99    files = os.listdir(curdir)
    10     modfiles = filter (lambda y: y.endswith('.py'), files) 
     10    modfiles = filter (lambda y: y.endswith('.py'), files)
    1111    modfiles = filter (lambda f: f.startswith('test_'), modfiles)
     12    modfiles = filter (lambda y: not 'beattracking' in y, modfiles)
     13    modfiles = filter (lambda y: not 'hist' in y, modfiles)
     14    modfiles = filter (lambda y: not 'scale' in y, modfiles)
     15    modfiles = filter (lambda y: not 'peakpicker' in y, modfiles)
    1216    # get module names
    1317    modnames = map (lambda x: os.path.splitext(x)[0], modfiles)
Note: See TracChangeset for help on using the changeset viewer.