## Re: [Audacity-nyquist] 1st derivative

 Re: [Audacity-nyquist] 1st derivative From: Roger Dannenberg - 2010-07-28 18:38:40 Attachments: Message as HTML ```Sorry I didn't respond to this while it was fresh. I filed this request for smooth envelopes away to possibly implement or at least think more about. From mathworld.wolfram.com, " Undesirable properties of Bézier curves are their numerical instability for large numbers of control points, and the fact that moving a single control point changes the global shape of the curve. The former is sometimes avoided by smoothly patching together low-order Bézier curves." But patching together low-order curves also creates discontinuities at least in higher derivatives, and I'm not too clear on the band-limit properties of Bézier curves. Furthermore, it's relatively expensive to implement high-order polynomials as functions of time without a primitive to do it. I think a better idea is to use piece-wise linear functions as provided in Nyquist. This has been a standard approach in computer music and audio signal processing for decades. If the discontinuities worry you, then you can run the pwl function through a low-pass filter using any of the Nyquist primitives, which are fast, efficient, and give you simple control over how much smoothing is done. One particular case where pwl functions are a problem is for quick onsets. If you want to smoothly turn on a signal without a click or pop, the usual technique is a "raised cosine", or (1 - cos(t))/2, which generates a sort of "S"-curve from 0 to 1. In my experience, this is noticeably better than a simple linear ramp. You can find an implementation for RAISED-COSINE and examples of its use in nyquist/demos/fft_tutorial.htm. -Roger On 5/20/10 5:48 PM, paul beach wrote: > Help wanted: > > There should be a subroutine for > > (bernstein-list p0 .... pn, dp) ; dp means number of data points. > http://mathworld.wolfram.com/BernsteinPolynomial.html > > which would be used for > > (pwlv-list bernstein) > > This is trivial for 4 points, which was mentioned by Steve. There is a > little problem with that version. The Bezier curve is a parametric > equation. > > x = B(t,x) > y = B(t,y) > > Just use Berntstein(t,x): Otherwise, the piece-wise function could have > 3 or 4 values for one value of time. > > WHY > Roger explains: > "If the first derivative is continuous, the > signal falls off at 18dB per octave, and each additional continuous > derivative gives another 6dB of rolloff. Since we are sensitive to > higher frequencies, it's better not to introduce discontinuities." > > This is contrary to the envelope tools in Nyquist, which introduce > triangular notches. > > Sub bernstein() > bt = 0# > t = 0 > p1 = 1#: p2 = 3#: p3 = 0#: p4 = 1# > > For i = 1 To 11 > > bt = (1 - t) ^ 3 * p1 + 3 * (1 - t) ^ 2 * t * p2 + 3 * (1 - t) * t ^ 2 * > p3 + t ^ 3 * p4 > > Cells(i, 1) = t > Cells(i, 2) = bt > t = t + 0.1 > > Next i > End Sub > ```

## Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks