[xwax-devel] timecoder woes
Brought to you by:
hills
From: Albert S. <asa...@uw...> - 2007-06-20 01:57:16
|
Hi all, I've been trying to use timecoder.c in another open source application, and I'm having a really tough time getting it to work. Basically, I get audio samples from the soundcard as signed shorts (paInt16 to be exact), and pass them off to timecoder. The buffer sizes I use are fairly large (in the thousands), but I've tried small buffer sizes with no luck either. The basic breakdown of how I use timecoder is the following: timecoder_init(&timecoder); //Init the timecoder char* timecode = "serato_2a"; //Select a timecode source timecoder_build_lookup(timecode); //Build LFSR table After receiving a buffer's worth of samples, the following is called: timecoder_submit(&timecoder, this->m_samples, this->m_SamplesSize); ... where m_samples is an array of signed shorts m_SamplesSize is the number of samples Then I immediately do the following: int when = 0; timecoder_get_pitch(&timecoder, &dVinylPitch); dVinylPosition = timecoder_get_position(&timecoder, &when); and every time except the odd fluke time, dVinylPosition ends up being -1 (error) The pitch and position as readback from my program are: At 33 RPM: Debug: dVinylPosition: -1.000000, dVinylPitch: -12.500000, when: 0 Debug: dVinylPosition: -1.000000, dVinylPitch: -6.367286, when: 0 Debug: dVinylPosition: -1.000000, dVinylPitch: -12.500000, when: 0 Debug: dVinylPosition: -1.000000, dVinylPitch: -6.367286, when: 0 (Although tonight dVinylPitch seems to go to around 0.50 at 33 RPM and 0.00 when stopped - progress?) In order to try to see what was going on in timecoder, I enabled the debugging information and tried running both xwax and my code. When running xwax, the debugging output looks like: +2017 +/14723 -/6233 (12930) = 0 (0) 386 [crossings: 2 44] +754 +/14723 -/11124 (12937) = 1 (1) 387 [crossings: 1 23] -2285 +/11124 -/2057 (12915) = 0 (0) 388 [crossings: 2 44] +93 +/14731 -/11862 (12915) = 0 (0) 388 [crossings: 1 21] +1822 +/14731 -/11006 (12922) = 1 (1) 389 [crossings: 1 23] -357 +/11006 -/10510 (12877) = 0 (0) 390 [crossings: 2 44] When running my code, the debugging output looks like (m_SamplesSize: 1412) +1016 +/3758 -/3424 (12226) = 1 (1) 2 [crossings: 32 1412] Debug: dVinylPosition: -1.000000, dVinylPitch: 0.499717, when: 139205596 +1041 +/3855 -/3498 (11993) = 1 (1) 1 [crossings: 32 1412] Debug: dVinylPosition: -1.000000, dVinylPitch: 0.499717, when: 139205596 +1041 +/3855 -/3498 (12044) = 1 (1) 1 [crossings: 32 1412] Debug: dVinylPosition: -1.000000, dVinylPitch: 0.499717, when: 139205596 +1081 +/4037 -/3635 (11668) = 1 (0) x 0 [crossings: 32 1412] Debug: dVinylPosition: -1.000000, dVinylPitch: 0.499717, when: 139205596 +1081 +/4037 -/3635 (11639) = 1 (0) x 0 [crossings: 32 1412] Debug: dVinylPosition: -1.000000, dVinylPitch: 0.499717, when: 139205596 +1046 +/3892 -/3525 (11551) = 1 (1) 1 [crossings: 32 1412] Debug: dVinylPosition: -1.000000, dVinylPitch: 0.499717, when: 139205596 If you look through the lines there, you'll see that 380-ish column, which represents the "number of successful error checks" looks off. (The high number of crossings makes sense since I'm using large buffers.) I haven't the slightest clue what the meaning of all of this is. However, I'd like to mention once again that I've tried it with small buffers (16 and 32), with similar results. Looks like the pitch info is more or less right, but something else is terribly wrong. I've spent hours trying to figure this out and I'm still scratching my head. If anyone has any ideas, I'd appreciate if you could toss me a lifeline. :) Thanks, Albert |