Performing more than two simultaneous pitch shifts.

Algorithm development and general DSP issues

Moderator: frank

Post Reply
armstrom
Posts: 4
Joined: Thu Jul 07, 2011 9:40 am

Performing more than two simultaneous pitch shifts.

Post by armstrom »

I'm very new to DSP development in general (and the FV-1 in particular!) but I'm interested in trying to recreate a synth sound I have heard from other products. It involves doing multiple pitch-shifts of the input signal and mixing them back together to produce kind of an auto-harmony effect. In my case I think I'm limited by the number of SIN LFOs in the FV-1. I would like to generate the following shifts simultaneously:
-1 Octave
+5th
+2 octaves and a 3rd
+3 octaves

Here's what I'm thinking but I might be totally off base here. I THINK I can achieve all of these shifts simultaneously by finding the least common multiple of each of them and simply scaling. It would seem if I set up my first LFO to give me a four semitone shift and the second LFO to give me a 7 semitone shift I should be able to achieve all of these pitch shifts as follows:
-1 octave = -12 semitones, or LFO1 * -3
+5th = +7 semitones (use LFO2 as-is)
+2 octaves and a 3rd = +24 semitones for the octave and +4 for the 3rd, or LFO1 * 7
+3 octaves = +36 semitones or LFO1 * 9.

So, is this a valid way to compute the pointers into my delay memory? Also, how many samples would I need to use to cover this entire range? I'm still a bit shaky on how the whole pitch-shfit theory works.

Any help would be much appreciated!
-Matt
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

I don't think it will work as you intend, the ramp waves in the FV-1 are designed to operate in a particular manner to create the pitch shift. Additionally doing large shifts (+2 or +3 octaves) means you will greatly have to band limit the signal else you will be aliasing because you will essentially be generating signals of a frequency higher than the FV-1 can reproduce. I.e.:

Assume a 48KHz crystal and as a result a 48KHz sample rate.

Highest frequency FV-1 can handle is 24KHz in this case, probably more like 20KHz due to filters, etc.

At +3 octaves any signal will be multiplied in frequency by 8 so 20KHz/8 = 2.5KHz therefor the largest frequency you could put into the chip is 2.5KHz, frequencies above this will cause aliasing.

Now for a question, what do you mean by:
LFO1 * -3
You can't just multiply an LFO by a number and generate a higher frequency. If the intent is to multiply the address pointer then I see where you are going but there is no direct way to do that, you need to do all calculations by hand and take into account the address offset counter that is automatically updated each sample period and added to the address base.
Frank Thomson
Experimental Noize
armstrom
Posts: 4
Joined: Thu Jul 07, 2011 9:40 am

Post by armstrom »

ok, that's what I was afraid of. I was under the impression that in the case of pitch shift operations the LFO is used to generate the indexer into the delay memory... and if that were the case I could use a single LFO to really generate two or more pointers as long as the locations could be represented as a product of the LFO base frequency and a scalar.

The +3 octave is up there, and I forgot about the aliasing problem (as I said, I'm VERY new to audio algorithms and DSP).

Hmm.. well, it was a thought :) I was hoping to achieve something a harmonic generator pedal from a "major manufacturer" (not sure what the policy is here on using manufacturer's names). It uses a powerful blackfin DSP but also provides MANY advanced features. My hope was to try to use the FV-1 to emulate one particular configuration of the settings to achieve my goals. Oh well :) Thanks for the information!
-Matt
armstrom
Posts: 4
Joined: Thu Jul 07, 2011 9:40 am

Post by armstrom »

I have given this some thought. I think I can live with the limitation of a max input frequency of 2.5KHz since this would be a guitar effect. Could you provide more information on how one hmight achieve the effect I'm after? I understand I wouldn't be able to use the LFOs since I need too many pitch shifts.. but could this be done with a brute-force method? I would probably try to filter out any harmonic content from the input signal anyway so that only the harmonics generated by the DSP program would be present in the output.
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

For an explanation of doing ramp based pitch shifting see http://www.spinsemi.com/Products/appnot ... N-0001.pdf

While the code examples use the built in ramps the theory on what to do is what you want.

I really don't think you can pull off multiple pitch shifts in the FV-1 through coding, by the time you calculate the ramp (remember the FV-1 will sat-limit at +1/-1 so the ramp will not automatically wrap around) interpolation coefficients, cross-fade coefficients, etc. you will probably have used most of the available instructions to pull off just 1. This is why I designed dedicated hardware for the pitch shifting.

The only solution I see is using multiple FV-1s but even then you will run into an issue that the pitch shift is limited to about +1.6 octaves.
Frank Thomson
Experimental Noize
Hides-His-Eyes
Posts: 5
Joined: Thu Jun 16, 2011 1:54 pm
Location: UK

Post by Hides-His-Eyes »

One FV-1 per harmony is still very reasonable. Consider then taking the output of one as the input of another and sending both outputs to the mixer.

Consider also that part of the reason the pog sounds good is the low-pass filter taming those high harmoni(x)!
armstrom
Posts: 4
Joined: Thu Jul 07, 2011 9:40 am

Post by armstrom »

Frank: If I'm reading that document correctly the technique finally settled on only uses one ramp LFO to do the pitch shifting, correct? There is some mention of using two evenly spaced ramps to avoid clicking but that doesn't seem to be what is done in the code.

If that's the case, could I get two pitch shifts per FV-1 by using discrete left and right channels all the way through? I would feed the same source signal into the left and right channels, set up two delay memory ranges (L & R) and also configure the two ramp LFOs to index into each of the delay memories. I could then do analog mixing of the outputs outside of the FV-1.
A pair of FV-1 chips could give me the four pitch shifts I'm after. I would just add low-pass filtering in the analog input stage to keep the upper harmonics out of the input signal and that should take care of it.

How hard is it to calculate the delay between input and output for a given pitch shift? I think I could incorporate a simple delay to make all the shifts "line up" when they get mixed together.

-Matt
slacker
Posts: 116
Joined: Tue Feb 01, 2011 1:13 pm

Post by slacker »

Yeah you can do two separate pitch shifts like that. Here's a couple of examples on the forum.

http://www.spinsemi.com/forum/viewtopic.php?t=116

http://www.spinsemi.com/forum/viewtopic.php?t=235
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

armstrom wrote:Frank: If I'm reading that document correctly the technique finally settled on only uses one ramp LFO to do the pitch shifting, correct? There is some mention of using two evenly spaced ramps to avoid clicking but that doesn't seem to be what is done in the code.
Actually we are using 2 ramps, one ramp LFO in the FV-1 will create the ramp and the offset ramp.
armstrom wrote:If that's the case, could I get two pitch shifts per FV-1 by using discrete left and right channels all the way through? I would feed the same source signal into the left and right channels, set up two delay memory ranges (L & R) and also configure the two ramp LFOs to index into each of the delay memories. I could then do analog mixing of the outputs outside of the FV-1.
A pair of FV-1 chips could give me the four pitch shifts I'm after. I would just add low-pass filtering in the analog input stage to keep the upper harmonics out of the input signal and that should take care of it.
Yes, since each ramp LFO generates both the ramp and an offset ramp and there are 2 ramp LFOs in the FV-1 you can do 2 pitch shifts at the same time.
armstrom wrote:How hard is it to calculate the delay between input and output for a given pitch shift? I think I could incorporate a simple delay to make all the shifts "line up" when they get mixed together.
The delay is not a fixed number because the ramps are continuously moving through the sample memory.
Frank Thomson
Experimental Noize
Post Reply