Changes in / [066433d:8212692]


Ignore:
Files:
2 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • examples/utils.c

    r066433d r8212692  
    238238#endif /* HAVE_LASH */
    239239
    240   woodblock = new_fvec (overlap_size);
     240  woodblock = new_fvec (overlap_size, channels);
    241241  if (output_filename || usejack) {
    242242    /* dummy assignement to keep egcs happy */
     
    251251  if (onsetfile) {
    252252    /* read the output sound once */
    253     aubio_sndfile_read_mono (onsetfile, overlap_size, woodblock);
    254   }
    255 
    256   ibuf = new_fvec (overlap_size);
    257   obuf = new_fvec (overlap_size);
     253    aubio_sndfile_read (onsetfile, overlap_size, woodblock);
     254  }
     255
     256  ibuf = new_fvec (overlap_size, channels);
     257  obuf = new_fvec (overlap_size, channels);
    258258
    259259}
  • interfaces/python/aubio/__init__.py

    r066433d r8212692  
    44class fvec(numpy.ndarray):
    55
     6    def __init__(self, length = 1024, **kwargs):
     7        super(numpy.ndarray, self).__init__(**kwargs)
     8
    69    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)
     10        self = numpy.zeros(length, dtype='float32', **kwargs)
     11        return self
  • interfaces/python/aubioinput.py

    r066433d r8212692  
    1010    import numpy
    1111    samples = numpy.frombuffer(buffer.data, dtype=numpy.float32)
    12     if chan == 1:
    13         return samples.T
    14     else:
    15         samples.resize([len(samples)/chan, chan])
    16         return samples.T
     12    samples.resize([len(samples)/chan, chan])
     13    return samples.T
    1714
    1815class AubioSink(gst.BaseSink):
     
    5653            if self.process:
    5754                self.process(v, self.pos)
    58             self.pos += 1
    59         remaining = self.adapter.available()
    60         if remaining < blocksize and remaining > 0:
    61             block = self.adapter.take_buffer(remaining)
    62             v = gst_buffer_to_numpy_array(block, chan)
    63             if self.process:
    64                 self.process(v, self.pos)
    65             self.pos += 1
     55            self.pos += 1   
    6656        return gst.FLOW_OK
    6757
  • interfaces/python/test_fvec.py

    r066433d r8212692  
    1313        #del a
    1414        assert_equal(array(a), 0.)
    15 
    16     def test_vector_create_with_list(self):
    17         a = fvec([0,1,2,3])
    18         assert_equal (range(4), a)
    1915
    2016    def test_vector_assign_element(self):
     
    5753        from math import sqrt
    5854        assert_almost_equal (alpha_norm(a, 2), sqrt(2)/2.)
    59 
    60     def test_alpha_norm_of_none(self):
    61         self.assertRaises (ValueError, alpha_norm, None, 1)
    6255
    6356    def test_alpha_norm_of_array_of_float32(self):
  • tests/src/test-pitch.c

    r066433d r8212692  
    33int main(){
    44        /* allocate some memory */
    5         uint_t win_s      = 1024; /* window size */
    6         fvec_t * in       = new_fvec (win_s); /* input buffer */
    7         fvec_t * out      = new_fvec (1); /* input buffer */
    8         aubio_pitch_t *p = new_aubio_pitch ("default", win_s, win_s / 2, 44100);
     5        uint_t win_s      = 1024;                       /* window size */
     6        uint_t channels   = 1;                          /* number of channel */
     7        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
     8        fvec_t * out      = new_fvec (1, channels); /* input buffer */
     9        aubio_pitch_t *p = new_aubio_pitch ("default", win_s, win_s / 2, channels, 44100);
    910        uint_t i = 0;
    1011
Note: See TracChangeset for help on using the changeset viewer.