- Timestamp:
- Dec 21, 2016, 1:00:24 AM (8 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, sampler, yinfft+
- Children:
- e79943b
- Parents:
- 1f6a9f8
- git-author:
- Eduard Müller <mueller.eduard@googlemail.com> (12/20/16 23:24:28)
- git-committer:
- Eduard Müller <mueller.eduard@googlemail.com> (12/21/16 01:00:24)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/pitch/pitchyin.c
r1f6a9f8 r813f4c7 128 128 } 129 129 130 131 130 /* all the above in one */ 132 131 void 133 132 aubio_pitchyin_do (aubio_pitchyin_t * o, const fvec_t * input, fvec_t * out) 134 133 { 135 smpl_t tol = o->tol; 136 fvec_t *yin = o->yin; 137 uint_t j, tau = 0; 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; 138 140 sint_t period; 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); 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); 146 149 } 147 tmp2 += yin ->data[tau];150 tmp2 += yin_data[tau]; 148 151 if (tmp2 != 0) { 149 152 yin->data[tau] *= tau / tmp2; … … 152 155 } 153 156 period = tau - 3; 154 if (tau > 4 && (yin ->data[period] < tol) &&155 (yin ->data[period] < yin->data[period + 1])) {157 if (tau > 4 && (yin_data[period] < tol) && 158 (yin_data[period] < yin_data[period + 1])) { 156 159 out->data[0] = fvec_quadratic_peak_pos (yin, period); 157 160 goto beach;
Note: See TracChangeset
for help on using the changeset viewer.