I’m just trying to build a sinus generator with fmod, but I got some trouble with that. I took the userstream code from the samples directory and changed the streamcallback to some constant frequency. I just added constant values to t1 and t2:
t1 += 0.05f;
t2 += 0.05f;
With a sample rate of 44100Hz I get constant ~175Hz from the sound card. But after about 15 seconds this frequency changes to ~178Hz.
I’m using the produced signal to control a step motor, so this inaccuracy is really really bad…
Any idea, what’s going wrong?
It’s a Linux system with OSS as sound system.
- The_Fallen asked 11 years ago
do you mean something like this?
pi = 3.14159......;
t1 = (t1 + 0.05f) % (2*pi);
But don’t you think, that I would get some numerical errors due to the inaccuracy in pi?
Unfortunately I cannot test this now, because I have no oscilloscope available. But I will do so next week.
Please login first to submit.