[sdiy] [synth-diy] integer sample period oscillator

Scott Nordlund gsn10 at hotmail.com
Tue Feb 18 05:06:34 CET 2014


> The demos 8-10 and associated descriptions explained the approach
> wonderfully. However I notice that you seem to limit yourself by
> keeping the pitch constant during a whole period. Instead, you could
> dither on sample level. This is not possible with wave tables but is
> possible with synthesized waveforms.

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. The noise modulation kind does dither frequency on a per-sample level. I think another variation that's sometimes used is to add noise to the phase accumulator output, before shaping it into whatever waveform. I think this might help make modulation (i.e. PWM) sound more continuous. I haven't tried it. There are a number of other variations that I should explore...

> 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. Depending on the order, it dithers between more than just two frequencies. It's possible to do that here (minus the PLL) but I think it isn't very useful in this application. It's significantly more complicated, with little apparent benefit. It makes more sense, I think, to just add a fixed amount of noise modulation that's equal to the worst case over a desired frequency range, but this ends up being too much at modest sample rates. 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.

I did also make the noise spectrum adjustable without changing the distribution. It's variable between uniform white noise and a slow bounded random walk. Messing with this can make it sound a little better.

I need to take a fresh look at everything again once I finish some other things. I have a few ideas that I haven't tried. The thing that's kind of been confusing me is that it only really makes sense in the static case, with no modulation applied anywhere. Anything with modulation isn't going to be perfectly harmonic, so the higher frequency aliases aren't going to fall back onto the harmonic series. For inharmonic FM, for example, you can constrain the frequencies of the modulator and carrier, but I think all this means is that the frequencies produced will all fall onto the harmonics of the least common divisor of the carrier and modulator frequencies. That's not really helpful. It's not difficult to make PWM that's well-behaved (just subtract two sawtooth waveforms that each have constrained frequencies), but I want to make it work in other cases too, if possible. It's sort of difficult to understand, because variation over time and aliases that fall back onto the harmonic series seem to be contradictory requirements. I don't know if there's a "good enough" compromise here, because I don't really know what that would entail. 		 	   		  


More information about the Synth-diy mailing list