Clock Accuracy - 10ms?

For general discussion related FlowStone
User avatar
nix
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am

Re: Clock Accuracy - 10ms?

Post by nix »

Here is a demo screen in stream:-
http://imageshack.com/a/img905/9174/tEtVTU.png

So .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!
Nowhk
Posts: 275
Joined: Mon Oct 27, 2014 6:45 pm

Re: Clock Accuracy - 10ms?

Post 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
Immagine2.png (99.51 KiB) Viewed 23719 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
Immagine.png (14.63 KiB) Viewed 23719 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!!!!
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Clock Accuracy - 10ms?

Post 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)
"There lies the dog buried" (German saying translated literally)
Nowhk
Posts: 275
Joined: Mon Oct 27, 2014 6:45 pm

Re: Clock Accuracy - 10ms?

Post 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 :P

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...
Nowhk
Posts: 275
Joined: Mon Oct 27, 2014 6:45 pm

Re: Clock Accuracy - 10ms?

Post by Nowhk »

Some further notes for maniacs :D
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
Immagine.png (28.55 KiB) Viewed 23706 times

That's a problem!!!

Is there a way on low level language to do a round-down integer rounding?
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: Clock Accuracy - 10ms?

Post 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.
Nowhk
Posts: 275
Joined: Mon Oct 27, 2014 6:45 pm

Re: Clock Accuracy - 10ms?

Post 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...
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: Clock Accuracy - 10ms?

Post by MyCo »

no, "int" always rounds down now. For bi-directional rounding you should use "rndint"
Nowhk
Posts: 275
Joined: Mon Oct 27, 2014 6:45 pm

Re: Clock Accuracy - 10ms?

Post 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...
Nowhk
Posts: 275
Joined: Mon Oct 27, 2014 6:45 pm

Re: Clock Accuracy - 10ms?

Post by Nowhk »

Now the question is: do I really need frames if stream is sync at 44100hz?
Post Reply