More pitch shifting/detune ideas

Started by WaveshapeIllusions, March 18, 2013, 04:24:25 AM

Previous topic - Next topic

WaveshapeIllusions

Okay, so one way to get vibrato/pitch shift is to use a delay line and modulate the delay time, right? But the problem with that is that you would have to keep increasing or decreasing the time to get a static shift. What if there were two delay lines though?

Say we modulate the delay time with a square wave, so it's either minimum or maximum. Let's also say that the max is double the min, so it would be an octave shift. When the signal enters at min and it goes to max, we get an octave up. If it's the other way around we get octave down.

If we add a second delay line modulated by an inverted copy of that square wave, each line would alternate. When one is doubling the other is halving and vice versa. In theory, this should result in a constant octave up and down with the signal. What do y'all think?

~arph

Mmm, yes I think it should work as long as you make sure you play back each delay line at the correct time. As the output of each line will be a varying octave/unison sound at the speed of the squarewave, but not necessarily in phase
I'd be easier if you use two sawtooth signals to modulate between min and max delay time. This would give you a constant shifted tone at the output of each delay line. Just make sure you switch between them before you run out.

PRR

> max is double the min, so it would be an octave shift

Delay is not pitch.
  • SUPPORTER

WaveshapeIllusions

Doubling the delay time would halve frequency. The change in delay time shifts the pitch by a related amount. I probably should have clarified that.

aprh, a sawtooth would work better for modulating delay? It would be constant? I was not aware that a square wave would cause phase issues. I didn't think of that, thanks for pointing it out.

Suppose I need to get some delay chips and mess with this then. I know I could get some detune with a PIC more easily, but this sounds fun.

~arph

Remember that it's the changing of the delay time/sample rate between record and playback that causes the pitch shift. If you jump from one delay time to another, only the data that is already in the delay line will be played back at a different sample rate. All new data will be payed back correctly.
There is a reason there is no DIY analog pitch shifter out there  ;)

PRR

#5
> Doubling the delay time would halve frequency

The star plays a steady A=440. I'm 50 feet from stage, then magically jump to 100 feet from stage. Does the pitch change?

To pitch-shift with a delay, you need a constantly-changing delay. If I move away from the stage at the speed of sound, I hear nothing (stay just ahead of the last note I heard). If I move at half the speed of sound, yes, this gives octave-down. So we need to add 0.5 seconds of delay every 1.0 seconds.

Octave-up gets into "negative delay". Sound comes out before you put it in. If you can do that, foo on music, put stock-quotes in later and get stock-tips now, make a killing.

> Suppose I need to get some delay chips and mess with this then.

Always a good plan.
  • SUPPORTER

R.G.

WSI, you need to look up some introductory DSP stuff. You're sniffing around some things that would be put into perspective by that.

Juergen Haible did come up with an analog pitch shifter, but it's very complicated. In effect, it's an analog computer that computes a trigonometric function that shifts the frequency of a sine wave.

You can save yourself a whole lot of time with a little research into pitch shifting and delays in the synthesizer world and in formal DSP.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

WaveshapeIllusions

Good point PRR. It does have to keep changing to keep a the pitch shift. I thought a shorter delay would raise the pitch though. Realistically I probably don't even need a big shift. I suppose two choruses going in opposite directions would suffice.

RG, yeah, I've been thinking about getting into DSP. I suppose I should just bite the bullet and start reading up on coding. I know I can pick up an Arduino pretty cheap, that'd be a good start. It'd definitely be easier than analog. I'm not sure if it'd be as entertaining yet though. Thinking of this stuff is pretry fun.

R.G.

Quote from: WaveshapeIllusions on March 20, 2013, 11:38:46 AM
RG, yeah, I've been thinking about getting into DSP. I suppose I should just bite the bullet and start reading up on coding. I know I can pick up an Arduino pretty cheap, that'd be a good start. It'd definitely be easier than analog. I'm not sure if it'd be as entertaining yet though. Thinking of this stuff is pretry fun.

