sprintf-like function in gen~
Is there anything similar to sprintf or combine in GenExpr? All I want to do is combine a symbol and an integer into a single string (e.g. i = buffer.x where x is a number from an input or param). I reread the GenExpr docs but didn’t find anything on this. Thanks – Ian
Similar to Ian’s question, I would like to know if there is any way to see a [polybuffer~] inside a gen~ patch.
Not a specific buffer of the polybuffer, but to handle all buffers from a polybuffer.
Not from a param, all from inside gen~.
e.g. Have a "for" loop, that sums the first sample from every buffer from a polybuffer…
@Ian, as I understand, you want to dynamically change the buffer used inside the gen? You could make the message outside the patch and then feed it to gen.
I do not think there is yet a way, to change the buffer from inside gen.
Yup, you read my mind: trying to get gen~ to play nicely with polybuffer~ (when the number of buffers isn’t set in advance). It is possible to change the buffer of a poke, for example, if you use a variable instead of a buffer name, but then there’s the problem of changing the variable to refer to appropriate buffer in polybuffer~ (via something like sprintf, which doesn’t exist in gen~ I guess) as well as the problem of declaring the various buffers (which I don’t think would be possible with a for loop because declarations need to go at the top of the codebox – before any expressions). Your solution sounds like good compromise: to feed gen~ a message from outside. Just I’ve got everything synced up so nicely at signal rates inside gen~ (no Max messages anywhere except the initial MIDI button press) and I’m being a bit stubborn.
My current workaround is to use data instead of buffer (since I don’t need the audio to be accessible outside of gen~) and use multiple channels the same way I’d use multiple buffers with polybuffer~. So far it’s working pretty smoothly – with the added bonus that gen~ doesn’t have to convert any 32-bit floats. But if anyone does think of a way to combine symbols in gen~ I’ll be glad to hear of it.
No, there’s no sprintf-like object in gen~ and unlikely to change soon, as there is no string/message processing in gen~ either. Using [data] is the right way forward for dealing with multiple (> 4) channels of signal data.
The only way to work with polybuffer~ from gen~ right now is by sending messages to remap a gen buffer to a polybuffer~ index:
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 1059.3ocyXsrjapCDcM9qfRqclvSaS1cq6mwTobI.YrRDRTRhIdRpju8Hj.F AF7ficlLavk6Vp4zm9gZwOV4.RYmPBf6mbez0w4GqbbzhZD3z9eGPI7TFAJz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+jrJnb+xYpXjmMGF9K0cc+CybBC0i7ua6qj4DbNUELOer9BYOcRTySlu2L6 7dnTxwo0RSOL6qSgJSsKDGTyos9vVeF5bbCjVR8xMNlooQxf0bVCiyaVbVvc onIYAnI5MCM6dWglsuqPSzBPSywn9uqPyaD23s.3D7lAmkThOBxKGNlFPi9x NMHYzWzYzWy47ujy7eEmweAG0a9mq9MvEnAyB -----------end_max5_patcher-----------
What I understand of about your workaround is that you have 1 Data with multiple channels. And that you link different buffers to the channels in that Data object.
How do you achieve that?
I can’t find anything about that in the docs. Only copying a buffer to a Data. But not multiple buffers to multiple channels in 1 Data.
Or do I misunderstand your workaround?
I guess it’s possible with a for loop which copies al the buffer info to the right channels in the Data object. But I was kinda hoping that there is a simpler solution for that.
Forums > Gen