- Timestamp:
- Oct 8, 2009, 8:20:19 PM (15 years ago)
- 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
- Location:
- src/pitch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/pitch/pitchschmitt.c
re5757cf rf162cf9 32 32 }; 33 33 34 aubio_pitchschmitt_t * new_aubio_pitchschmitt (uint_t size , uint_t samplerate)34 aubio_pitchschmitt_t * new_aubio_pitchschmitt (uint_t size) 35 35 { 36 36 aubio_pitchschmitt_t * p = AUBIO_NEW(aubio_pitchschmitt_t); … … 39 39 p->buf = AUBIO_ARRAY(signed short int,p->blockSize); 40 40 p->schmittPointer = p->schmittBuffer; 41 p->rate = samplerate;42 41 return p; 43 42 } 44 43 45 smpl_t aubio_pitchschmitt_do (aubio_pitchschmitt_t *p, fvec_t * input) 44 void 45 aubio_pitchschmitt_do (aubio_pitchschmitt_t * p, fvec_t * input, 46 fvec_t * output) 46 47 { 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); 50 54 } 51 return aubio_schmittS16LE(p, input->length, p->buf);52 55 } 53 56 … … 59 62 signed short int *schmittPointer = p->schmittPointer; 60 63 61 smpl_t freq= 0., trigfact = 0.6;64 smpl_t period = 0., trigfact = 0.6; 62 65 63 66 for (i=0; i<nframes; i++) { … … 90 93 } 91 94 } 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; 94 97 } 95 98 } … … 98 101 p->schmittBuffer = schmittBuffer; 99 102 p->schmittPointer = schmittPointer; 100 return freq;103 return period; 101 104 } 102 105 -
src/pitch/pitchschmitt.h
re5757cf rf162cf9 46 46 \param p pitch detection object as returned by new_aubio_pitchschmitt 47 47 \param input input signal window (length as specified at creation time) 48 \param output pitch period estimates, in samples 48 49 49 50 */ 50 smpl_t aubio_pitchschmitt_do (aubio_pitchschmitt_t *p, fvec_t * input);51 void aubio_pitchschmitt_do (aubio_pitchschmitt_t *p, fvec_t * input, fvec_t * output); 51 52 /** creation of the pitch detection object 52 53 53 54 \param size size of the input buffer to analyse 54 \param samplerate sampling rate of the signal55 55 56 56 */ 57 aubio_pitchschmitt_t * new_aubio_pitchschmitt (uint_t size , uint_t samplerate);57 aubio_pitchschmitt_t * new_aubio_pitchschmitt (uint_t size); 58 58 /** deletion of the pitch detection object 59 59
Note: See TracChangeset
for help on using the changeset viewer.