6 #include "test_macros.h"
9 main(int argc, char *argv[])
11 /* This is 11025Hz data (yikes) */
12 static const int frame_shift = 110, frame_size = 265;
17 uint16 period, bestdiff;
20 /* To make life easier, read the whole thing. */
21 TEST_ASSERT(raw = fopen(TESTDATADIR "/chan3.raw", "rb"));
22 fseek(raw, 0, SEEK_END);
23 nsamp = ftell(raw) / 2;
24 buf = ckd_calloc(nsamp, 2);
25 fseek(raw, 0, SEEK_SET);
26 TEST_EQUAL(nsamp, fread(buf, 2, nsamp, raw));
29 TEST_ASSERT(pe = yin_init(frame_size, 0.1, 0.2, 2));
32 for (start = 0; start + frame_size < nsamp; start += frame_shift) {
33 yin_write(pe, buf + start);
34 if (yin_read(pe, &period, &bestdiff)) {
35 if (bestdiff < 0.2 * 32768)
36 printf("%d ", period ? 11025/period : 0);
43 while (yin_read(pe, &period, &bestdiff)) {
44 if (bestdiff < 0.2 * 32768)
45 printf("%d ", period ? 11025/period : 0);