Closed myklemykle closed 6 years ago
I'm seeing this on OS X 10.11.6, using faust 2.5.21.
Building with the online compiler and the "coreaudio-qt-deployed" target will also demonstrate this bug.
Not only Faust but Math also is broken as log(0) is not defined ;-)
I am aware that you can't take the log of zero.
However this is a real user interface problem and a true bug. In the real world, log-taper faders controlling the level of signals are ubiquitous, found in all audio gear. One end of them goes to zero ohms, yet their use does not warp reality. (Except perhaps on certain albums from the sixties. =)
My current hackaround for this, for an 0 -> N log slider, is to subtract N from an N-> 0 exponential slider. It works, but the displayed values in the UI are backwards. I suggest Faust should do the same thing during compilation when it sees that a user wants a log taper slider that starts or ends at zero. Seems easy enough.
OTOH, if it's really not a thing that Faust will ever support, then such code shouldn't even compile. The current behavior is clearly broken.
OTOH, if it's really not a thing that Faust will ever support, then such code shouldn't even compile. The current behavior is clearly broken.
I think the current behavior makes sense. It seems like the right limiting behavior as the min approaches zero.
I would vote in favor of a compiler warning, since a min of 1e-38 could suppress the warning and give essentially the same behavior.
On Thu, Mar 22, 2018 at 4:31 PM, Mykle notifications@github.com wrote:
I am aware that you can't take the log of zero.
However this is a real user interface problem and a true bug. In the real world, log-taper faders controlling the level of signals are ubiquitous, found in all audio gear. One end of them goes to zero ohms, yet their use does not warp reality. (Except perhaps on certain albums from the sixties. =)
My current hackaround for this, for an 0 -> N log slider, is to subtract N from an N-> 0 exponential slider. It works, but the displayed values in the UI are backwards. I suggest Faust should do the same thing during compilation when it sees that a user wants a log taper slider that starts or ends at zero. Seems easy enough.
OTOH, if it's really not a thing that Faust will ever support, then such code shouldn't even compile. The current behavior is clearly broken.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/grame-cncm/faust/issues/164#issuecomment-375491342, or mute the thread https://github.com/notifications/unsubscribe-auth/ACGVFTW2tXretiM3cPSR0dq-lCUkYzz1ks5thDRsgaJpZM4S3m0I .
--
Julius O. Smith III jos@ccrma.stanford.edu Professor of Music and, by courtesy, Electrical Engineering CCRMA, Stanford University http://ccrma.stanford.edu/~jos/ http://ccrma.stanford.edu/
@myklemykle Again, there is no Faust bug at this level. A log scale between 0 and 1 doesn't really make sense for a slider. The slider will behave like a button: 0 almost everywhere and 1 only at the maximum. As pointed out by Julius this is the right limiting behavior as the min approaches zero.
So, as suggested, you should not use 0 as the minimum value, but a value close to 0. On this value will depend the "curvature" of your slider. But the more the value will tend towards 0, the more the slider will tend towards a "button" behavior. (see https://www.desmos.com/calculator/8ri4fvj0ho)
In addition, slider's scale metadata are not processed by the Faust compiler, but are implemented directly in the architecture files. (@josmithiii this is why the compiler can't provide any warning in this specific case). It's easy enough to create more scales for your needs. You can have a look at architectures/faust/gui/ValueConverter.h and architectures/faust/gui/faustqt.h...
Yann
When tested with either FaustLive or faust2caqt, this program demonstrates the problem: log scale sliders that start from zero do not give any intermediate values, only zero or the other boundary.
` import("stdfaust.lib");
// This slider works normally. ns = hslider("normal slider 0 to 10", 1, 0, 10, 0.01) : hbargraph("normal slider value",0,10);
// This slider can only have the values 0 or 10 -- nothing in between. ls = hslider("log slider 0 to 10[scale:log]",1,0,10,0.01) : hbargraph("log slider value",0,10);
process = no.noise <: (ns), (ls); `