![]() |
![]() ![]() ![]() ![]() ![]()
|
next newest topic | next oldest topic |
Author | Topic: !Fader with variable min/max values | |
JackRosete Member |
![]() ![]() ![]() There seems to be a problem with this script: (ConstantL * (!Max - !Min) + !Min) I have used it within the Value field of a SoundToGlobalController. The Constant is a random number generator outputting values between 0 - 1 at rhythmic intervals. Works fine as long as !Max is greater than !Min. When !Min is greater than !Max, the output should be zero right? Well it still outputs for some reason, as though !Max/!Min had been reversed. Can anyone explain what's going wrong here/how I can fix this? Basically, I want to constrain the random 0 - 1 numbers within !Max, and !Min parameters, so that when !Max is 0, the GlobalController output is also 0. Thanks! IP: Logged | |
HectorBenard Member |
![]() ![]() ![]() Hi Jack, Shouldn't you have an extra set of parentheses? (ConstantL * ((!Max - !Min) + !Min)). Otherwise the !Min is added after the multiplication with the ConstantL. Is that what you want? H IP: Logged | |
SSC Administrator |
![]() ![]() ![]() (ConstantL * (!Max - !Min) + !Min) If Min > Max, then you will be multiplying ConstantL by a negative number (not zero). Take an example case: "I want to constrain the random 0 - 1 numbers within !Max, and !Min parameters, so that when !Max is 0, the GlobalController output is also 0." You could try multiplying the random number by the minimum of the two clipped to the range of (0,1): Or if you still want the smaller value to be used as an offset: Or take the absolute value of the difference for your range and add the minimum of the two as your offset. That would always scale by the DIFFERENCE between Max and Min no matter which was larger: ConstantL * (!Max - !Min) abs + (!Max vmin: !Min) clipTo01 IP: Logged | |
JackRosete Member |
![]() ![]() ![]()
I will attach my Sound which is finished apart from this issue. The script is within the 'GrainAmp' SoundToGlobalController. It is a Sound that emulates (and expands upon) Metasynth's 'Shuffler'. I will post it into the Tweaky as soon as this problem is solved. It works best with sustained pad samples (and vocals for wacky granulation). Thanks! IP: Logged | |
JackRosete Member |
![]() ![]() ![]() Sorry SSC, I didn't see your reply! I will try out those options now. Thanks ![]() IP: Logged | |
HectorBenard Member |
![]() ![]() ![]() Oh yeah, actually that expression only cancells out the !Min as it is subtracted and then added back. ![]() H IP: Logged | |
JackRosete Member |
![]() ![]() ![]() I think I didn't explain the behavior I was looking for very well! Sorry... Your suggestions came close, but none of them was exactly what I had in mind. However! Your maths example really clarified the original code for me (and where it was 'going wrong') and so I came up with this new code, which seems to be working! (!Max gt: !Min) true: (Constant L * (!Max - !Min) + !Min) false: (!Max) As soon as !Max falls below !Min, !Max's value is used. I also came up with another alternative: (!Max gt: !Min) true: (Constant L * (!Max - !Min) + !Min) false: (Constant L * !Max) Which works as above, but when !Max falls below !Min, the random numbers are scaled by !Max, so in effect !Max remains the maximum value and 0 becomes the new minimum value. Thanks! [This message has been edited by JackRosete (edited 01 November 2006).] [This message has been edited by JackRosete (edited 01 November 2006).] 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.