Changes in src/pitch/pitchyin.c [813f4c7:ce3ff2b]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/pitch/pitchyin.c
r813f4c7 rce3ff2b 128 128 } 129 129 130 130 131 /* all the above in one */ 131 132 void 132 133 aubio_pitchyin_do (aubio_pitchyin_t * o, const fvec_t * input, fvec_t * out) 133 134 { 134 const smpl_t tol = o->tol; 135 fvec_t* yin = o->yin; 136 const smpl_t *input_data = input->data; 137 const uint_t length = yin->length; 138 smpl_t *yin_data = yin->data; 139 uint_t j, tau; 135 smpl_t tol = o->tol; 136 fvec_t *yin = o->yin; 137 uint_t j, tau = 0; 140 138 sint_t period; 141 smpl_t tmp, tmp2 = 0.; 142 143 yin_data[0] = 1.; 144 for (tau = 1; tau < length; tau++) { 145 yin_data[tau] = 0.; 146 for (j = 0; j < length; j++) { 147 tmp = input_data[j] - input_data[j + tau]; 148 yin_data[tau] += SQR (tmp); 139 smpl_t tmp = 0., tmp2 = 0.; 140 yin->data[0] = 1.; 141 for (tau = 1; tau < yin->length; tau++) { 142 yin->data[tau] = 0.; 143 for (j = 0; j < yin->length; j++) { 144 tmp = input->data[j] - input->data[j + tau]; 145 yin->data[tau] += SQR (tmp); 149 146 } 150 tmp2 += yin _data[tau];147 tmp2 += yin->data[tau]; 151 148 if (tmp2 != 0) { 152 149 yin->data[tau] *= tau / tmp2; … … 155 152 } 156 153 period = tau - 3; 157 if (tau > 4 && (yin _data[period] < tol) &&158 (yin _data[period] < yin_data[period + 1])) {154 if (tau > 4 && (yin->data[period] < tol) && 155 (yin->data[period] < yin->data[period + 1])) { 159 156 out->data[0] = fvec_quadratic_peak_pos (yin, period); 160 157 goto beach;
Note: See TracChangeset
for help on using the changeset viewer.