Real Time Phase Vocoder?

2idiotsand1max's icon

Looking at Msp tutorial talking about Phase Vocoder
I was wondering if it is possible to make phase vocoding on real-time input like with an Ezadc object and using poke~ instead of record~ . I've just modified the tutorial patch, created 2 pokes~ (one for real, one for imaginary), I've indexed them with a count~ but it really doesn't work, and it's like buffer can't do his job, as it is always deleting his sound and can't go any further from his beginning in the time domain table. Maybe this is due to the nature of real-time or maybe it's just that I'm such an idiot as 2idiotsand1max are?

Peter McCulloch's icon

It's definitely possible. Can you post your patch?

Part of the overwriting happens because you typically have overlapping ffts with pfft~ and they'll overwrite each other if they're using the same buffer. (You want to use a local buffer~(i.e. name it something like #0_buffer)

2idiotsand1max's icon

Thank you Peter for your answer, so you mean that I'd have to use different buffers? I don't get it. Poke reads from a buffer and index does too from the same one , if I use different names how can they work?

this is the patch, pretty much the same from the tutorial ( I've just copied what I needed) :

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

pre>

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

and this is the inside pfft:

Thank you very much for your interest!

Peter McCulloch's icon

Try this:

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

(feis)

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

And this for the main patch:

2idiotsand1max's icon

Thank you, I will check it out as soon as possibile !

2idiotsand1max's icon

Ok, I've checked and I've got a few ( a lot of...) questions... I send the 2 patches back to you with some comments inside, if you got spare time just look at them!

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

here the main patch:

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

And here inside the pfft:

vichug's icon

hey, i do'nt know nothing about fft but why i know is #0 is a randomly generated number that will change each time you load an instance of the bastraction in which there is the 10. This means that the name of buffer will indeed change for each instance. See help for "unique identifier" in chapter "arguments and special character in max" of Max help.

2idiotsand1max's icon

Thank you wichug, I actually didn't know, I've checked on buffer's help file but there wasn't anything about. I'm gonna go and have a look. Thank u again

Peter McCulloch's icon

#0 is the way to create abstraction-local names, whether for buffer~, send, receive, send~, receive~, table, etc. It's the functional equivalent of a private variable in some programming languages. (It is visible, though, but you have to know the name)

You have to put the #0 at the front of the name, e.g. #0name.

The same thing is true for arguments in abstractions (#1,#2...) when you want to share names between abstractions.

Peter McCulloch's icon
Max Patch
Copy patch and select New From Clipboard in Max.
Max Patch
Copy patch and select New From Clipboard in Max.

Good questions. Here's my thoughts:

vichug's icon

(for reference : i meant not in any helpfile, but the actual max help browser)

vichug's icon

Hey Peter, the sah~'s outlet inside the pfft~ isn't connected to anything, yet you say it prevents getting weird combinations of multiple frames. Do some signal objects have effects without beeing connected inside pfft~ world, or is that a forgotten connection ?

Peter McCulloch's icon

@Vichug: Yeah, that should be connected if you want to only change frames at the frame boundary. Without it, you could get data from several frames (especially if your position signal is really noisy). Either could be useful and interesting, but I intended to connect it...

2idiotsand1max's icon

Thank you very much for your answers Peter!