Changeset 911b175d for python


Ignore:
Timestamp:
Mar 26, 2017, 1:31:48 PM (7 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, sampler
Children:
7928b3b8
Parents:
1136442 (diff), 2a7bcaa (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 'master' into awhitening

Location:
python
Files:
1 added
3 edited
1 moved

Legend:

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

    • Property mode changed from 100755 to 100644
    r1136442 r911b175d  
    77import sys
    88
    9 usage = "usage: %s [options] -i soundfile" % sys.argv[0]
    10 usage += "\n help: %s -h" % sys.argv[0]
    11 
    129def parse_args():
    1310    from optparse import OptionParser
     11    usage = "usage: %s [options] -i soundfile" % sys.argv[0]
     12    usage += "\n help: %s -h" % sys.argv[0]
    1413    parser = OptionParser(usage=usage)
    1514    parser.add_option("-i", "--input", action = "store", dest = "source_file",
     
    134133    (options, args) = parser.parse_args()
    135134    if not options.source_file:
    136         import os.path
    137135        if len(args) == 1:
    138136            options.source_file = args[0]
     
    142140    return options, args
    143141
    144 if __name__ == '__main__':
     142def main():
    145143    options, args = parse_args()
    146144
     
    150148    source_file = options.source_file
    151149
    152     from aubio import onset, tempo, source, sink
     150    from aubio import onset, tempo, source
    153151
    154152    s = source(source_file, samplerate, hopsize)
  • python/lib/moresetuptools.py

    r1136442 r911b175d  
    55from .gen_external import generate_external, header, output_path
    66
    7 def get_aubio_version():
    8     # read from VERSION
    9     this_file_dir = os.path.dirname(os.path.abspath(__file__))
    10     version_file = os.path.join(this_file_dir, '..', '..', 'VERSION')
    11 
    12     if not os.path.isfile(version_file):
    13         raise SystemError("VERSION file not found.")
    14 
    15     for l in open(version_file).readlines():
    16         #exec (l.strip())
    17         if l.startswith('AUBIO_MAJOR_VERSION'):
    18             AUBIO_MAJOR_VERSION = int(l.split('=')[1])
    19         if l.startswith('AUBIO_MINOR_VERSION'):
    20             AUBIO_MINOR_VERSION = int(l.split('=')[1])
    21         if l.startswith('AUBIO_PATCH_VERSION'):
    22             AUBIO_PATCH_VERSION = int(l.split('=')[1])
    23         if l.startswith('AUBIO_VERSION_STATUS'):
    24             AUBIO_VERSION_STATUS = l.split('=')[1].strip()[1:-1]
    25 
    26     if AUBIO_MAJOR_VERSION is None or AUBIO_MINOR_VERSION is None \
    27             or AUBIO_PATCH_VERSION is None:
    28         raise SystemError("Failed parsing VERSION file.")
    29 
    30     verstr = '.'.join(map(str, [AUBIO_MAJOR_VERSION,
    31                                      AUBIO_MINOR_VERSION,
    32                                      AUBIO_PATCH_VERSION]))
    33 
    34     if AUBIO_VERSION_STATUS is not None:
    35         verstr += AUBIO_VERSION_STATUS
    36     return verstr
    37 
    38 def get_aubio_pyversion():
    39     # convert to version for python according to pep 440
    40     # see https://www.python.org/dev/peps/pep-0440/
    41     verstr = get_aubio_version()
    42     if '~alpha' in verstr:
    43         verstr = verstr.split('~')[0] + 'a1'
    44     # TODO: add rc, .dev, and .post suffixes, add numbering
    45     return verstr
     7from this_version import get_aubio_version
    468
    479# inspired from https://gist.github.com/abergmeier/9488990
     
    9456    ext.libraries += ['aubio']
    9557
    96 def add_local_aubio_sources(ext, usedouble = False):
     58def add_local_aubio_sources(ext):
    9759    """ build aubio inside python module instead of linking against libaubio """
    9860    print("Info: libaubio was not installed or built locally with waf, adding src/")
     
    10264
    10365def add_local_macros(ext, usedouble = False):
     66    if usedouble:
     67        ext.define_macros += [('HAVE_AUBIO_DOUBLE', 1)]
    10468    # define macros (waf puts them in build/src/config.h)
    10569    for define_macro in ['HAVE_STDLIB_H', 'HAVE_STDIO_H',
     
    194158    def build_extension(self, extension):
    195159        if self.enable_double or 'HAVE_AUBIO_DOUBLE' in os.environ:
    196             extension.define_macros += [('HAVE_AUBIO_DOUBLE', 1)]
    197160            enable_double = True
    198161        else:
     
    205168            if os.path.isfile(os.path.join('src', 'aubio.h')):
    206169                add_local_aubio_header(extension)
    207             add_local_macros(extension)
     170            add_local_macros(extension, usedouble=enable_double)
    208171            # look for a local waf build
    209172            if os.path.isfile(os.path.join('build','src', 'fvec.c.1.o')):
     
    213176                add_external_deps(extension, usedouble=enable_double)
    214177                # add libaubio sources and look for optional deps with pkg-config
    215                 add_local_aubio_sources(extension, usedouble=enable_double)
     178                add_local_aubio_sources(extension)
    216179        # generate files python/gen/*.c, python/gen/aubio-generated.h
     180        extension.include_dirs += [ output_path ]
    217181        extension.sources += generate_external(header, output_path, overwrite = False,
    218182                usedouble=enable_double)
  • python/tests/test_sink.py

    r1136442 r911b175d  
    118118
    119119    def test_read_with(self):
    120         sink_path =get_tmp_sink_path()
     120        samplerate = 44100
     121        sink_path = get_tmp_sink_path()
    121122        vec = fvec(128)
    122123        with sink(sink_path, samplerate) as g:
    123             for i in range(10):
     124            for _ in range(10):
    124125                g(vec, 128)
    125126
  • python/tests/test_source.py

    r1136442 r911b175d  
    66from aubio import source
    77from .utils import list_all_sounds
    8 import numpy as np
    98
    109import warnings
Note: See TracChangeset for help on using the changeset viewer.