On Sat, Dec 7, 2013 at 11:04 PM, Julius Smith <[email protected]> wrote: > Ok, I think I see it now. No, the compiler does not commute smooth() with > nonlinear functions, and this is the right thing in general. However, in > many cases such as this, it would be nice to have a smooth primitive that > *does* commute with memoryless nonlinear and/or time-varying block diagrams. > In other words, some new compiler primitive, perhaps "ismooth()", would be > moved by optimization rules to be applied after any memoryless block > diagrams in series with it.
I think this sounds like a good idea. > In this particular case, an alternative is to make a version of tf2s using > the approximate bilinear-transform constant c=2*SR/w1 in place of the more > exact c = 1/tan(w1*0.5/SR) that preserves w1 mapping exactly (nice for > keeping resonators in tune when going from analog to digital). > > Of course, placing smooth() explicitly after the calculation of c as Kjetil > has done is also a perfectly fine solution. > > Another idea could be for the compiler to eliminate instances of smooth() > when it can determine that its input is constant. That way "c = > 1/tan(w1*0.5/SR) : smooth(0.999)" could be used in filter.lib's definition > of tf2s() without adding unnecessary smoothing when w1 is constant. > However, this would require some kind of explicit indication that a signal > is constant, since only the zero signal is truly constant in Faust > (otherwise 1-1' would not generate an impulse at time 0). Since we have > int() and float(), why not constant()? Maybe the 'constant' primitive could > be defined as a block diagram having the same number of inputs as outputs, > and where the negative-time values of each of its input signals are defined > to be its value at time 0 (instead of 0 as now). Then any smooth() > instances after such a "constant block diagram" can be eliminated. If the > value at time zero is not fixed (e.g., there is a slider in the > computation), then it would reduce to bus(N) and smooth() would not be > eliminated. I'm not so sure, sometimes you actually don't want smoothing. It could be a parameter that will change rarely (like, when loading a preset) but that should jump directly to the new value without any lag. -- /Jonatan http://kymatica.com ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Faudiostream-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/faudiostream-users
