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:
define RECORDRATE 11025
define RECLENTH (RECORDRATE * 1) // 1 second at recordrate khz
FSOUND_Init(65535, 2, FSOUND_INIT_ACCURATEVULEVELS)
samp = FSOUND_Sample_Alloc(FSOUND_UNMANAGED, RECLENTH, FSOUND_NORMAL, RECORDRATE, 255, 128, 1);
channel = FSOUND_PlaySound(FSOUND_FREE, samp);
FSOUND_GetCurrentLevels(channel, &lVU, &rVU);
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:
timerid = SetTimer(hWnd, 1, 10, 0L); // 3rd param is 10 ms, was 50ms
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):
while (GetMessage(&msg, NULL, 0, 0))
Any ideas?!?!? Is this sort of thing possible on a 400 MHz CPU PDA running WM2003?
- dxmonger asked 12 years ago
- You must login to post comments