Programming an Octaver

Hi everyone,

I am working on building an octaver in MAX using Gen DSP Language. I have gone through a lot of tutorials but I am really not sure where to start with this one. Right now my idea is to take the signal being inputted. Put it through some sort of buffer and then change its pitch, and release the signal.

Would anyone be able to point me in the direction of figuring out what object(s) would let me change the pitch of a signal in Gen

Thanks in advance!

I don’t use Gen and can’t test it, but looks like it has pitchshifter unit. And octaver is just a particular case of pitch shifting. I.e. you’d shift your signal up by 1200 cents to shift up by an octave or -120 to shift down. I’m not sure which approach they use in Gen and if it would even run on Owl correctly.

Also, naive pitchshifting algorithms (i.e. shift up by just changing playback speed and repeat full wave cycle to shift up by octaves) would be ruining transients. A better approach is using 2 delay lines with windowed interpolations, but this can generate undesirable artifacts. There was some info about approach that Eventide and other companies used to minimize amount of artifacts, but I haven’t seen any code that could be used as is.

Thanks for the reply. I think the pitch shifter is an object that only exists in Max. I am trying to watch this video: Delicious Max/MSP Tutorial 7: Pitch shifting - YouTube. And see if I can remake these objects in Gen

The key objects in gen~ are delay and a phasor.
With the modulation of the delaytime you can simulate a kind of a Doppler effect. It’s not quite a pitch shift, but it’s a frequency shift. It will transpose the whole harmonic content.

The shift will be: 1-((pf)*modrange/1000
With pf= frequency of the phasor
modrange = Modulation range for the delay im ms (I think the delay object in gen~ needs samples)

The easiest way for calculating the shift will be, if you modulate the delay time with a phasor in the range of 0…100 ms.

modrange =100

→ shift = 1-(pf*0.1)

For a shift of 1 octave down
0.5 = 1-pf*0.1 → pf=5

For a shift of 1 octave up
2 = 1-pf*0.1 ~> pf=-10

There ist a cool tutorial for msp~ on YouTube, but it’s easy to translate it into gen~

Actually, it is pitch shifting, not frequency shifting. Frequency shifting is shifting by constant number of Hertz, while pitch shifting is a relative shift (that’s why it’s expressed in cents). The difference may seem not that important until you consider what happens in a complex signal that contains multiple harmonics.

Frequency shifting would create inharmonic sound from a harmonic sound or would shift perceived based pitch - depending if the amount of frequency shift is harmonically related to carrier or not. I think most common way to do it is with Hilbert transform. Pitch shifting would keep the signal harmonic.

Btw, the video seems to describe the same algorithm that this pitchshifter in Faust libraries uses.