![]() |
![]() ![]() ![]() ![]() ![]()
|
next newest topic | next oldest topic |
Author | Topic: Invert 1 doesn't give 0 | |
gustl Member |
![]() ![]() ![]()
When I want to invert a constant 1 using a ScaleAndOffset with -1 for Scale and 1 for Offset I don't get 0 at the output - I get 4.6566...d-10. Why is that? I made 2 workarounds: The first one uses a threshold with a threshold of 1.0e-9. The second one uses a gain module and a mixer instead of the ScaleAndOffset to invert the 1. Both of them work. Attached are examples and the workarounds. And BTW what is the smallest possible value above 0? I'm doing some logic using Threshold modules and I guess 1.0e-9 is not the smallest value? I can't use 0 because then a logical trigger (0-1) wouldn't work. Thanks! [This message has been edited by gustl (edited 17 February 2015).] IP: Logged | |
SSC Administrator |
![]() ![]() ![]() A signal value of 1 is slightly smaller than 1 due to the binary representation of the number. For a threshold, you could try -30 twoExp IP: Logged | |
gustl Member |
![]() ![]() ![]() Thanks SSC, the binary representation came to my mind too, but why is it working when I use a Gain module to multiply by -1 and a Mixer to add a Constant 1? Anyway, I'll encapsulate that workaround and use it to invert logic ![]() Thanks for threshold value! It already worked well with 1.0e-9 but I wanted to make sure it's accurate. IP: Logged | |
gustl Member |
![]() ![]() ![]() Now I have another problem with same issue: I want to use a 1 samp FeedbackLoop to store a value and also want to reset the loop to zero. So I use a Product module in the FeedbackLoop and multiply the loop by 1 all the time. To reset I multiply by 0. Now the problem is since there is no real 1 my stored value slowly decreases.. I tried multiplying by -1 all the time and multiply the output by -1 again but that doesn't solve it. I guess there is no real -1 too? Is there a workaround for this? IP: Logged | |
SSC Administrator |
![]() ![]() ![]() How are you using the stored value? Could you use TriggeredSampleAndHold instead? [This message has been edited by SSC (edited 18 February 2015).] IP: Logged | |
gustl Member |
![]() ![]() ![]() No, I can't, I'm using the loop to sum values and store the result until reset. For example you can have a samplerate countTriggersMod module like that by using 1 samp wide triggers and divide them by e.g. 10 before feeding them into the loop. Each trigger adds 0.1 to the output value then. To reset I use an equality module to check if the loop has reached 1 and multiply the inverted output of the equality with the loop. It does work if I set the tolerance for the equality right but as the stored value slowly decreases after some time of running it will not work.. A module which works exactly like the Product module but only accepts two states (1 and 0) and where the 1 is like a bypass instead of multiplying by nearly 1 could be a solution [This message has been edited by gustl (edited 18 February 2015).] IP: Logged | |
rafe Member |
![]() ![]() ![]() Hi Gusti Could you muliply or scale your signal (that is a binary rep of 1) by some value so it becomes close to 2 (at least greater than 1 ) then force the signal to exactly 1 with the "clipTo01" command? I haven't looked at the sound in context just a theoretical idea. IP: Logged | |
gustl Member |
![]() ![]() ![]() Hi rafe, Yes I could but then I could also use the corresponding CapyTalk message countTriggers: reset: - the thing is I want to do that (and lots of other stuff) at samplerate and therefore I can't use CapyTalk.. [This message has been edited by gustl (edited 18 February 2015).] IP: Logged | |
rafe Member |
![]() ![]() ![]() Ah of course - sample rate! IP: Logged | |
pete Member |
![]() ![]() ![]() Instead of multiplying by 1 and zero, could you not multiply by 0.5 and zero and put in a gain module set to a gain of 2 ? It's only value absolute 1 that it has a problem with, because 2s complement numbers in the range +/-1 reach absolute minus one but not quite absolute plus one. This is because zero is considered to be the first positive number there is one less positive value (than there are negative values). IP: Logged | |
gustl Member |
![]() ![]() ![]() Thanks Pete, I'll give that a try! IP: Logged | |
gustl Member |
![]() ![]() ![]() Multiplying by 0.5 and then multiplying by 2 doesn't work because the near 1 will be a near 0.5 after multiplication. But I found a workaround: Multiply the trigger by 0.5, then add -32 twoExp using a Constant and a Mixer, then multiply by 2. IP: Logged |
All times are CT (US) | next newest topic | next oldest topic |
![]() ![]() |
This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.