Re: Oscillators with time-domain custom wave shape

Hi Chris,

I am not criticizing the oscillators. They are indeed good at what they do
:)

At the moment, there is no way to make custom non-bandlimited oscillators
right?

> If you need both file position and also a waveform, it would seem better
to use a loop,

I am not sure I understand what you mean here. I mentioned synthesis just
as another use case , I don't actually need "both file position and also a
waveform" as you said.

Basically, the initial idea for me was that I want to read a sound file by
using a WaveShaperNode instead of BufferSourceNode. What it provides, is
that you control directly the read position with another AudioNode, which
is amazingly flexible and allows to do a lot of very funny things by
connecting different types of control signals. You can read you sound with
ramps, exponential ramps, sine waves, triangle waves (
http://sebpiq.github.io/WAATableNode/demos/cello-drone.html) ... it is
hugely flexible. Now, I can also for example just loop the sample (as I
would for a BufferSourceNode), but vary the start position, end position of
the loop live (by using a sawtooth and adding an offset for start position,
and a gain for end position), and vary the playrate (by varying the
frequency of the sawtooth). This is not something I can do with a
band-limited oscillator. For these in fact, I need to be sure of what my
control signal is going to look like.
Once again, I know it might be hard to understand from a Web Audio
perspective, but this way of doing things come from the usage of Pure Data
and SuperCollider where this is THE way to playback buffers, and allows you
to easily do crazy things, granular synthesis, wavetable and so on ... and
the real reason why I need it is to implement it into WebPd.

More generally, I have the feeling that this something that the
BufferSourceNode should be fully capable of doing, as it sounds to me like
the right object for this job. However the current spec is not precise
enough to enforce this on the BufferSourceNode, thus it is not reliable
enough for a serious use as what I am thinking about. So I was wondering if
that's something that could improved !?

On Tue, Mar 31, 2015 at 7:01 PM, Chris Lilley <chris@w3.org> wrote:

> Hello Sébastien,
>
> Monday, March 30, 2015, 4:10:45 PM, you wrote:
> > In the past days I've struggled to get an oscillator that would
> > output an exact sawtooth. The use case for me is to modulate an
> > AudioParam and the approximative sawtooth provided by the
> > OscillatorNode is not precise enough. For example, I wanted to loop
> > through a sound file, using WaveShaperNode, and drive the read
> > position in that file with a sawtooth, but since the decrease after
> > the top of the sawtooth is not instant, you can hear a very loud
> > artifact when you reach the end of the file (peak of the saw), a bit
> > like fast rewind.
>
> Not having an infinite slope is a feature, not a bug (this is
> bandlimited synthesis, to minimize aliasing artifacts from frequencies
> above Nyquist).
>
> If you want a non-bandlimited sawtooth, you would need to make a
> custom oscillator (and subsequent nodes may introduce bandlimiting).
>
> To just iterate through file positions, this is just a loop, right?
> Why drive this from a waveform? If you need both file position and
> also a waveform, it would seem better to use a loop, the counter for
> which is used directly to produce the file position and also to create
> a phase pointer for whatever waveform you are generating.
>
>
> --
> Best regards,
>  Chris Lilley, Technical Director, W3C Interaction Domain
>
>


-- 

*Sébastien Piquemal*

 -----* @sebpiq*
 ----- http://github.com/sebpiq
 ----- http://funktion.fm

Received on Tuesday, 31 March 2015 18:27:43 UTC