# Simple phase shift circuit

I’d like to be able to phase shift a raw guitar signal with a potentiometer between 0 degrees and 360 degrees. The signal is roughly 1V peak to peak and has a fundamental frequency range between 80Hz and around 1000Hz and has harmonic frequencies up to around 10kHz.

I know filters have certain phase shift responses across a certain frequency range, but I don’t want to attenuate my signal, I just want the ability to phase shift it at will. Is this possible with a few op amps and passive components?

I don’t care about attenuating the harmonic frequencies but I’d like to keep the fundamental frequencies as intact as possible.

Edit:

@Transistor: My original motivation for asking this question was in an effort to reproduce the oscilloscope effect shown in this video. I think they are achieving the visual effect in the video with the XY mode on an analog oscilloscope and projecting a live video feed of the oscilloscope screen. I believe the channel 1 input is the raw guitar signal and the channel 2 input is a very slightly delayed (ie phase shifted) version of the same signal. When I first started thinking about this problem, I thought that the channel 1 input could be coming directly from the guitar and the channel 2 input could be coming from the end of a pedal board containing some DSP hardware that reproduces the signal with an imperceptible delay, which got me thinking about reproducing the effect using a simple phase shift circuit. Regardless of the method the musicians used to create the visual effect in the video, I'm still interested in whether or not an answer to my original question exists.

• I shall very much enjoy reading the answers to this one. – jonk Jan 5 at 9:31
• A phase shift circuit will affect different frequencies differently. What is the purpose of this? What is the real problem you are trying to solve? – Transistor Jan 5 at 9:39
• @Transistor - See my edit above. – Sean Dever Jan 5 at 10:04
• The logical problem with your question is that "phase" is only defined for single sinusoids/frequency components. It is meaningless to say, that a whole guitar signal is shifted by xxx degrees. What you can require however, is to delay the signal by a certain time period. For that you would need to build something with a memory (in the distant analog past they used lots of capacitors, today you will use digital memory). Simple implementation: use a microcontroller with sufficiently fast ADC and sufficient memory for your delay time. You definitely can't do that with a few OpAmps. – oliver Jan 5 at 10:06
• @oliver - This is sort of why I clarified that I don't care about the harmonic frequencies, just the possible discrete fundamental frequencies defined by the fretboard. Do you think it would be possible given a smaller range of discrete frequencies? (Eg 500Hz, 510Hz, and 520Hz) – Sean Dever Jan 5 at 10:14

A fixed phase delay is difficult to make. You have to have a time delay that varies with the frequency.

As you've mentioned, filters have a phase delay that varies with frequency. You can chain multiple filters together to get phase delays that add up to whatever fixed phase delay you would like.

A variable phase delay (same phase delay for all frequencies) would be difficult to build, and I'm not sure you could make it easily variable with a single potentiometer.

The "Pure Data" Hilbert function makes use of a pair of filters whose phase delays sum to 90 degrees to approximate the real Hilbert function. The approximation holds over a very large part of the audio spectrum, but it fails at low frequencies. I learned that the hard way by trying to use the PD Hilbert function at low frequencies. The results of the algorithm using the Hilbert function were wrong, and I eventually narrowed it down the Hilbert function itself. I used Lissajous figures to look at the Hilbert output and discovered that they were very far from being 90 degrees apart at low frequencies.

The visual display in the video shows what are called Lissajous figures. These are made by plotting two signals against each other using the XY mode of an oscilloscope. You can see the grid of an oscilloscope display in the video. They appear to be using a video camera to capture the screen of an analog oscilloscope.

Lissajous figures can be made from two independant signals, or from one signal with a delay.

One use of such figures is to see how different the two channels of a stereo signal are. If they are identical, then you get a diagonal line.

Another use is for detecting (or measuring) the phase delay of two signals - say, checking on the phase delay of an amplifier.

The video appears to be using a fixed time delay. That causes a varying phase shift as the frequency changes.

As an example, a time delay of 1 millisecond is a phase delay of 360 degrees for a 1000 hertz tone, but only a 90 degree phase delay for a 250 hertz tone.

