Page 6 of 9
Re: Clock Accuracy - 10ms?
Posted: Wed Dec 16, 2015 1:00 pm
by nix
Here is a demo screen in stream:-
http://imageshack.com/a/img905/9174/tEtVTU.pngSo .6 becomes one in a mono stream integer
Floats are usually used for constants in a stream,
but if you change the float value, the stream will update on next sample
Note the number of zeros, I used 441,000 samples
8D Enjoy and every success- pleased to help!
Re: Clock Accuracy - 10ms?
Posted: Wed Dec 16, 2015 2:52 pm
by Nowhk
nix wrote:So .6 becomes one in a mono stream integer
I see. So the built-in Int module already does this round. This explain why 0.51 (and not 0.50) read new sample:

- Immagine2.png (99.51 KiB) Viewed 23725 times
approximation fault

All is very more clear!!!
nix wrote:Floats are usually used for constants in a stream,
but if you change the float value, the stream will update on next sample
Oh ok, they are "read-only-one"! So it won't continuously change between stream and float "threads", thus there is not asynch operations if I don't change them, nice.
nix wrote:Note the number of zeros, I used 441,000 samples
Oh nice, now I got it! You put x10 as max limit, and divided by 44100 (so each 1 second). Nice, but I'd prefer somethings like this:

- Immagine.png (14.63 KiB) Viewed 23725 times
and change speed with a knob

Since this won't impact on the sync if I don't move it, its fast to adjust values with GUI.
nix wrote:8D Enjoy and every success- pleased to help!
You really does it! Thank you!!!!
Re: Clock Accuracy - 10ms?
Posted: Wed Dec 16, 2015 5:20 pm
by tulamide
There is no error!
Rounding a number is defined as such.
round(n)
everything up to x.50 gets rounded down to the current integer x (n = x), everything from n > x.5 gets rounded up to the next integer (n = x+1)
There are two other rounding types:
floor(n)
everything from x.0 to n < x+1 gets rounded down to the current integer (n = x)
ceil(n)
everything from x.0 to n < x+1 gets rounded up to the next integer (n=x+1)
Re: Clock Accuracy - 10ms?
Posted: Wed Dec 16, 2015 5:25 pm
by Nowhk
tulamide wrote:There is no error!
Rounding a number is defined as such.
round(n)
everything up to x.50 gets rounded down to the current integer x (n = x), everything from n > x.5 gets rounded up to the next integer (n = x+1)
There are two other rounding types:
floor(n)
everything from x.0 to n < x+1 gets rounded down to the current integer (n = x)
ceil(n)
everything from x.0 to n < x+1 gets rounded up to the next integer (n=x+1)
Yes, why this happens on the Read module makes more sense! That -0.5 makes the trick

Since we are in discussion: is there a way to start/stop the DSP code? Such as "Is Playing" iterate, else stop. I guess the solution is to swap a float variable and send 0 as iteration step... but maybe there is a clever way...
Re: Clock Accuracy - 10ms?
Posted: Thu Dec 17, 2015 11:16 am
by Nowhk
Some further notes for maniacs
I changed the DSP code from
this:
Code: Select all
streamout i;
i = i + 1;
i = i&(i<10);
to
this:
Code: Select all
streamout out;
float i = 0;
out = i;
i = i+1;
i = i&(i<10);
this because at very first iteration, it will skip the first (0) value, since it's i+1 from beginning.
Also, that "-0.5" trick works for float value. If I use integer step, this will
fails.
For example:
0 become -0.5, which is 0
1 become 0.5, which is 0 (1 is at 0.51)
2 become 1.50, which is 2
so I'll miss the sample at index 1:

- Immagine.png (28.55 KiB) Viewed 23712 times
That's a problem!!!Is there a way on low level language to do a round-down integer rounding?
Re: Clock Accuracy - 10ms?
Posted: Thu Dec 17, 2015 11:36 am
by MyCo
I guess there was a bug in the "int" function causing "int" to round up. I just tested it with the current Beta version (= new DSP/ASM) and it's fixed there.
Re: Clock Accuracy - 10ms?
Posted: Thu Dec 17, 2015 11:46 am
by Nowhk
MyCo wrote:I guess there was a bug in the "int" function causing "int" to round up. I just tested it with the current Beta version (= new DSP/ASM) and it's fixed there.
I can't use the new Beta Version, since I'm using FlowStone inside FL Studio, and at the moment I don't know if it will be supported there.
Are you saying that .5 now will always round up to 1 and not 0? Because also 2.5 round to 2 instead of 3. The same for any odd values. i.e. 1,3,5,7 (-0.5 each) rounds to 0 2 4 6 instead of 1,3,5,7...
Re: Clock Accuracy - 10ms?
Posted: Thu Dec 17, 2015 11:50 am
by MyCo
no, "int" always rounds down now. For bi-directional rounding you should use "rndint"
Re: Clock Accuracy - 10ms?
Posted: Thu Dec 17, 2015 11:57 am
by Nowhk
MyCo wrote:no, "int" always rounds down now. For bi-directional rounding you should use "rndint"
This will be perfect! I won't need the "-0.5" trick anymore.
It might works for any value (integer and float) for my intent...
Re: Clock Accuracy - 10ms?
Posted: Sat Dec 19, 2015 5:52 pm
by Nowhk
Now the question is: do I really need frames if stream is sync at 44100hz?