W3C home > Mailing lists > Public > public-audio@w3.org > April to June 2013

Re: Interpolation on WaveShaperNode?

From: Ehsan Akhgari <ehsan.akhgari@gmail.com>
Date: Wed, 15 May 2013 18:36:26 -0400
Message-ID: <CANTur_78XBik_GuZ6O2ozR5asoHSmTvi20THWOjqNoX9t2E7Hw@mail.gmail.com>
To: Chris Rogers <crogers@google.com>
Cc: rbj@audioimagination.com, "public-audio@w3.org" <public-audio@w3.org>
On Wed, May 15, 2013 at 4:45 PM, Chris Rogers <crogers@google.com> wrote:

>
>
>
> On Mon, May 13, 2013 at 3:27 PM, Ehsan Akhgari <ehsan.akhgari@gmail.com>wrote:
>
>> On Mon, May 13, 2013 at 3:09 PM, Chris Rogers <crogers@google.com> wrote:
>>
>>>
>>>
>>>
>>> On Mon, May 13, 2013 at 11:32 AM, Ehsan Akhgari <ehsan.akhgari@gmail.com
>>> > wrote:
>>>
>>>> FWIW, in Gecko, I'm implementing linear interpolation by default.
>>>>
>>>
>>> Good, I think that's what we should do for the default, but we could
>>> consider an attribute "linear" or "nearest-neighbor" to select the
>>> interpolation method.  On the other hand, it's pretty easy to create the
>>> "bit-crushing" effects even with linear interpolation as long as the table
>>> size is suitably large, so maybe all we need is linear.
>>>
>>> WebKit/Blink are not doing the linear interpolation, so that'll have to
>>> change.
>>>
>>
>> Sounds good.  Can you please spec this as well?
>>
>>
>>> By the way, I've been looking in some detail about how to implement a
>>> "high-quality" mode for the shaper, which up-samples the signal to a higher
>>> sample-rate (2x, in the simple case), does the shaping, then down-samples
>>> back down to the node sample-rate.  This type of processing is important
>>> for guitar amp simulation and other simulation of analog gear to avoid the
>>> harsh aliasing.  I think the default mode of operation for the shaper
>>> should not do this up-sampling, but that it would be good to opt-in by
>>> having a .quality attribute.
>>>
>>
>> Are you planning to add the quality attribute right now, or wait for a
>> "post-v1" spec?
>>
>
>  I think it's important to get in as soon as possible, because developers
> are already trying to use the WaveShaperNode for more serious pro-level
> purposes and are bumping up against the quality issues:
> http://dashersw.github.io/pedalboard.js/demo/
>

Hmm, looks like this demo uses webkitAudioContext, so hard to say how it
sounds in Firefox which already does linear interpolation.


> I actually wrote a pretty good first pass at the up-down-sampling code
> yesterday, and was able to test it at a basic level.  This is low-level
> "blitter" code which I'm happy to share with Mozilla.
>

Cool.  At this stage I'm more interested to see the spec changes to be
honest -- hopefully it's clear enough that we can implement it without the
need to borrow code, but of course I don't mind looking at the code you
have too!  :-)

Cheers,
--
Ehsan
<http://ehsanakhgari.org/>
Received on Wednesday, 15 May 2013 22:37:34 UTC

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