Invert Phase Using pfft~

Joel L's icon

I'm trying to create an FIR filter to control phase. For starters, I'd like to invert the phase of signal at specific bins using pfft~.

The process for changing Magnitude is straightforward enough, but I can't figure it out for phase. Can someone explain the steps I would take to shift phase of a signal by 180 degrees at a specific bin?

mzed's icon

If you convert the output of `fft~` using `cartopol` then the right outlet should be phase in radians. Those values range from +π to -π. So, add π and run through `phasewrap~` and you should get the shift you want.

Joel L's icon

Thanks for your reply, MZED.

That's actually what I have now, but it applies the phase shift to the entire signal, not specific fft bins.

How would I apply the phase shift to a specific fft bin?

mzed's icon

The rightmost outlet of fft is the bin number. You'll need to check this value to decide whether you want to apply phase shift or not. For single bins, ==~ might work.

Joel L's icon

Hi MZED, thanks again. I'm still a little confused though. Would you mind creating a simple pseudo-patch to show what you mean?

Roman Thilenius's icon

two years later.

mr. mzed is still on catstrike.

an alien spaceship has landed nearby and provides a pseudo answer to a pseudo-question.