Re: [Bug 21980] New: WaveTable is highly underspecified

 
i took a look at the two files and it's very similar to how i would implement wavetable synthesis with linear interpolation between samples in the wavetable and with linear interpolation between wavetables.  it looks like your wavetables have to have length that is a power of 2
because you are masking to do the modulo arithmetic on the index.  since you are doing linear interpolation, you could avoid masking "readIndex2" if the wavetables had one extra point at the end that was identical to the 0th point.  that's how i did it.
 
i dunno
how fast your pow() function is, but if it is performing a log(2) operation, it seems to me that you can implement that with less computation with exp() instead of pow().
 
detuneScale = powf(2, detune / 1200);

or

detuneScale = expf((logf(2)/1200) * detune);

 
where (logf(2)/1200) is a precomputed constant.
 
also, i have somewhere some power series for fast 2^x and log2(x) functions over a 1 octave range.  might make more sense in a fixed-point setting.
 
L8r,
 
r b-j


---------------------------- Original Message ----------------------------

Subject: Re: [Bug 21980] New: WaveTable is highly underspecified

From: "Chris Rogers" <crogers@google.com>

Date: Wed, May 8, 2013 11:54 pm

To: rbj@audioimagination.com

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

--------------------------------------------------------------------------



> On Wed, May 8, 2013 at 8:46 PM, <rbj@audioimagination.com> wrote:

>

>>

>>

>> it seems to me that if the createWaveTable() method is, essentially, an

>> inverse DFT. is it anything else?

>>

> That's the basic idea, but then this time-domain version has to be sampled

> at many different rates, so we want to avoid aliasing. In WebKit (Blink is

> the same) we use a multi-table approach (similar to mipmaps for graphics)

> where each table uses an inverse DFT, culling out an appropriate number of

> aliasing harmonics. Then when we render the waveform, we select which two

> adjacent tables to use, interpolate between those two, and then use linear

> interpolation...

> https://svn.webkit.org/repository/webkit/trunk/Source/WebCore/Modules/webaudio/WaveTable.cpp

> https://svn.webkit.org/repository/webkit/trunk/Source/WebCore/Modules/webaudio/OscillatorNode.cpp

>

> We have tests where we load up a WaveTable and use it with an

> OscillatorNode, sweeping the frequency from very low to high (something

> like 10Hz -> 20KHz), checking that the aliasing isn't too bad...

>

 

Received on Thursday, 9 May 2013 04:32:21 UTC