The issue isn't so much to do actual DSP, but DSP work brings into SHARP focus the idea that manipulation of audio signals is a mathematical process. For instance,

Sin(2*(2*pi*f)) = 2* Sin(2*pi*f)*cos(2*pi*f)

So you can generate a clean octave up on a sine wave by (1) generating a 90 degree phase shifted version of the signal (2) multiplying the original signal times the phase shifted signal (3) multiplying by 2. You can do this in analog or digital, doesn't matter. If you want to do a broadband doubling, you have to generate a broadband phase shift of 90 degrees, which can be done with fixed phase shift stages, then an analog multiplier, then an amplifier.

See http://en.wikipedia.org/wiki/List_of_trigonometric_identities for the math that lies under the signal processing.

Analog processing does a lot of stuff as side effects, and people in the pedal world have used that a lot, on a heuristic, found-a-gold-nugget kind of way. But DSP study forces you to look at the math, and once you tumble to the math behind the process, you quickly figure out that you can go find the preexisting math and do any process that the mat allows. Frequency offsets, doubling/halving, and much more in the frequency domain come to the front, as well as delays and filters that may or may not be possible in analog.

Well, DSP also forces you to think of both time domain and frequency domain, which is not something that the amateur pedal world does much of.

I first took DSP courses when personal computers were uninvented yet, and DSP work was done offline in mainframes, generally for processing oilfield exploration seismic data. It was a different perspective than audio.  :icon_biggrin:
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

WaveshapeIllusions

I think I've seen one of those phase shift networks. I want to say it was a dome filter? The multipliers are still beyond me though. I've heard a lot about them, but I still don't quite get how they work, or what exactly they're multiplying. Frequency? I do know they involve log/antilog amplifiers though.

It does all boil down though. The higher levels aren't really my strong suit, at least not anymore. Seeing how everything is based on algebraic formulas though, I must start getting back in to it.

R.G.

They're simple analog multipliers. Well, simple... Analog multipliers exist, producing the instantaneous value of Z = X*Y, where X and Y are your two input signals.

I believe that Juergen Haible's frequency shifter used a pair of dome filters and two analog multipliers to do its work.

The 1495 and 1496 are simple multipliers, and some multipliers do signal->log(signal) for two signals, add the logarithms, and then do anti-log of the sum, which is the same as multiplication. That's one of those math identities too.

I find some of the tweako web sites I've read to be laughable where they flatly deny things that are results of the underlying math. It seriously appears that the math was FIRST and the rest of the universe was a consequence of the math.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

WaveshapeIllusions

Okay. That makes senses. So they do voltage x voltage. That explains why they can be used as VCAs. A wave multiplied by 2VDC comes put twice as big. That explains the octave up too. Two equal sine waves on both inputs would come out with the negative peaks folded positive. If I remember my multiplication right, two negative (in this case I guess below 0V) multiplied make a positive.

Some people are silly though. You can't argue around math. It states things how they are. And if the math doesn't fully explain what's happening (Audiofools anyone?) then they're probably using the wrong equation. I suppose there is something to be said for ideal versus real, but that just usually means the math used isn't fine enough.

Thanks RG! I learned something today, which is a good day in my book. :) DSP makes quite a bit more sense now. Basically you have code to perform a mathematical function on the signal that it's processing. Which I guess is a lot like what our analog components already do, but simpler. Now I get why you suggest using PICs.

amptramp

If you go to your trig identities:

sin2 (w) = (1 + cos(2*w))/2

w is an angle.  But you can replace w with 2*pi*f*t which is the instantaneous angle of a frequency f.  This shows that basic trig functions can work with frequencies in the time domain to allow the user to design effects that can double the frequency.  It works with components of the input, so you can take a complex input with harmonics and multiple notes and get doubling of all the frequencies contained in the waveform.  The left half of the equation is the squared input and the right side is the output, showing two times the frequency.