From: Chris Rogers <crogers@google.com>

Date: Fri, 5 Apr 2013 21:09:00 -0700

Message-ID: <CA+EzO0nEbvE6-YAfycaamhdvwX-O+P0A3TGXOZABfRDhBi6Adg@mail.gmail.com>

To: rbj@audioimagination.com

Cc: "public-audio@w3.org" <public-audio@w3.org>

Date: Fri, 5 Apr 2013 21:09:00 -0700

Message-ID: <CA+EzO0nEbvE6-YAfycaamhdvwX-O+P0A3TGXOZABfRDhBi6Adg@mail.gmail.com>

To: rbj@audioimagination.com

Cc: "public-audio@w3.org" <public-audio@w3.org>

On Thu, Apr 4, 2013 at 6:57 PM, robert bristow-johnson < rbj@audioimagination.com> wrote: > On 4/4/13 7:06 PM, Chris Rogers wrote: > >> Another aspect of the WaveShaperNode is anti-aliasing. In certain cases >> it would be great to be able to up-sample the signal before applying the >> shaping, then down-sampling. This is to avoid the extremely harsh aliasing >> that can occur in applications such as guitar amp simulations. Once again >> we could have an attribute .upsample ("none", "2x", "4x") or something like >> that. Then the default value for that would be "none" I think. >> > > just lurking, and i haven't looked at the code at all, but thought i might > mention a couple of things that might be applicable. > > if you can get away from table lookup and implement the waveshaper by use > of a pure polynomial if finite order, you can get a solid handle on > aliasing. a finite-order polynomial is not as general and a general lookup > table, but for the purposes of distortion (or "warmth" or whatever) in > audio, it might be closer to what you want anyway. you can fit polynomials > to tube curves and the sort pretty well. > > the images generated is no higher in frequency than the order of the > polynomial (let's call that M) times the highest frequency. if that > highest frequency is potentially Nyquist, then upsampling by a factor of N > means that the highest frequency is the *new* Nyquist/N. that makes the > highest frequency image (M/N)*Nyquist. you can allow aliases as long as > they don't get back into your original baseband which is below the new > Nyquist/N. that means > > 2*Nyquist - (M/N)*Nyquist > Nyquist/N > > or > > 2*N - M > 1 > > or > > M < 2*N - 1 > > if you upsample by 2x, you can have a 3rd-order polynomial. if you > upsample by 4x, you can have a 7th-order polynomial. > > then a decent brick-wall LPF with cutoff at Nyquist/N to kill the images > and aliases. then downsample by factor of N and you have output. you > will get the distortion components you were meant to get (harmonics) and no > non-harmonic components which are the tell-tales of aliasing and cheezy > distortion. > > you can do this with table lookup if you make sure the table ain't defined > to wildly (like if it's implementing a Mth-order polynomial), have enough > points in the table (memory is cheap), and at least linearly interpolate > between points. how many points you need (based on what interpolation is > done between points) in the table is something that i had done some > analysis about long ago, but i might be able to find notes. if > computational burden is no problem, i might suggest implementing this as a > polynomial and use Horner's rule. > > just an idea. Thanks Robert, this is really valuable information. I'd still like to support general shaping curves and bit-crushing applications. But I'd really like to get the highest quality sound and best general purpose approach that is possible, especially for these "warming" applications. Best Regards, Chris > > > -- > > r b-j rbj@audioimagination.com > > "Imagination is more important than knowledge." > > > > >Received on Saturday, 6 April 2013 04:09:30 UTC

*
This archive was generated by hypermail 2.4.0
: Friday, 17 January 2020 19:03:18 UTC
*