Logo Search packages:      
Sourcecode: aubio version File versions  Download package

aubio_pitchdetection_t* new_aubio_pitchdetection ( uint_t  bufsize,
uint_t  hopsize,
uint_t  channels,
uint_t  samplerate,
aubio_pitchdetection_type  type,
aubio_pitchdetection_mode  mode 
)

creation of the pitch detection object

Parameters:
bufsize size of the input buffer to analyse
hopsize step size between two consecutive analysis instant
channels number of channels to analyse
samplerate sampling rate of the signal
type set pitch detection algorithm
mode set pitch units for output

Definition at line 79 of file pitchdetection.c.

References aubio_pitch_fcomb, aubio_pitch_mcomb, aubio_pitch_schmitt, aubio_pitch_yin, aubio_pitch_yinfft, aubio_pitchm_bin, aubio_pitchm_cent, aubio_pitchm_freq, aubio_pitchm_midi, _aubio_pitchdetection_t::buf, _aubio_pitchdetection_t::bufsize, _aubio_pitchdetection_t::callback, _aubio_pitchdetection_t::fcomb, _aubio_pitchdetection_t::fftgrain, _aubio_pitchdetection_t::filter, _aubio_pitchdetection_t::freqconv, _aubio_pitchdetection_t::mcomb, _aubio_pitchdetection_t::mode, _aubio_pitchdetection_t::pv, _aubio_pitchdetection_t::schmitt, _aubio_pitchdetection_t::srate, _aubio_pitchdetection_t::type, _aubio_pitchdetection_t::yin, _aubio_pitchdetection_t::yinfft, and _aubio_pitchdetection_t::yinthres.

{
      aubio_pitchdetection_t *p = AUBIO_NEW(aubio_pitchdetection_t);
      p->srate = samplerate;
      p->type = type;
      p->mode = mode;
      p->bufsize = bufsize;
      switch(p->type) {
            case aubio_pitch_yin:
                  p->buf      = new_fvec(bufsize,channels);
                  p->yin      = new_fvec(bufsize/2,channels);
                        p->callback = aubio_pitchdetection_yin;
                  p->yinthres = 0.15;
                  break;
            case aubio_pitch_mcomb:
                  p->pv       = new_aubio_pvoc(bufsize, hopsize, channels);
                  p->fftgrain = new_cvec(bufsize, channels);
                  p->mcomb    = new_aubio_pitchmcomb(bufsize,hopsize,channels,samplerate);
                  p->filter   = new_aubio_cdsgn_filter(samplerate);
                        p->callback = aubio_pitchdetection_mcomb;
                  break;
                case aubio_pitch_fcomb:
                  p->buf      = new_fvec(bufsize,channels);
                        p->fcomb    = new_aubio_pitchfcomb(bufsize,hopsize,samplerate);
                        p->callback = aubio_pitchdetection_fcomb;
                        break;
                case aubio_pitch_schmitt:
                  p->buf      = new_fvec(bufsize,channels);
                        p->schmitt  = new_aubio_pitchschmitt(bufsize,samplerate);
                        p->callback = aubio_pitchdetection_schmitt;
                        break;
            case aubio_pitch_yinfft:
                  p->buf      = new_fvec(bufsize,channels);
                        p->yinfft   = new_aubio_pitchyinfft(bufsize);
                        p->callback = aubio_pitchdetection_yinfft;
                  p->yinthres = 0.85;
                        break;
                default:
                        break;
      }
      switch(p->mode) {
            case aubio_pitchm_freq:
                        p->freqconv = freqconvpass;
                        break;
            case aubio_pitchm_midi:
                        p->freqconv = freqconvmidi;
                        break;
            case aubio_pitchm_cent:
                        /* bug: not implemented */
                        p->freqconv = freqconvmidi;
                        break;
            case aubio_pitchm_bin:
                        p->freqconv = freqconvbin;
                        break;
                default:
                        break;
        }
      return p;
}


Generated by  Doxygen 1.6.0   Back to index