Changeset fc117d0 for python


Ignore:
Timestamp:
Feb 11, 2013, 11:06:28 AM (12 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:
050a8f3
Parents:
5314432 (diff), 88fc249 (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 from develop

Location:
python
Files:
7 added
2 deleted
1 edited
36 moved

Legend:

Unmodified
Added
Removed
  • python/aubio/__init__.py

    r5314432 rfc117d0  
    1 """Copyright (C) 2004 Paul Brossier <piem@altern.org>
    2 print aubio.__LICENSE__ for the terms of use
    3 """
     1import numpy
     2from _aubio import *
    43
    5 __LICENSE__ = """\
    6   Copyright (C) 2004-2009 Paul Brossier <piem@aubio.org>
     4class fvec(numpy.ndarray):
    75
    8   This file is part of aubio.
    9 
    10   aubio is free software: you can redistribute it and/or modify
    11   it under the terms of the GNU General Public License as published by
    12   the Free Software Foundation, either version 3 of the License, or
    13   (at your option) any later version.
    14 
    15   aubio is distributed in the hope that it will be useful,
    16   but WITHOUT ANY WARRANTY; without even the implied warranty of
    17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    18   GNU General Public License for more details.
    19 
    20   You should have received a copy of the GNU General Public License
    21   along with aubio.  If not, see <http://www.gnu.org/licenses/>.
    22 """           
    23 
    24 #from aubioclass import *
    25 #from onsetcompare import *
    26 #from median import *
    27 #from noteroc import *
    28 #from txtfile import *
     6    def __new__(self, length = 1024, **kwargs):
     7        if type(length) == type([]):
     8            return numpy.array(length, dtype='float32', **kwargs)
     9        return numpy.zeros(length, dtype='float32', **kwargs)
  • python/demos/demo_beats_and_tempo.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33import sys
  • python/demos/demo_filterbank_slaney.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33from aubio import filterbank
  • python/demos/demo_filterbank_triangle_bands.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33from aubio import filterbank, fvec
  • python/demos/demo_sink.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33import sys
     
    55
    66if __name__ == '__main__':
    7   if len(sys.argv) < 2:
     7  if len(sys.argv) < 3:
    88    print 'usage: %s <inputfile> <outputfile>' % sys.argv[0]
    99    sys.exit(1)
  • python/demos/demo_source.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33import sys
  • python/demos/demo_spectrogram.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33import sys
     
    2323
    2424  # plotting
    25   imshow(log10(specgram.T), origin = 'bottom', aspect = 'auto', cmap=cm.gray_r)
     25  imshow(log10(specgram.T + .001), origin = 'bottom', aspect = 'auto', cmap=cm.gray_r)
    2626  axis([0, len(specgram), 0, len(specgram[0])])
    27   ylabel('Frequency (Hz)')
    28   xlabel('Time (s)')
    2927  # show axes in Hz and seconds
    3028  time_step = hop_s / float(samplerate)
    3129  total_time = len(specgram) * time_step
    32   ticks = 10
    33   xticks( arange(ticks) / float(ticks) * len(specgram),
    34       [x * total_time / float(ticks) for x in range(ticks) ] )
    35   yticks( arange(ticks) / float(ticks) * len(specgram[0]),
    36       [x * samplerate / 2. / float(ticks) for x in range(ticks) ] )
     30  print "total time: %0.2fs" % total_time,
     31  print ", samplerate: %.2fkHz" % (samplerate / 1000.)
     32  n_xticks = 10
     33  n_yticks = 10
     34
     35  def get_rounded_ticks( top_pos, step, n_ticks ):
     36      top_label = top_pos * step
     37      # get the first label
     38      ticks_first_label = top_pos * step / n_ticks
     39      # round to the closest .1
     40      ticks_first_label = round ( ticks_first_label * 10. ) / 10.
     41      # compute all labels from the first rounded one
     42      ticks_labels = [ ticks_first_label * n for n in range(n_ticks) ] + [ top_label ]
     43      # get the corresponding positions
     44      ticks_positions = [ ticks_labels[n] / step for n in range(n_ticks) ] + [ top_pos ]
     45      # convert to string
     46      ticks_labels = [  "%.1f" % x for x in ticks_labels ]
     47      # return position, label tuple to use with x/yticks
     48      return ticks_positions, ticks_labels
     49
     50  # apply to the axis
     51  xticks( *get_rounded_ticks ( len(specgram), time_step, n_xticks ) )
     52  yticks( *get_rounded_ticks ( len(specgram[0]), (samplerate / 2. / 1000.) / len(specgram[0]), n_yticks ) )
     53  ylabel('Frequency (kHz)')
     54  xlabel('Time (s)')
    3755
    3856if __name__ == '__main__':
  • python/demos/demo_tss.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33import sys
  • python/gen_pyobject.py

    r5314432 rfc117d0  
    360360    if name in param_numbers.keys():
    361361      n_input_param, n_output_param = param_numbers[name]
    362       print name, n_output_param
    363362    else:
    364363      n_input_param, n_output_param = 1, n_param - 1
  • python/generator.py

    r5314432 rfc117d0  
    88def get_cpp_objects():
    99
    10   cpp_output = [l.strip() for l in os.popen('cpp -DAUBIO_UNSTABLE=1 -I../../build/src ../../src/aubio.h').readlines()]
     10  cpp_output = [l.strip() for l in os.popen('cpp -DAUBIO_UNSTABLE=1 -I../build/src ../src/aubio.h').readlines()]
    1111
    1212  cpp_output = filter(lambda y: len(y) > 1, cpp_output)
  • python/run_all_tests

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33if __name__ == '__main__':
     
    77    curdir = os.path.dirname(sys.argv[0])
    88    if curdir == '': curdir = '.'
    9     files = os.listdir(curdir)
     9    files = os.listdir(os.path.join(curdir, 'tests'))
    1010    modfiles = filter (lambda y: y.endswith('.py'), files)
    1111    modfiles = filter (lambda f: f.startswith('test_'), modfiles)
  • python/setup.py

    r5314432 rfc117d0  
    22
    33from distutils.core import setup, Extension
     4from generator import generate_object_files
     5import os.path
     6import numpy
    47
    5 from generator import generate_object_files
    6 
    7 import os.path
    8 
    9 library_dirs = ['../../build/src', '../../src/.libs']
    10 include_dirs = ['../../build/src', '../../src', '.' ]
     8library_dirs = ['../build/src', '../src/.libs']
     9include_dirs = ['../build/src', '../src', '.' ]
    1110library_dirs = filter (lambda x: os.path.isdir(x), library_dirs)
    1211include_dirs = filter (lambda x: os.path.isdir(x), include_dirs)
     
    2423            # generated files
    2524            ] + generate_object_files(),
    26             include_dirs = include_dirs,
     25            include_dirs = include_dirs + [ numpy.get_include() ],
    2726            library_dirs = library_dirs,
    2827            libraries=['aubio'])
  • python/tests/test_aubio.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33from numpy.testing import TestCase, run_module_suite
  • python/tests/test_fft.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33from numpy.testing import TestCase, run_module_suite
  • python/tests/test_filter.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33from numpy.testing import TestCase, assert_equal, assert_almost_equal
  • python/tests/test_filterbank.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33from numpy.testing import TestCase, run_module_suite
  • python/tests/test_filterbank_mel.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33from numpy.testing import TestCase, run_module_suite
  • python/tests/test_fvec.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33from numpy.testing import TestCase, run_module_suite
  • python/tests/test_onset.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33from numpy.testing import TestCase, run_module_suite
  • python/tests/test_peakpicker.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33from numpy.testing import TestCase, assert_equal, assert_almost_equal
  • python/tests/test_phasevoc.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33from numpy.testing import TestCase, run_module_suite
  • python/tests/test_pitch.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33from numpy.testing import TestCase
  • python/tests/test_source.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33from numpy.testing import TestCase, assert_equal, assert_almost_equal
  • python/tests/test_specdesc.py

    r5314432 rfc117d0  
    1 #! /usr/bin/python
     1#! /usr/bin/env python
    22
    33from numpy.testing import TestCase, assert_equal, assert_almost_equal
Note: See TracChangeset for help on using the changeset viewer.