shifting phase past 360 degrees?

Jay's icon

Hi,

I am trying to recreate the Electro-Harmonix Flanger Hoax pedal, and one of its functions shifts phase between 240 and 990 degrees. As far as I can tell, MSP objects can shift phase only up to 360 degrees. Is there any way to shift further than that? Possibly with the delay~ object? How would I calculate the parameters if I were to go this route?

Any suggestions helpful.
Jay

Jay's icon

Also...

How to shift phase on a signal that's not necessarily an oscillator (eg. phasor~, cycle~, etc)? The Flanger Hoax uses a 'fixed phaser' which shifts phase a constant 240 degrees, and a 'swept phaser' which sweeps from 240 to 990 degrees. The phaseshift~ object does not seem to do just this; its middle inlet "sets the frequency at which signals will be shifted by 180 degrees. Signals below this frequency will be shifted less; signals above will
be shifted more, up to 360 degrees."

How do I shift phase without phaseshift~? Or what am I not understanding about phaseshift~ from the help file and reference manual?

Help!

Peter Castine's icon

Degrees are supposed to work with modulo-360 arithmetic. So 360

fairesigneaumachiniste's icon

As Peter says, anything above 360 becomes x%360. But presumably what you mean by this is shifting a signal by 360 is shifting in time by 1 cycle. Shifting 720 is by 2 cycles. Is this what you mean?

Could you do this with 2d.wave~?

Jay's icon

Yes, this is what I mean, shifting phase by sometimes more than one cycle. However, it is finding a way of doing this that I am having trouble with. I am phase shifting a signal that does not necessarily come from cycle~ or phasor~ etc.

delay~ seems to be useful for this but I'm not sure how I could go about making the appropriate calculation, since it shifts in number of samples.

phaseshift~ sounds like what I need (in the name at least), but I can't really understand what the following (from the reference manual) means: "Sets the frequency at which signals will be shifted by 180 degrees. Signals below this frequency will be shifted less; signals above will be shifted more, up to 360 degrees."

Stefan Tiedje's icon

Jay Bodley schrieb:
> Yes, this is what I mean, shifting phase by sometimes more than one
> cycle. However, it is finding a way of doing this that I am having
> trouble with. I am phase shifting a signal that does not necessarily
> come from cycle~ or phasor~ etc.
>
> delay~ seems to be useful for this but I'm not sure how I could go
> about making the appropriate calculation, since it shifts in number
> of samples.

Hz = 1/seconds

> phaseshift~ sounds like what I need (in the name at least), but I
> can't really understand what the following (from the reference
> manual) means: "Sets the frequency at which signals will be shifted
> by 180 degrees. Signals below this frequency will be shifted less;
> signals above will be shifted more, up to 360 degrees."

You can also look at allpass~ or at filters in general. The help file
for biquad~ shows how digital filters are made. With short delay lines
and feedback. comb~ is also worth to discover...
To look at phase relationships made with biquad~ you can use a
filtergraph~ with its phase spectrum display...

Stefan

--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com

Jay's icon

> > delay~ seems to be useful for this but I'm not sure how I could go
> > about making the appropriate calculation, since it shifts in number
> > of samples.
>
> Hz = 1/seconds

Let's say I'm reading a sound file from buffer~ with play~. I want to shift the phase of the sound I am playing. How could I calculate that phase shift using delay~? Is this even possible? Am I confused? Am I speaking nonsense? :)

Some mental block is preventing me from understanding how Hz = 1/second relates to this.

Thanks,
Jay

justin's icon

well if you know the delay time in ms, then u should use mstosamps~ bcos delay takes values as samples of audio... as in the delay~ helpfile!

kjg's icon

Quote: laotze wrote on Thu, 31 July 2008 17:16
----------------------------------------------------
>
> Some mental block is preventing me from understanding how Hz = 1/second relates to this.

I think Stefan is referring to this:
the fundamental frequency in Hz of a wave = 1 second/period in seconds.

for example, if the period (1 cycle) of a wave is 0.02 seconds then the frequency is 1s/0.02s or 50 Hz.

this works milliseconds too: 1000ms/20ms = 50Hz

and if you know the fundamental you can calculate the period.
1000ms/80Hz = 12.5ms
12.5 ms represents 360 degrees here. so for a shift of 1259 degrees at 80 Hz, you go:

1000ms/80Hz = 12.5ms /360 = 0.347222ms *1259 = 43.714998 ms

this way you can calculate the delay you need to create a comb filter with a certain phaseshift at a certain frequency. blend the delay and the direct signal and hear it phase away. now modulate the delay and you have a phasor centered around a certain phaseshift at a certain frequency. which might or might not be what you are after, i'm not sure ;)

as a patch:

Max Patch
Copy patch and select New From Clipboard in Max.

kind regards,
klaas-jan govaart

kjg's icon

i forgot that delay~ needs a value in samples, not in ms.

simply multiply your ms value by SR/1000 to get the delay in samples. like this:

Max Patch
Copy patch and select New From Clipboard in Max.

Stefan Tiedje's icon

Jay Bodley schrieb:
> Let's say I'm reading a sound file from buffer~ with play~. I want
> to shift the phase of the sound I am playing. How could I calculate
> that phase shift using delay~? Is this even possible? Am I
> confused? Am I speaking nonsense? :)

It will be different for different frequencies... In that context phase
wouldn't be a clear attribute, whereas delay would be...

What is the musical/perceptional result you are after? It depends on
that what to use or how to address your problem. Phase as such is a very
abstract mathematical topic...

Stefan

--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com