You can make a fixed time delay by using an all pass filter.

A simpler way to do it would be to place two microphones at a certain distance from each other in front of the speaker. Two microphones in line about 0.34 meters apart will give about a 1 millisecond delay. Shorter distances will give a shorter delay.

$$\T= d/343\$$ gives the time delay $$\T\$$ in seconds when $$\d\$$ is given in meters.

At such short distances the volume shouldn't drop much - any difference in volume could be compensated by adjusting the gain for the microphones.

The mixing board used for the stage might also have an adjustable delay built in. There are also effect boxes (pedals) used to make adjustable delays.

A fixed time delay is more interesting as a visual display than a fixed phase delay.

The frequency has no influence on the shape of the display for a fixed phase delay - all frequencies would look the same and the only variation would come from the volume.

For example, a fixed phase of 90 degrees would be a circle whose radius varies with the volume of the music.

A fixed phase is also very difficult to create.

A fixed time delay is easy to make.

A fixed time delay means the displayed shape changes with frequency and volume - it is much "livelier" in appearance.

• Very good point on using a delay! That way one avoids the difficulties with the different amplitude of the derivative, as suggested by my answer. But then again, a delay is not easily implemented "with a few OpAmps", as opposed to the derivative, which is. – oliver Jan 5 at 17:06
• @oliver: A delay is easily implemented using commonly available effects pedals, or just two microphones and a regular stage audio mixer board. – JRE Jan 5 at 17:09
• Sure. It's only that the OP wanted "a few OpAmps". Nevertheless the two microphones is a brilliant idea in itself. Just be aware that a microphone "transmission line" requires quite long distances for phase shift to become effective already at low frequencies (the ones that are dominant). If you want 90 degrees at 16 Hz you would need mikes at ~5 meters apart. – oliver Jan 5 at 17:14

You can produce these Lissajous-type effects you refer to in your edited question by deriving the original guitar signal. You can achieve that by a usual differentiator circuit, which can be implemented by a single OpAmp. Then you plot the original signal (x) against the differentiated signal (y).

Simplest example would be a single sinusoid, which produces an elliptical pattern on the screen:

$$x(t)=A\cdot sin(\omega t)$$ $$y(t)=\frac{dx}{dt}=A\omega \cdot cos(\omega t) = A\omega \cdot sin(\omega t+90°)$$

You see that the differentiated signal is always only exactly 90 degrees phase shifted from the original signal. That remains true for a mixture of sinusoids (guitar). But you don't need anything different than 90 degrees when you are only after the visual effect.

As you can also see, the amplitude in y direction depends on frequency, so in a signal that contains a whole spectrum (like a guitar), you will probably have to experiment with amplifying the y-direction so that the y-signal fills the available space (and the pseudo-circular pattern does not degenerate to an almost flat ellipse or something). Instead of manually turning a potentiometer for adjusting the y-range, you could also apply a dynamic compressor to y (or x and y).

Another problem might be, that the differentiated signal contains considerably more high frequency content than the original signal (again due to the A.omega factor). So the y-direction might look pretty "noisy" when compared to x. In order to get around this, it might be necessary to add an additional lowpass-filter after the derived signal (and before the dynamics compressor). That makes a second OpAmp.

If you still wanted to implement an arbitrary phase shift, you could mix the original and the derived signal to obtain the y-signal. But since amplitude comes again into play here, and it is frequency dependent, it would be very difficult to prescribe a defined phase shift without amplification/attenuation. And, as I said, it is not necessary for the visual effect. You will even get the most interesting patterns if you don't mix original and derived because they are in some sense "maximum independent of each other".

One other way to generate a 2D pattern would be to use left and right channel of a stereo signal (or different instruments). But then a mono signal would simply produce a (boring) diagonal line. Since there usually is considerable mono content in a mix, the visual effect would probably look a little "skew".

• I'll try this in the morning and post my results. Thanks! – Sean Dever Jan 5 at 10:15