## shifting phase past 360 degrees?

Jul 29, 2008 at 1:30pm

# shifting phase past 360 degrees?

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?

Jay

#39050
Jul 29, 2008 at 2:08pm

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!

#136952
Jul 29, 2008 at 5:37pm

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

#136953
Jul 30, 2008 at 10:30am

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~?

#136954
Jul 30, 2008 at 10:32pm

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.”

#136955
Jul 31, 2008 at 5:41am

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

#136956
Jul 31, 2008 at 3:16pm

> > 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

#136957
Jul 31, 2008 at 3:36pm

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!

#136958
Aug 1, 2008 at 10:22am

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:

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 240 173 29 196617 t b f;
#P flonum 293 173 39 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 228 224 63 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 293 151 78 196617 loadmess 1259;
#P comment 333 173 100 196617 phaseshift in degrees;
#P newex 228 197 41 196617 * 360.;
#P newex 228 148 40 196617 / 360.;
#P comment 282 121 100 196617 1 period in ms;
#P user ezdac~ 115 399 159 432 0;
#P message 102 124 77 196617 open , loop 1 , 1;
#P newex 228 40 66 196617 loadmess 80;
#P user gain~ 140 257 24 100 158 0 1.071519 7.94321 10.;
#P user gain~ 117 257 24 100 158 0 1.071519 7.94321 10.;
#P flonum 228 121 51 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 228 67 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 228 94 49 196617 !/ 1000.;
#P newex 144 197 40 196617 delay~;
#N sfplay~ 1 120960 0 ;
#P newobj 136 162 44 196617 sfplay~;
#P comment 280 67 100 196617 fundamental in Hz;
#P connect 7 0 10 0;
#P connect 6 0 10 0;
#P connect 1 0 6 0;
#P connect 9 0 1 0;
#P connect 2 0 7 0;
#P connect 1 0 2 0;
#P connect 7 0 10 1;
#P connect 6 0 10 1;
#P connect 16 0 2 1;
#P connect 8 0 4 0;
#P connect 4 0 3 0;
#P connect 3 0 5 0;
#P connect 5 0 12 0;
#P connect 18 0 13 0;
#P connect 12 0 13 0;
#P connect 13 0 16 0;
#P connect 17 0 18 0;
#P connect 18 1 13 1;
#P connect 15 0 17 0;

kind regards,
klaas-jan govaart

#136959
Aug 1, 2008 at 10:31am

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:

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 323 277 47 196617 * 0.001;
#P newex 228 272 41 196617 * 44.1;
#P newex 309 254 54 196617 dspstate~;
#P newex 240 173 29 196617 t b f;
#P flonum 293 173 39 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 228 224 63 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 293 151 78 196617 loadmess 1259;
#P comment 333 173 100 196617 phaseshift in degrees;
#P newex 228 197 41 196617 * 360.;
#P newex 228 148 40 196617 / 360.;
#P comment 282 121 100 196617 1 period in ms;
#P user ezdac~ 115 399 159 432 0;
#P message 102 124 77 196617 open , loop 1 , 1;
#P newex 228 40 66 196617 loadmess 80;
#P user gain~ 140 257 24 100 158 0 1.071519 7.94321 10.;
#P user gain~ 117 257 24 100 158 0 1.071519 7.94321 10.;
#P flonum 228 121 51 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 228 67 41 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 228 94 49 196617 !/ 1000.;
#P newex 144 197 40 196617 delay~;
#N sfplay~ 1 120960 0 ;
#P newobj 136 162 44 196617 sfplay~;
#P comment 280 67 100 196617 fundamental in Hz;
#P connect 7 0 10 0;
#P connect 6 0 10 0;
#P connect 1 0 6 0;
#P connect 9 0 1 0;
#P connect 2 0 7 0;
#P connect 1 0 2 0;
#P connect 7 0 10 1;
#P connect 6 0 10 1;
#P connect 20 0 2 1;
#P connect 8 0 4 0;
#P connect 4 0 3 0;
#P connect 3 0 5 0;
#P connect 5 0 12 0;
#P connect 18 0 13 0;
#P connect 12 0 13 0;
#P connect 13 0 16 0;
#P connect 16 0 20 0;
#P connect 17 0 18 0;
#P connect 18 1 13 1;
#P connect 21 0 20 1;
#P connect 15 0 17 0;
#P connect 19 1 21 0;

#136960
Aug 1, 2008 at 6:15pm

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

#136961

You must be logged in to reply to this topic.