Re: [music-dsp] Antialiased OSC

2018-08-05 Thread robert bristow-johnson







 Original Message 

Subject: Re: [music-dsp] Antialiased OSC

From: "Ross Bencina" 

Date: Sat, August 4, 2018 2:12 am

To: "A discussion list for music-related DSP" 

--



> Hi Kevin,

>

> Wavetables are for synthesizing ANY band-limited *periodic* signal.

...

>

> If all you need to do is synthesize bandlimited periodic signals, I

> don't see many benefits to BLEP methods over wavetable synthesis.
i might suggest prepending "quasi-" to "periodic".� notes don't have to be 
perfectly periodic, just *mostly* periodic.� one cycle in this quasi-periodic 
waveform should look just like its
adjacent cycles on the left or right.� but it wouldn't necessarily look like a 
cycle 1 second away.

> (1) With wavetable switching, frequency modulation will cause high

> frequency harmonics to fade in and out as the wavetables are crossfaded

> -- a kind of amplitude modulation on the high-order harmonics. The

> strength of the effect will depend on the amount of high-frequency

> content in the waveform, and the number of wavetables (per octave, say):

> Less wavetables per-octave will cause lower frequency harmonics to be

> affected, more wavetables per-octave will lessen the effect on low-order

> harmonics, but will cause the rate of amplitude modulation to increase.

> To some extent you can push this AM effect to higher frequencies by

> allowing some aliasing (say above 18kHz). You could eliminate the AM

> effect entirely with 2x oversampling.
two things:� 1.� the AM effect should *not* affect the lower harmonics that are 
not potential aliases.� as you cross-fade, those harmonics are identical in 
amplitude and phase in the beginning and ending wavetables.� it's only the
highest harmonics that start to fade out (before they alias) as the pitch 
increases.
2. it's possible to show that if you have a sample rate of 48 kHz (so 24 kHz is 
the "folding frequency") and two wavetables per octave you can make all this 
nasty harmonic aliasing (and variation in
amplitude) happen above 19.88 kHz.
at the bottom of the half-octave split, the fundamental is f0.� the Nth 
harmonic is right at 19.88 kHz so N = (19.88 kHz)/f0 and there are no other 
harmonics above it.� at the top of the split the fundamental is 2^(1/2)*f0 and 
the Nth harmonic is
at�2^(1/2)*(19.88 kHz) = 28.11 kHz, if there was no fold over.� but since there 
is, this top harmonic folds over to 48 kHz -�28.11 kHz = 19.89 kHz.� admittedly 
that's a little tight to start fading it out and fading in the waveform that 
has fundamental at 2^(1/2)*f0 and top
harmonic of 19.88 kHz, but you can back off a little and maybe just do this all 
above 19 kHz and put a brickwall LPF at 19 kHz.� i know i (at age 62) won't be 
missing any harmonics above 19 kHz.� below 19 kHz, every harmonic is harmonic 
(unaliased) and unchanging in
amplitude.
another thing you can do is make your splits be smaller than 6 semitone spacing.
and, of course, if the sample rate is 96 kHz, no one will be hearing any 
aliasing nor loss of harmonics below even 24 kHz.� but at 96 kHz, maybe you can 
get away with "naive"
sawtooths and square and maybe even naive hard-sync.� maybe not.
�
--


r b-j� � � � � � � � � � � � �r...@audioimagination.com



"Imagination is more important than knowledge."

�
�
�
�
___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Antialiased OSC

2018-08-05 Thread robert bristow-johnson







 Original Message 

Subject: Re: [music-dsp] Antialiased OSC

From: "Nigel Redmon" 

Date: Sun, August 5, 2018 1:30 pm

To: music-dsp@music.columbia.edu

--



> Yes, thats a good way, not only for LFO but for that rare time you 
> want to sweep down into the nether regions to show off.

�
i, personally, would rather see a consistent method used throughout the MIDI 
keyboard range; high notes or low.� it's hard to gracefully transition from one 
method to a totally different method while the note sweeps.� like what if 
portamento is turned on?� the only way to
clicklessly jump from wavetable to a "naive" sawtooth would be to crossfade.� 
but crossfading to a wavetable richer in harmonics is already built in.� and 
what if the "classic" waveform wasn't a saw but something else?� more general?

