pahse distortion art work


A blog.

Modulation is varying a property of a periodic wave form. Wiggle, wiggle.

Phase Distortion Ingo

Phase distortion was inventend by Casio in the early eighties of last century. It's a special case of phase modulation. The modulator signal and the carrier signal are in sync per cycle. In general phase modulation the don't have to be.

Casio used only linear segments to modulate the phase, but that is not a limitation to stick to. But first,

A word of warning


Experiments with sound synthesis can create extremely loud and nasty sounds.

Don't use headphones! Turn your amps down! Build attenuators into your scripts!

Check the resulting waveform in an audio editor before listening. Audacity or Ocenaudio for example. Both support multiple platforms.


Let's start with a single cycle of a cosine wave. Every Tick we advance the phase by a little bit, while going from 0 to 2*pi. Instead of this normal case, advance the clock a bit faster in the first halve and a bit slower in the second half. Do this in such a way that the frequency of the cosine wave is not changed.

As a result the typical sine wave shape wil be distorted and will sound different.

phase distortion illustrated

The red line in the images is the phase going from 0 to 2*pi. In the first graph it goes at a steady pace. In the second graph the first part is accellerated. The angle is steeper. The second part slows down. The resulting wave form goes towards a saw tooth.


In POV-Ray we have a very nice tool to change the phase. The spline.

#declare Spl = spline{
  0,   <0.0, 0.0> 
  pi,  <pi,  pi/TAU>

#for(i, 0, TAU, 0.05)
  sphere{<i, Spl(i).y, 0>, 0.04 pigment{rgb <1,0,0>}}
  sphere{<i, cos(Spl(i).x), 0>, 0.041 pigment{rgb <0,1,0>}}

In most software you give the spline a t-value and it returns a vector. That's it. In POV-Ray we can vary the t-value of point on the spline and the interpolation wil accellerate or decellerate, even in case of linear splines. In the case of the images above pi has been changed to 0.7

Based on this I created a function that distorts time. This new TickMod is the fed into a SinOsc inside the sample loop.

#declare TAU = 2*pi;
#declare PDSpl = = function{
    0,   <0.0, 0.0> 
    0.7,  <pi, 0.0>
    TAU, <TAU, 0.0>

#declare PDist = function(Freq, Phase, Tick, SRate){
  (SRate/Freq) * PDSpl(Ramp(Freq, Phase, Tick, SRate)).x  

//inside loop
#declare TickMod = PDist(Freq, 0, Tick, SRate);
#declare Sample =  SinOsc(Freq, pi/2, 0.5, TickMod, SRate);

Important is that PDist and SinOsc run at the same frequency


The scene file I added to not only shows the use of phase distortion, but also how to render an animation with sound in one go. Every frame a bit of sound is added to the WAV file. The clock modifies the spline function on each frame.

And sometimes, I confuse my self and loose control, look at T3 racing.

You can use splines with many control points. You can use any type of spline.