Playing with Phase Modulation
  • I wanted a way to add life/movement to the wavetables I've been generating, so I've started tinkering with phase modulation.

    I went at it like an animator would.. time is a function that tells you how far through the animation (waveform) you should be. This way you can tinker with the path through the waveform various ways.

    It's pretty easy to generate paths through waveforms, but I also wanted to make a path that was completely smooth (no edges introduced by the animation. I also wanted it to be parameterizable. I've only come up with one so far, attached.

    The alpha function takes a 0-1 input, and outputs 0-1. I derived the function based on some criteria (algebra and basic calculus used):
    - alpha(0) = 0 (time 0 is time 0 even in the function)
    - alpha(1) = 1 (same with time 1)
    - alpha'(0) = alpha'(1) (i.e. the slope of the function as it enters should equal its slope as it leaves, preventing an edge)
    - 0 <= alpha(x) <= 1 for 0<=x<=1 (no clipping of alpha function -> no hard edges)

    Included is a hand-modified version of the AKWF_0002 waveform that allows an alpha function. To use the vanilla waveform, just connect the wavetable node's alpha out to its alpha in.

    The example patch attached modulates the tone slightly. The sound is distinctly FM-y, but maybe that's to be expected.
    20171111 - phase modulation.audulus
    20171111 - phase modulation.audulus 2017-11-13 15-27-30.png
    1024 x 790 - 97K
  • This is great!
  • What a coincidence, I have been having fun with phase modulation all day as well :) This reminds me of how the Intellijel Shape Shifter is designed. Which makes sense as it is basically a phase modulation dual oscillator.

    Edit: Isn't Φ the mathematical symbol for phase? I thought alpha was 0-1 scaling on an input like frequency cut off on a filter.

    Edit 2: Ok, I picked apart the patch a bit more and I think I understand why you labeled things the way you did. I think this is really GREAT! I think it might be more like casio phase distortion more than phase modulation, but it is wonderful sounding and I'm adding it to the other thing I was working on.
  • In my case, alpha came from animation parlance. Or at least my layman's understanding of it. I guess that's the key.. I'm a layman at everything but programming and guitar.. :)

    Glad you like it! If you're interested I can modify my wavetable building code to build the nodes with the alpha hooks. Let me know.

    In reading the Wikipedia article on Phase Distortion, I understood it as more of a smoothed out oscillator sync hack of some kind, but I suppose it could work out to the same thing.

    As an aside, it occurred to me in building my alpha hooks that I didn't have a way to make "normally closed" input jacks.. I.e. if the alphas aren't hooked to anything, use some sort of default, like in your typical semi-modular synths. Has anybody figured out a way to do that?
  • You have to make a toggle to an internally normalized source for things to work reliably. @stschoen figured out a way to normalize a constant, but it glitchs out if you send it a signal. Basically you have a knob with it's built-in range be set to some high range like 1000-1001 and have it connected to an expr that reads something like knob>=1000?InternalSource:knob. That way when you connect a value it overrides the knob's minimum value and breaks the normaling.

    You are right about the terminology of phase distortion, having looked at the wiki also. I must be thinking of something else, although it's definitely the same territory.

    edit: Actually, the Casio PD in the wiki is so close to your trick I think I might have a go at adapting it.
  • So I has a good bit of fun making a complex oscillator out of the rectified sine wave oscillator I was working on in the EMS thread. I put the alpha distortion module in there with a little tweaking so that 0 was a regular ramp and 1 was the full blown sine/ramp thingy that the alpha module turns into.

    What I found interesting is that one oscillator making a noise is like 2% CPU, but two of these cross modulating with a z-1 unit delay node is about 32% CPU. I'm so glad I live in the 21st century!
    Screen Shot 2017-11-14 at 3.16.11 AM.png
    707 x 727 - 115K
    phasor distortion cross modulation.audulus
  • @RobertSyrett That's pretty nice. Seems like it would make a nice drone component. It's fun that pretty much all the motion is coming from noisy sound.

    For what it's worth, it's running at 51% on my iPad Air.
  • So I made a patch based on the Phase Distortion wikipedia article and indeed it did sound like a resonant lowpass filter. Then I added @jjthrash phasor alpha distortion and it sounded like a filter with the resonance wonderfully distorting. Thought I would share.
    Screen Shot 2017-11-16 at 2.01.37 PM.png
    1846 x 964 - 219K
    phase distortion demo.audulus
    Phase Distortion Osc.audulus
  • @RobertSyrett That sounds amazing.
  • That's outstanding! I'll have to read the article.
  • Thanks!

    @stschoen, There is also a Phase Distortion "Insider's Guide" at Insider's Guide to Casio CZ Synthesizers.pdf

    @jjthrash, I increasingly appreciate that the alpha distortion module has slope continuity, it really preserves the bessel functions without adding peaks or edges.
  • @RobertSyrett Glad it's useful! I think I've come up with another one, though it probably needs some tweaking. The cubic emphasizes the middle of the waveform. The attached trigonometric one is like a parameterized smoothstep. Because of the fractional-roots-of-negative-numbers issue I had to hack it to crossfade between two functions, mirrors of each other.

    I determined with some confidence that crossfading between two functions with slope continuity on the range [0,1] leads to a function that also has slope continuity.

    However, that doesn't mean the act of crossfading leads to a clean transition (hence the need for tweaks).

    Combining the alphas leads to interesting results. :)
    20171117 - phase modulation.audulus
    20171117 - phase modulation.audulus 2017-11-17 08-31-15.png
    1024 x 801 - 125K
  • One further comment on the trigonometric alpha function: the knob picks between dual functions, but if the waveform is symmetric and even, there is no difference, and if it is symmetric and odd, there is minimal difference.
  • @RobertSyrett, very interesting articles. Actually a Casio VL-tone was my first synth (if you could call it that. At least it also had a calculator). It's kind of a long story, but two of us bought them primarily for their irritation value and they could certainly produce some of the most irritating buzzes you can imagine. BTW I found another CZ phase distortion patch while searching to see if anyone had done a CZ style envelope generator: