How to convert PD's variable delay [vd~] into Max/MSP

Cameron Schneider's icon

*EDIT*
Second question:

Another issue, this one pretty glaring…

I am wanting to do real-time granular synthesis.
In the puredata patch, it uses variable delay (in pd: [vd~]). Its quite a simple implementation.
In Max/Msp, there seems to be no straight comparison

I know that there is both Benny’s vdb~, as well ad ej.vdb~, however I am completely lost as to implement these in the patch.
What I have done is replace the vd~ with tapin~ -> ej.vdb~, and then replace the delwrite~ with another tapin~. However, this simply produces an audio feedback loop without any granular synthesis.

In what way am I mis-using the ej.vdb~ external? Is there a better way I could be translating this patch?
puredata's [vd~] allows for you to patch a number of different data lines into it, allowing for flexible feedback control, whereas the [tapin~]/[tapout~] delays as well as [ej.vdb~] seem to require a straight [tapin~] -> [tapout~] or [ej.vdb~] connection. I would really love to start using this patch; sorry for being new to all this, I love the transition just wanting to have my creature comforts come along with me from PD :)

for [wrap~] I have replaced it with [pong~ 1 0 1], and for [samphold~] I have used [sah~]

*first question, already solved*

hello

acquainting myself to msp after awhile in pd

i am trying to convert a simple pd patch that i use into msp; one of the objects contains an expr function given here:

expr (pow(2, ($f2/12)) - 1) * (44100/$f1)

while this object is easily recognized in puredata, it does not work in msp. am i missing a simple "grammar" rule in the code? msp feels so familiar (if not easier to use) but there are little hiccups here and there

metamax's icon

Numerical values need to be specified as floats...

expr (pow(2, ($f2/12.)) – 1.) * (44100./$f1)

Cameron Schneider's icon

forward slash with the (pow(2\,) was what caused the problem, just straightened it out :)

Cameron Schneider's icon

Another issue, this one pretty glaring...

I am wanting to do real-time granular synthesis.
In the puredata patch, it uses variable delay (in pd: [vd~]). Its quite a simple implementation.
In Max/Msp, there seems to be no straight comparison

I know that there is both Benny's vdb~, as well ad ej.vdb~, however I am completely lost as to implement these in the patch.
What I have done is replace the vd~ with tapin~ -> ej.vdb~, and then replace the delwrite~ with another tapin~. However, this simply produces an audio feedback loop without any granular synthesis.

In what way am I mis-using the ej.vdb~ external? Is there a better way I could be translating this patch?

for [wrap~] I have replaced it with [pong~ 1 0 1], and for [samphold~] I have used [sah~]

Cameron Schneider's icon

If someone can help me figure out the simple tweak I need to make this PD granular patch functional, I will dedicate the rest of the year to trying to help other people's beginner mistakes on this forum to pay it forward :)

I have every bit of code I need to translate it, I just need to understand the programming grammar & difference in operation between PD's [vd~] and [delwrite~] compared to [ej.vdb~] and [tapin~/tapout~]

metamax's icon

You will get more replies if you post examples of your trouble. Create the patch, select all, edit -> copy compressed. Paste into the forum message window. Also, be sure to give the help file and ref docs a look before posting questions as many here will read your post and won't reply assuming that you will figure it out soon enough because it's right there in the documentation.

re: your question, I have never used PD and I suck at MSP... really. I try but I am baffled by audio synthesis. Yet, somehow, in a matter of minutes, I found the following. I have no idea what it means, yet, paradoxically, I suspect it will help you.

[vd~] - The delay in milliseconds is specified by the incoming signal.

[ej.vdb~] - requires number message to change delay time.

[ej.vdb-sig~] same as ej.vdb~ but accepts signal as delay time

[tapin~] - You must connect the outlet of a tapin~ object to the tapout~ objects you want to use with the delay line.
Note that this is not a signal connection, since no signal travels between the objects. It is merely a way to indicate that the objects share the same delay memory.

brendan mccloskey's icon

metamax obviously does not "suck at MSP". Good advice. And he's helped me out in my own experiments in this domain in the past, even if indirectly.

I am currently in the process of converting my own "granary" granulator from Max to PD (the reasons are irrelevant here), and if you are patient I will post the results soon; even though I'm not currently familiar with the vb or ej objects.

Brendan

Cameron Schneider's icon

Whoops about copy compressed - gettin used to all of this still

Oh, I found that info. How it operates on a basic level makes sense, translating the patch is where I am hung up. I posted a visual of the PD patch. As you can see, it creates a feedback loop with the variable b1; no direct signal path connects the [adc~] -> [delwrite~ b1 5000] signal flow to the [vd~ b1] object above, which is where there is a break in the MSP signal flow.

Here is the patch copy compressed as "close" to the PD patch as possible

1688.3oc6ctsaaiCDF95Tf9NHHzKR553JdPmVrXA1mi1hExxxIpUVxPRtM6V
r4YeoH8AIKKmII1oialarCjbH4P98yY3HZ5e712bg8jh6Rprs9cqOZcwE+Pc
kKzWq4JWr9BWXOO5t3rnJ8GztJKcZRo8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PnHTaKBjDfZOyfBPB0iW.TXpbFlEAPQVv4n
1mFnrXvwcDd9fkA7leXXpCnVilCxnDG0yWBGzn13nN6pbPApxw87kHA2OfWY
.TVt4hWAxfB05CfjAApC0fCyOMpi5V.xGm.2x.nX9D3Nqddf6GPqNs.TLeBT
6eP.xGm.24DC1ZB.0wZH3fkA9os+Ag+oerFRT6mVBaUAf5bBHgoOD7JPFP83
3.JCOarT8Ize7+znj0.D

You need to turn the bottom right box to 1 to have the feedback turn on (any more than 1 will distort/glitch out), you turn the bottom left box to one to have audio run to the DAC.

metamax's icon

Brendan, that's funny you commented. I was just looking at a patch of yours the other day and realizing how little I know about MSP.

Cameron, you need to include the beginning and end of the compressed code including "--------begin max 5 patcher--------" and "-------end max5 patcher----------".

Here you go (patches you posted)

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

#1

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

#2

Cameron Schneider's icon

thanks!

I am seeing that in the PD [vd~] object, the b1 is acting as a remote call. For MSP there is the argument "tapconnect" to do remote connection. I will explore with that and see what I can come up with

Roman Thilenius's icon

vd is maybe one of the pd vanilla objects where one might be better off building things from scratch - and eventually different form the original - instead of recreating it 100% in maxmsp. but thats just an opinion^^.

as for a perfect recreation of the samphold object try searching this forum; not long ago somebody posted a max patch for it. (sry i dont have mine here now but i will ul on request.)

-110

stkr's icon

max is like pd in that you work out signal flow, look at helpfiles and know what inlets/outlets are what and what goes where. your use of tapin/out is all messed up.

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

roman is right, vd~ is not the same as the vdb~/vdelay~ abstractions, but for what it's worth, here is 20 mins completely untested patch:

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

Here's my try to do 1:1 translation from Pd to Max. Pd's [vd~] is just [tapout~] in Max. Nothing fancy. I remember when I was moving from Pd to Max I had a feeling there was a lot of redundancy in Max, but otoh it enabled a much clearer patching. Forget [expr] ;-)

stkr's icon

hi AK, this is great! much clearer than mine :-)

the only thing for the OP is interpolation - tapout~ is linear, vd~ is cubic. but for this algorithm i do not think it matters. for cheaper (cpu) use and interpolation options it is easy enough to redo this in gen~ anyway.

also, vd~ guards against lower than 1-signal-vector-size delays, tapout~ does not (i think) which is why i had the [maximum~] in there. of course in gen~ you could use lower delay times down to 1-sample.

ak's icon

the only thing for the OP is interpolation – tapout~ is linear, vd~ is cubic. but for this algorithm i do not think it matters. for cheaper (cpu) use and interpolation options it is easy enough to redo this in gen~ anyway.

Also tapout~ seem to use 4p cubic interp (see my example and zoom in buffer waveform).

also, vd~ guards against lower than 1-signal-vector-size delays, tapout~ does not (i think) which is why i had the [maximum~] in there. of course in gen~ you could use lower delay times down to 1-sample.

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

[tapout~] doesn't allow delay lesser than VS size, so it's guarded in the similar way.
Hope my methodology is right :)

stkr's icon

sorry for delay, i got busy.

yes, it seems it is some sort of cubic. i am pretty sure when i first learnt the tapout~ object it was linear, many many years ago, and i've not used it much in the last years and probably never thought to look into it. same story for clipping vector size as well. i should really try to keep up to date with these things ;-)