[sdiy] Waveform phases and hard sync, sawtooth vs. triangle?
Richie Burnett
rburnett at richieburnett.co.uk
Sat Jun 23 21:52:35 CEST 2018
It's easy to render digital versions of oscillator sync with different
waveforms and various reset phases to investigate the audible effect. It
only takes a few minutes with Goldwave's expression evaluator. You can just
use a naive numerical approach to evaluate the sonic influence of oscillator
sync reset phase. (Keep to sensibly low pitches or accept some aliasing in
the output.) You don't need to worry about anti-aliasing unless you
ultimately plan to implement your final algorithm on a digital synthesis
platform where people are free to play oscillator sync with arbitrarily high
pitches and you want a clean output.
-Richie,
-----Original Message-----
From: Magnus Danielson
Sent: Saturday, June 23, 2018 3:23 PM
To: synth-diy at synth-diy.org
Cc: magnus at rubidium.se
Subject: Re: [sdiy] Waveform phases and hard sync, sawtooth vs. triangle?
Hej Mattias,
On 06/21/2018 04:07 PM, Mattias Rickardsson wrote:
> Hi,
>
> is there any general consensus or preferred design choices regarding how
> the phase of sawtooth waves and triangle waves should align with each
> other and with oscillator sync?
Ah, we havve been discussing this before, seems you can't stop thinking
about it every once in a while, but that is good, it creates discussions
so we can learn more through joint analysis.
> I'm sure that there are many sides of it, but for a saw core it feels
> like:
>
> - The normal way of syncing/resetting a saw core is to restart the saw
> from its endpoint
>
> - The tri/sine waveforms are then created by folding the saw in half
>
> This results in a synced tri/sine restarting from one of its peaks,
> leading to maximum discontinuity click which I guess must be considered
> undesired for the majority of usecases.
This discontinuity click needs to be fought one way or another. It adds
a narrow PWM set of overtones to the signal which may or may not be
musically useful.
> The attack of a tri/sine-based drum sound or synth sound should probably
> start from a zero crossing.
You should test around to see if you hear any audioble differences from
different phases at the start of attack. This is relevant for brick-wall
attacks, where is smooth attacks can be expected to make it meaningless.
To test it, you can either trigger the actual attack by the through-zero
of the oscillator, and then delay the actual attack differently to see
if it is meaningful. This will however cause up to a cycle of delay of
the sound, which may or may not be acceptable, so a better approach for
a real synth would be to sync the oscillator hard to the attack, and
vary the delay between attack and sync to see how it sounds. Either way,
you should be able to patch things fairly quickly.
> This could be reached in a couple of ways:
>
> - Is it really desired (from a usability perspective, not a circuit
> design perspective) to have the synced sawtooth restart from the
> endpoint and not the midpoint or quarter points? Does it matter in terms
> of direct sound or audio-rate modulation?
> An alternative restart point for the sawtooth would facilitate a
> triangle restart from a zero crossing without having to change the
> traditional phase alignment of saw & tri.
It is only meaningful in a few contexts:
1) Mixing of waveforms
If you look at the fourier spectrum of sawtooth and triangle waveforms,
where both start with having their high point at the same point in time,
at t=0 you get from the Beta Mathematics Handbook
2h n*2*pi*t
--- sin ------
pi*n T
4h (2n-1)*2*pi*t
------------ cos -------------
pi^2(2n-1)^2 T
for saw and tri respectively for multiple n.
Focusing on the base tone, that is n=1, we clearly see that they would
produce the sin and cos waveforms. As you add these, the amplitude comes
from the Pythagoras summation of the individuals rather than straight
addition. Also, the resulting sum would shift in phase, so dynamic
shifts of this would also cause a phase-modulation of the resulting signal.
If you where to shift the tri-generation phase-wise, you can as you
expect either align them to be both sine (or cosine), or anti-align them
to cancel each other. Also, with aligning them you get straight normal
addition (or subtraction for anti-alignment) and nulls the phase
modulation. If you choose to allow relative shifts, you can get any of
these conditions. I assume you remember my sawtooth phase-shifter, that
idea can come in handy here.
For higher overtones this wraps around with the numbers, but since the
triangle has 1/n² behavior while saw has 1/n, thus the triangle falls
with 1/n faster than saw, very quickly the impact of the phase for the
triangle overtones makes less and less impact to any summation as it is
dominated with the overtones of the sawtooth. There the relative phase
is of little concern.
If you only do static mix, you thus have very little meaning, except for
the exact was that the lower overtones amplitudes shapes. Do whatever
makes your ear happy.
2) Waveshaping
If you do waveshaping, the nonlinearity becomes important, and the way
that overtones inter-mix and their relatively phase beomces somewhat
more interesting. There is a lot of mix products, and your milage may
vary, especially as you modulate things. Realizing the phases of the
waveforms, analyzing the MacLaurin expansion of the non-linearity with
the sum of signals and their overtones and how they mix is uhm,
interesting. In the end, try it and determine if there is any audioble
meaningful difference or not.
One particular useful waveshaper is the PWM, and having both the
triangle and squarewave, you can do PWM from each of them, and that
would produce different results. Again, the big difference will be with
dynamic modulation.
> - Is it really desired (again from a usability perspective, not a
> circuit design perspective) to have the triangle peaks phase aligned
> with the endpoints and midpoints of the sawtooth? Does it make more
> sense considering the phase of the harmonics in case of waveform mixing?
> An alternative alignment would be to have the triangle's zero crossings
> there instead of its peaks. This would mean that the oscillator, when
> synced, starts the sawtooth from its endpoint (traditional) but the
> triangle from the middle (new).
While I understand the time-domain/graphical representation, in the end
I think the fourier domain helps us to understand some aspects, but we
end up needing to test things to figure out if it is relevant or just a
quirky detail that we can find in theory but has no real bearing on the
musical usefulness and function. It may be that the mixing properties
for instance is hugely relevant on it's own, and in that case it becomes
clear what one needs to do.
Cheers,
Magnus
_______________________________________________
Synth-diy mailing list
Synth-diy at synth-diy.org
http://synth-diy.org/mailman/listinfo/synth-diy
---
This email has been checked for viruses by AVG.
https://www.avg.com
More information about the Synth-diy
mailing list