If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Question about Boolean Vs Stream signals
10 posts
• Page 1 of 1
Question about Boolean Vs Stream signals
Hi all
I wonder could someone please help me clarify the difference between a Boolean input/output signal, and a stream signal that switches between 1 on 0, in DSP. Wikipedia suggests it’s the same thing, in logic anyway.
I had thought they were interchangeable but I found they’re not.
If I convert a Boolean signal to a Stream signal directly I get a huge level out. It would seem that a Boolean DSP signal represents true or false somehow and is not just 1 or 0.
The stock sine osc uses a “Boolean” signal to hard sync but it works with a 0-1 signal made to look Boolean (using streamboolout instead of just streamout). Martin very kindly made me an optimised sine with sync but this will only work with a “true” Boolean signal for hard sync.
It’s confusing this poor old Vulcan because, in green, they do seem interchangeable.
I need help!
Cheers
Spogg
I wonder could someone please help me clarify the difference between a Boolean input/output signal, and a stream signal that switches between 1 on 0, in DSP. Wikipedia suggests it’s the same thing, in logic anyway.
I had thought they were interchangeable but I found they’re not.
If I convert a Boolean signal to a Stream signal directly I get a huge level out. It would seem that a Boolean DSP signal represents true or false somehow and is not just 1 or 0.
The stock sine osc uses a “Boolean” signal to hard sync but it works with a 0-1 signal made to look Boolean (using streamboolout instead of just streamout). Martin very kindly made me an optimised sine with sync but this will only work with a “true” Boolean signal for hard sync.
It’s confusing this poor old Vulcan because, in green, they do seem interchangeable.
I need help!
Cheers
Spogg
-
Spogg - Posts: 3358
- Joined: Thu Nov 20, 2014 4:24 pm
- Location: Birmingham, England
Re: Question about Boolean Vs Stream signals
Don't forget that a stream always carries information for ALL individual tracks. If 3 notes were triggered, then the stream carries information for all 3. In case of a boolean stream it is the same. Each bit represents another track. In our example the stream will carry 3 different true/false signals. It will never be just 0 or 1. You can't just look at the sum of the bits.
More details will hopefully follow by the experts in DSP.
More details will hopefully follow by the experts in DSP.
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Question about Boolean Vs Stream signals
If you look at the bit pattern it becomes evident:
bool "true": 11111111111111111111111111111111
float 1.0: 0 01111111 00000000000000000000000 (IEEE-754 format)
integer 1: 00000000000000000000000000000001
It is confusing, though, because in FS "green" they are all interchangeable.
bool "true": 11111111111111111111111111111111
float 1.0: 0 01111111 00000000000000000000000 (IEEE-754 format)
integer 1: 00000000000000000000000000000001
It is confusing, though, because in FS "green" they are all interchangeable.
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
Re: Question about Boolean Vs Stream signals
Thanks guys.
So a boolean false is all zeros then? Is this different to a stream value of zero? When I scoped a converted bool signal it switched between zero and HUGE!
I'm imagining that a bool signal carries some sort of header so that a DSP bool input "knows" whether it's a number or a true/false signal. Or it's just down to the input/output type specified in the code.
I think I get it now
Cheers
Spogg
So a boolean false is all zeros then? Is this different to a stream value of zero? When I scoped a converted bool signal it switched between zero and HUGE!
I'm imagining that a bool signal carries some sort of header so that a DSP bool input "knows" whether it's a number or a true/false signal. Or it's just down to the input/output type specified in the code.
I think I get it now
Cheers
Spogg
-
Spogg - Posts: 3358
- Joined: Thu Nov 20, 2014 4:24 pm
- Location: Birmingham, England
Re: Question about Boolean Vs Stream signals
Spogg wrote:So a boolean false is all zeros then? Is this different to a stream value of zero?
Boolean False and 0 happen to be identical, because they are both just zeros. There is no header or anything to tell them apart. It is fully up to the programmer to determine which one should be used. Sidenote, boolean true (all 1s) happens to be identical with "QNaN" (quiet not a number), which is a special value that is used to detect invalid float operations (like division by zero or square root of negative number).
In fact, the stream and boolean stream connectors in flowstone are purely cosmetic - they compile to the exact same code. Only reason why they are there is for visual clarity.
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: Question about Boolean Vs Stream signals
Thanks KG!
I found that
streamboolout out = (t > 1); gives the all 1s value when true
streamout out= 1 & (t > 1); gives 1 when the condition is met.
BUT
streamboolout out = 1 & (t > 1); gives the same as the streamout but is not necessarily recognised as a boolean input by another module.
I guess it depends on the code in the other module, since you say there is no difference in the way it's compiled.
Makes sense now thanks.
Spogg
I found that
streamboolout out = (t > 1); gives the all 1s value when true
streamout out= 1 & (t > 1); gives 1 when the condition is met.
BUT
streamboolout out = 1 & (t > 1); gives the same as the streamout but is not necessarily recognised as a boolean input by another module.
I guess it depends on the code in the other module, since you say there is no difference in the way it's compiled.
Makes sense now thanks.
Spogg
-
Spogg - Posts: 3358
- Joined: Thu Nov 20, 2014 4:24 pm
- Location: Birmingham, England
Re: Question about Boolean Vs Stream signals
to do the conversion in dsp it's->
bool to stream:
streamboolin abool;
streamout result;
result = abool & 1;
stream to bool:
streamin avalue;
streamboolout aboolresult;
aboolresult = avalue == 1 ;
I think they're right,
I tried them
bool to stream:
streamboolin abool;
streamout result;
result = abool & 1;
stream to bool:
streamin avalue;
streamboolout aboolresult;
aboolresult = avalue == 1 ;
I think they're right,
I tried them
-
nix - Posts: 817
- Joined: Tue Jul 13, 2010 10:51 am
Re: Question about Boolean Vs Stream signals
Thanks nix.
I got to that understanding too. Eventually
The thing is that in DSP Boolean "True" isn't 1, it's zillions! Unlike in green
Cheers
Spogg
I got to that understanding too. Eventually
The thing is that in DSP Boolean "True" isn't 1, it's zillions! Unlike in green
Cheers
Spogg
-
Spogg - Posts: 3358
- Joined: Thu Nov 20, 2014 4:24 pm
- Location: Birmingham, England
Re: Question about Boolean Vs Stream signals
Spogg wrote:The thing is that in DSP Boolean "True" isn't 1, it's zillions!
Well (takes a deep breath) technically it isn't really zillions. The 32-bit float format (also called single-precision-float) has a special defined value:
- Code: Select all
1 11111111 00000000000000000000000
The highest order bit tells us the sign. Unset = positive, set = negative
Following are 8 bits for the exponent.
Lastly 23 bits for the fraction part.
As you can see, the fraction part is completely unset. This value stands for "-infinity". So basically the number you get is even lower than a negative infinity.
(Actually I don't know if a value of all bits set is even defined for single precision float, so probably you get unreliable values)
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Question about Boolean Vs Stream signals
Thanks tulamide.
A restless night with boolean nightmares awaits me.
A restless night with boolean nightmares awaits me.
-
Spogg - Posts: 3358
- Joined: Thu Nov 20, 2014 4:24 pm
- Location: Birmingham, England
10 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 52 guests