Changeset f162cf9 for src


Ignore:
Timestamp:
Oct 8, 2009, 8:20:19 PM (15 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:
2ba3440
Parents:
e5757cf
Message:

src/pitch/pitchschmitt.c: remove unneeded samplerate parameter, update prototypes, make multichannel

Location:
src/pitch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/pitch/pitchschmitt.c

    re5757cf rf162cf9  
    3232};
    3333
    34 aubio_pitchschmitt_t * new_aubio_pitchschmitt (uint_t size, uint_t samplerate)
     34aubio_pitchschmitt_t * new_aubio_pitchschmitt (uint_t size)
    3535{
    3636  aubio_pitchschmitt_t * p = AUBIO_NEW(aubio_pitchschmitt_t);
     
    3939  p->buf = AUBIO_ARRAY(signed short int,p->blockSize);
    4040  p->schmittPointer = p->schmittBuffer;
    41   p->rate = samplerate;
    4241  return p;
    4342}
    4443
    45 smpl_t aubio_pitchschmitt_do (aubio_pitchschmitt_t *p, fvec_t * input)
     44void
     45aubio_pitchschmitt_do (aubio_pitchschmitt_t * p, fvec_t * input,
     46    fvec_t * output)
    4647{
    47   uint_t i;
    48   for (i=0; i<input->length; i++) {
    49     p->buf[i] = input->data[0][i]*32768.;
     48  uint_t i, j;
     49  for (i = 0; i < input->channels; i++) {
     50    for (j = 0; j < input->length; j++) {
     51      p->buf[j] = input->data[i][j] * 32768.;
     52    }
     53    output->data[i][0] = aubio_schmittS16LE (p, input->length, p->buf);
    5054  }
    51   return aubio_schmittS16LE(p, input->length, p->buf);
    5255}
    5356
     
    5962  signed short int *schmittPointer = p->schmittPointer;
    6063
    61   smpl_t freq = 0., trigfact = 0.6;
     64  smpl_t period = 0., trigfact = 0.6;
    6265
    6366  for (i=0; i<nframes; i++) {
     
    9093        }
    9194      }
    92       if (endpoint > startpoint) {
    93         freq = ((smpl_t)p->rate*(tc/(smpl_t)(endpoint-startpoint)));
     95      if ((endpoint > startpoint) && (tc > 0)) {
     96        period = (smpl_t)(endpoint-startpoint)/tc;
    9497      }
    9598    }
     
    98101  p->schmittBuffer  = schmittBuffer;
    99102  p->schmittPointer = schmittPointer;
    100   return freq;
     103  return period;
    101104}
    102105
  • src/pitch/pitchschmitt.h

    re5757cf rf162cf9  
    4646  \param p pitch detection object as returned by new_aubio_pitchschmitt
    4747  \param input input signal window (length as specified at creation time)
     48  \param output pitch period estimates, in samples
    4849 
    4950*/
    50 smpl_t aubio_pitchschmitt_do (aubio_pitchschmitt_t *p, fvec_t * input);
     51void aubio_pitchschmitt_do (aubio_pitchschmitt_t *p, fvec_t * input, fvec_t * output);
    5152/** creation of the pitch detection object
    5253 
    5354  \param size size of the input buffer to analyse
    54   \param samplerate sampling rate of the signal
    5555 
    5656*/
    57 aubio_pitchschmitt_t * new_aubio_pitchschmitt (uint_t size, uint_t samplerate);
     57aubio_pitchschmitt_t * new_aubio_pitchschmitt (uint_t size);
    5858/** deletion of the pitch detection object
    5959 
Note: See TracChangeset for help on using the changeset viewer.