[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Sc-devel] scsynth strange bug when high values on floats
Hello everyone,
I use a counter to sync events in my application and started noticing
fluctuations in the results; Beyond of what was expected.
After a while of searching for the source of the problem I discovered
the problem presents only after a Phasor UGen reaches a certain count
or in a custom UGen that simply reports this when triggered:
(unit->mWorld->mBufCounter * unit->mWorld->mBufLength) + blkOffset
I use an Impulse UGen to poll the counter's value.
Here is a simplification of the code:
l=0;
o=OSCresponder(s.addr,'/tr',{ arg t,r,msg;
[msg[3], msg[3] - l].postln;
l = msg[3];
}).add;
k = 2 ** 32 - 1;
SynthDef("counter_I", {
SendTrig.ar(Impulse.ar(1), 101, Phasor.ar(0,1,0,k,0))
}).send(s);
z = Synth("counter_I");
the first weird figure appears consistently here:
[ 16698237, 44100 ]
[ 16742337, 44100 ]
[ 16786436, 44099 ] <--
[ 16830536, 44100 ]
[ 16874636, 44100 ]
[ 16918736, 44100 ]
not much of a deal but still way odd.
The real problem starts after about 20 mins of instantiating the UGen graph:
(or 20 minutes of booting the server - my custom UGen is reporting
processed samples back to the lang).
[ 54848200, 44100 ]
[ 54892300, 44100 ]
[ 54936400, 44100 ]
[ 54980504, 44104 ] <--
[ 55024600, 44096 ]
[ 55068704, 44104 ]
[ 55112800, 44096 ]
[ 54419400, 44100 ]
[ 54463500, 44100 ]
[ 54507600, 44100 ]
[ 54551704, 44104 ] <--
[ 54595800, 44096 ]
[ 54639904, 44104 ]
[ 54684000, 44096 ]
[ 54419400, 44100 ]
[ 54463500, 44100 ]
[ 54507600, 44100 ]
[ 54551704, 44104 ] <--
[ 54595800, 44096 ]
[ 54639904, 44104 ]
these seem good:
mBufCounter: 858439 mOffset: 9 pos: 54940104.000000
[ 54940104, 44100 ]
mBufCounter: 859128 mOffset: 13 pos: 54984204.000000
[ 54984204, 44100 ]
mBufCounter: 859817 mOffset: 18 pos: 55028304.000000
[ 55028304, 44100 ]
mBufCounter: 860506 mOffset: 22 pos: 55072408.000000
[ 55072408, 44104 ]
mBufCounter: 861195 mOffset: 26 pos: 55116504.000000
[ 55116504, 44096 ]
mBufCounter: 861884 mOffset: 30 pos: 55160608.000000
[ 55160608, 44104 ]
mBufCounter: 862573 mOffset: 34 pos: 55204704.000000
[ 55204704, 44096 ]
mBufCounter: 863262 mOffset: 38 pos: 55248808.000000
[ 55248808, 44104 ]
mBufCounter: 863951 mOffset: 42 pos: 55292904.000000
The problem can be partially solved by killing the synth and relaunching it.
I looked into the Impulse UGen code - all seems good there; the
server's code and found some minor inconsistencies in the handling of
mBufCounter type; Corrected these but the error is still there.
any ideas where this bug may be lurking any one, JMC?
thanks,
x