0
0

I have a question about optimizing CE apps for timing with FMOD. In particular, I’m trying to take audio that has a burst of tones and count the number in the burst. For example, a burst of tones may have 8 individual tones, each 30ms or so long with 50ms or so of white noise in between each tone.

My app works (more or less) for tones with a length > 100 ms, but falls apart when the tone length drops. (the count is incorrect).

I am hoping that someone can help me optimize FMOD settings for maximum ‘real-time performance’ (recognizing that WinCE is not an RTOS and there will be some issues with the OS itself).

Ok, that said, here are my settings:

[code:3mdaskuz]

define RECORDRATE 11025

define RECLENTH (RECORDRATE * 1) // 1 second at recordrate khz

...

FSOUND_SetBufferSize(300);
FSOUND_SetMixer(FSOUND_MIXER_QUALITY_MONO);

...

FSOUND_Init(65535, 2, FSOUND_INIT_ACCURATEVULEVELS)

...

samp = FSOUND_Sample_Alloc(FSOUND_UNMANAGED, RECLENTH, FSOUND_NORMAL, RECORDRATE, 255, 128, 1);

FSOUND_Sample_SetMode(samp, FSOUND_LOOP_NORMAL);
FSOUND_Record_StartSample(samp, TRUE);
channel = FSOUND_PlaySound(FSOUND_FREE, samp);

...
FSOUND_GetCurrentLevels(channel, &lVU, &rVU);
[/code:3mdaskuz]

So, I’m basically setting up a record/playback, grabbing the current levels and counting the number of ticks (ms) since a threshold was crossed. I’m doing this in the message loop. I’ve modified the FMOD common.cpp file such that:
[code:3mdaskuz]
timerid = SetTimer(hWnd, 1, 10, 0L); // 3rd param is 10 ms, was 50ms
[/code:3mdaskuz]

Questions…
1) I’m comparing the current (instantaneous) VU level from GetCurrentLevels to a running average (of noise/signal) to detect a tone. Is this method fast enough?
1a) Is FSOUND_INIT_ACCURATEVULEVELS what I want?
2) I’ve tried various combinations of FSOUND_Init, RECORDRATE, RECLENGTH… have I really got these set (above) to values that will give me the ultimate in sound/duration measurement?
3) What else can I do to squeeze performance/timing (determinism) out of this beast?

I’m checking GetCurrentLevels in a function update_positions() that’s called often (in the WinMain message loop):

[code:3mdaskuz]
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
update_positions ();
}
[/code:3mdaskuz]

Any ideas?!?!? Is this sort of thing possible on a 400 MHz CPU PDA running WM2003?

Thanks!

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.