Page 1 of 1

Automation of on/off switches

PostPosted: Sat Feb 20, 2021 9:18 am
by Spogg
My current project is a Hurdy Gurdy simulator so I needed to simulate being able to turn individual strings on/off like on a real HG. My plan was that the soft (click-free) string on/off switches could be recorded and automated in the DAW. However, when I tested this it didn’t work correctly in Reaper.
The automation would correctly register my turning the switches on and off and show the action correctly in the automation lane’s envelope. BUT, when I played it back, the switches would turn on but not off until the track had stopped. Thus followed a few hours of investigation as to what was going on and going wrong.

I found that the float value from the automation envelope coming out of the preset parameter prim was not steady at zero, but fluctuating at a very low value, like 0.00000xx.

So I checked and it seems that any float used as a Bool will produce TRUE if it’s not exactly zero. So when the automation value should have been exactly zero it was slightly higher so, since the switch operates as Boolean true/false, it was always True due to this “non-zero noise” and thus the switch never turned off again. I also noticed that the float value of 1 was slightly noisy. I have no idea why DAW zero isn’t actually zero but I made a work-around by using Greater than prims to set a threshold of 0.5 and that works reliably. Maybe someone knows why Reaper’s automation values are not accurate…

The attached schematic is a modified version of the stock bitmap slide switch also with the preset module separate which you could use to replace preset modules in any other toggle switch. I used it in my own LED/switch which is not a bitmap toggle and it works there too.

Of course this will only be interesting if you think the user might want to automate a specific toggle switch.

Re: Automation of on/off switches

PostPosted: Sat Feb 20, 2021 5:45 pm
by deraudrl
Wonder how many other DAWs have the same "bug"...

Seems like using float in their automation tracks/lanes/whatever would seem like the right answer 99.9% of the time. But some of the usual strategies for dealing with denormal numbers will introduce the kind of "near-zero" noise you saw.

Re: Automation of on/off switches

PostPosted: Sat Feb 20, 2021 6:40 pm
by Spogg
I wonder that too. :?

I only checked in Reaper because that’s where I had the problem. Maybe all DAWs do it!

Re: Automation of on/off switches

PostPosted: Sat Feb 20, 2021 6:54 pm
by tulamide
Congrats! You successfully entered the float realm of blurriness :lol:

One possibility lies in the fact that not all values can be reproduced by a float, especially if values are converted between formats. Reaper works with 64 bit floats, which makes the issue less apparent, but Flowstone is still on 32-bit floats. So I see Flowstone as the issue.

Instead of greater than prims (that also just delay the issue theoretically), you could also use rounding. This has the advantage that the value is actually really 1 or 0 afterwards (to avoid further falsifications of the value). A conversion to int and back also should do the trick.

Re: Automation of on/off switches

PostPosted: Sun Feb 21, 2021 9:03 am
by Spogg
tulamide wrote:Instead of greater than prims (that also just delay the issue theoretically), you could also use rounding. This has the advantage that the value is actually really 1 or 0 afterwards (to avoid further falsifications of the value). A conversion to int and back also should do the trick.


Good point.

You see I still think in analogue electronics (being so old) so in a noisy signal situation you would have a comparator with a threshold half way up. Or if the signal was noisy and changing quite slowly I’d use a Schmitt trigger.

I believe rounding is actually similar because you have a threshold of 0.4999999 above which you get a 1 and below which you get a 0. Or am I a bit off with that view?

However I can see that using Integer prims would probably involve fewer triggers, so your idea is better anyway.

Re: Automation of on/off switches

PostPosted: Sun Feb 21, 2021 10:51 pm
by Duckett
Always appreciate an issue being raised, even if it hasn't surfaced for me personally yet ("yet" being the key word).

I might be wrong, but I think Spogg and I have both REAPER and Win 7 in common, so I try to keep an eye out for FS issues with either.

Re: Automation of on/off switches

PostPosted: Mon Feb 22, 2021 8:15 am
by Spogg
Duckett wrote:... I think Spogg and I have both REAPER and Win 7 in common, so I try to keep an eye out for FS issues with either.


Yes indeed.
I have 2 boot drives for Win 7 32 and 64 bit with the appropriate Reaper on each. I test my plugins in both versions except 64 bit of course.