[sdiy] [synth-diy] integer sample period oscillator
Scott Nordlund
gsn10 at hotmail.com
Wed Feb 19 04:09:15 CET 2014
>> I think it's preferable in general to keep the frequency constant during an entire period, and only change it where the waveform is discontinuous, or where the waveform's slope is zero, so that it doesn't introduce discontinuities to the slope.
>
> Why? Have you tried? What did it bring?
>
> Bear in mind what I'm suggesting is effectively modulating the signal
> going into the phase accumulator. That gets integrated by the phase
> accumulator, which roughly means low-pass filtered. I do not have a
> good name for that signal - do you? So I'm thinking if that signal
> contains aliases, they'll be low-pass filtered. But anyways trying is
> more important than contemplating / constipating.
The low-pass effect of the integrator turns a jump discontinuity into a "corner", but I'd still rather avoid it. It adds less noise to do it at a waveform discontinuity or maximum/minimum. But this is only for the slower modulation that audibly switches between two frequencies, not the noise modulation case. These are two separate things...
>> The noise modulation kind does dither frequency on a per-sample level.
>
> How? I thought what you did was to fix the frequency of each period.
> This per-sample thing is lost on me. Can you explain it? Is there a
> demo on that forum thread?
It's just adding noise to the phase increment in the same manner, only it's random, faster, and I don't care about it doing it at any specific point in the period. In the thread, it's the noisy samples.
>>> You can also shape the noise, giving it a different distribution. The
>>> distribution could cover frequencies other than just the two nearest
>>> to the desired frequency. So you don't have to rapidly switch between
>>> the two nearest frequencies, you could switch to the two next-nearest
>>> as well. And then even less frequently to the next two, etc. The
>>> probability of switching to a specific frequency for a sample could be
>>> a function of distance of that frequency to the frequency that is
>>> desired. This would give you a persistent noise figure whether the
>>> desired frequency falls on an allowed frequency or not.
>>
>> Delta-sigma modulation is used for noise shaping in fractional-n phase locked loops.
>
> I don't know how delta-sigma works in that context. Could you explain
> it to me please?
The first reasonable thing I found is a PhD thesis: http://dns.ime.tsinghua.edu.cn/szdw/gaozhi/Thesis_rhee.pdf
Skip to page 14 and compare sections 2.3.2 (I'm doing approximately the same thing here, but with just the divider; N/N+1 is basically the phase angle increment) and 2.3.3 (delta-sigma). The delta-sigma modulator is the same as any other. Higher order modulators span a wider range of frequencies, as you were proposing. Note that a fractional-n frequency divider is more or less the same as a phase accumulator, only for the divider you're getting a clock pulse out when it overflows, rather than using the accumulator contents directly. Everything else really just amounts to different notation.
The goal with the delta-sigma modulator is to push the noise away from the frequency that you're generating. But the thing is, the noise has both upper and lower sidebands, so for audio synthesis you have to push the lower sideband outside of the audible range without the upper sideband aliasing back into the audible range. And the delta-sigma modulator is complicated compared to just a phase accumulator. A more complex implementation that still requires a fairly high sample rate isn't worth it. It makes sense to do this in a hardware (RF) frequency synthesizer or DAC, but not in software as an improvement to a phase accumulator for sound synthesis with reduced aliasing. In this case I'd rather use something simpler and just oversample more.
>> The noise modulation thing that I'm doing now only adds lots of noise to high frequencies that are between integer periods. I think this doesn't mask the aliasing products as well as delta-sigma modulation, and it isn't terribly rigorous, but it's pretty simple.
>
> If that's the one that has noise bursts during the long pitch slide,
> demo #9, then that's definitely not good enough IMO for a good slide.
Well, obviously none of the demos sound good. The sample rate is too low. But the alternative is a constant noise level that's just proportional to the phase increment (f/Fs). Overall, that actually results in more noise total, rather than just at certain frequencies.
More information about the Synth-diy
mailing list