> I think a lot of people dont consider that the error of a 
> naive oscillator becomes increasingly smaller for lower 
> frequencies. Of course, its waveform specific, so thats why I 
> suggested bigger tables. (Side comment: If you get big enough tables, you 
> could
choose to skip linear interpolation altogetherat constant table size, 
the higher frequency octave/whatever tables, where it matters more, will be 
progressively more oversampled anyway.)
well, Duane Wise and i visited this drop-sample vs. linear vs. various 
different cubic splines
(Lagrange, Hermite...) a couple decades ago.� for really high quality audio 
(not the same as an electronic musical instrument), i had been able to show 
that, for 120 dB S/N, 512x oversampling is sufficient for linear interpolation 
but 512K is what is needed for drop sample.� even relaxing
those standards, choosing to forgo linear interpolation for drop-sample 
"interpolation" might require bigger wavetables than you might wanna pay for.� 
for the general wavetable synth (or NCO or DDS or whatever you wanna call this 
LUT thing, including just sample playback) i would
never recommend interpolation cruder than linear.� Nigel, i remember your code 
didn't require big tables and you could have each wavetable a different size (i 
think you had the accumulated phase be a float between 0 and 1 and that was 
scaled to the wavetable size, right?) but then that might
mean you have to do better interpolation than linear, if you want it clean.
�
> Funny thing I found in writing the wavetable articles. One soft synth 
> developer dismissed the whole idea of wavetables (in favor of minBLEPs, 
> etc.). When I pointed out that wavetables allow any
waveform, he said the other methods did too. I questioned that assertion by 
giving an example of a wavetable with a few arbitrary harmonics. He countered 
that it wasnt a waveform. I guess some people only consider the basic 
synth waves as waveforms. :-D
>
i've had arguments like this with other Kurzweil people while i worked there a 
decade ago (still such a waste when you consider how good and how much work 
they put into their sample-playback, looping, and interpolation hardware, only 
a small modification was needed to make it into a
decent wavetable synth with morphing).
for me, a "waveform" is any quasi-periodic function.� A note from any decently 
harmonic instrument; piano, fiddle, a plucked guitar, oboe, trumpet, flute, all 
of those can be done with wavetable synthesis (and most, maybe all, of them can
be limited to 127 harmonics allowing archived wavetables to be as small as 256).
these are the two necessary ingredients to wavetable synthesis:� quasi-periodic 
note (that means it can be represented as a Fourier series with slowly-changing 
Fourier coefficients) and bandlimited.� if
it's quasi-periodic and bandlimited it can be done with wavetable synthesis.� 
to me, for someone to argue against that, means to me that they are arguing 
against Fourier and Shannon.
there is a straight-forward way of pitch tracking the sampled note from attack 
to release, and from that
slowly-changing period information, there is a straight-forward way to sample 
it to 256 points per cycle and converting each adjacent cycle into a 
wavetable.� that's a lotta redundant data and most of the wavetables (nearly 
all of them) can be culled with the assumption that the wavetables
surviving the culling process will be linearly cross-faded from one to the 
next.�
and if several notes (say up and down the keyboard) are sampled, there is a way 
to align the wavetables (before culling) between the different notes to be 
phase aligned.� then, say you have a split
every half octave, the note at E-flat can be a mix of the wavetables for C 
below and F# above.� it's like the F# is pitched down 3 semitones and the C is 
pitched up 3 semitones and the Eb is a phase-aligned mix of the two.� this can 
be done with any harmonic or quasi-periodic instrument,
even a piano (but maybe you will need more than 2 splits per octave).
> Hard 

Re: [music-dsp] Antialiased OSC

2018-08-05 Thread Nigel Redmon
Yes, that’s a good way, not only for LFO but for that rare time you want to 
sweep down into the nether regions to show off. I think a lot fo people don’t 
consider that the error of a “naive” oscillator becomes increasingly smaller 
for lower frequencies. Of course, it’s waveform specific, so that’s why I 
suggested bigger tables. (Side comment: If you get big enough tables, you could 
choose to skip linear interpolation altogether—at constant table size, the 
higher frequency octave/whatever tables, where it matters more, will be 
progressively more oversampled anyway.)

Funny thing I found in writing the wavetable articles. One soft synth developer 
dismissed the whole idea of wavetables (in favor of minBLEPs, etc.). When I 
pointed out that wavetables allow any waveform, he said the other methods did 
too. I questioned that assertion by giving an example of a wavetable with a few 
arbitrary harmonics. He countered that it wasn’t a waveform. I guess some 
people only consider the basic synth waves as “waveforms”. :-D

Hard sync is another topic...

> On Aug 4, 2018, at 1:39 PM, Phil Burk  wrote:
> 
> On Sat, Aug 4, 2018 at 10:53 AM, Nigel Redmon  > wrote: 
> With a full-bandwidth saw, though, the brightness is constant. That takes 
> more like 500 harmonics at 40 Hz, 1000 at 20 Hz. So, as Robert says, 2048 or 
> 4096 are good choices (for both noise and harmonics).
> 
>  As I change frequencies  above 86 Hz, I interpolate between wavetables with 
> 1024 samples. For lower frequencies I interpolate between a bright wavetable 
> and a pure sawtooth phasor that is not band limited. That way I can use the 
> same oscillator as an LFO.
> 
> https://github.com/philburk/jsyn/blob/master/src/com/jsyn/engine/MultiTable.java#L167
>  
> 
> 
> Phil Burk

___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp