Trigger a message content with a bang automatically

Emiliano's icon

Hi everyone,
I’m trying to calculate the length of a list using [zl.len] (I can do it here) and then use that value as the maximum for a random number generator. The issue is that I need to manually click on a message so that the box with the number is updated.

I’ve tried automating this with [t i b] and other approaches, but I can’t get it to work.

Is there a way to automatically send the content of the message box (the lenght number of the list) whenever I trigger the system with a bang and then send that (numeric) value to the random number generator range?

Actually, this works and sends the number only when I open the patch and perform the slicing of the buffer after replacing the sound source. However, every time I load a new audio file and reslice, I have to click on the message box again to send that numerical value.

It’s a bit ambiguous to explain, an excerpt of the patch is here.

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

Sorry if this question seems basic—thanks in advance for your guidance!

Source Audio's icon

You should start exploring help file and reference of objects you use.

isn't it logical that you tell random what the range should be

before triggering it ?

PS. maybe you don't know that in max order of execution is right to left ?

Emiliano's icon

Indeed, it is not random but an abstraction that calculates the min/max range between two numbers. Perhaps I didn’t explain myself clearly. Within the abstraction, inlet one has a base numeric value, and inlet two needs to update the value with the number generated from the list.

Source Audio's icon

If you ask for help then ask precisely.

I don't understand what this new post is about.

it is abstract ... ion ? or base ... of what ?

maybe you need to pak that values into list that updates when any

list member changes, and so performs calculation?

for 2 values something like this ?

for lists with more values, use pak with mote inlets and

for example

expr $i1 + $i2 + $i3

Emiliano's icon

Maybe it's better if I send you the entire patch and explain:

fluid.bufonsetslice~ creates the slice points that I will send to a list. I retrieve the length of the list, and that value will serve as the range (max) in the vc.between patcher, which is just a patch that randomizes two numbers within a given range.

Now, the issue is that every time I reanalyze a file and create the slice points, the number generated by zl.len must be transmitted as a numeric value inside the vc.between patcher. Unfortunately, I've only been using Max for a short time, and some questions might seem silly. I'm really sorry for explaining myself poorly.

I just want that every time the list is updated (so after each new analysis), that number is simply transmitted inside the object that generates random numbers. It might seem strange, but the maximum value of that range should change every time with the total length of the list.

Here the full patch.. But if you haven't installed the Flucoma pack, it won't work. :(

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

Wil's icon

no nothing better to send entire patch

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

Emiliano's icon

Sometimes the simplest things are the most challenging to explain. I apologize if I wasn’t very clear, and I thank you anyway for the support. In the last post, I pasted the entire patch. If you have the Flucoma tools and try to analyze a file, the total number of elements in the list is returned. I would like that number to be transmitted to the variable value of the vs.netween patcher with every analysis. I know the solution will probably be simpler than expected, but sometimes all it takes is a quick hands-on check to resolve it.

thanks anyway:)

Roman Thilenius's icon

this patch is the perfect example why one should use triggers - eventually even in situations where it is programmatically not required.

even after sorting all these cables it is impossible to see what is going where. including for the villain who made it. :)

the only thing i can tell you is that the right inlet of zl.len says "inactive" ... which means that this inlet does nothing ... but you connected something to it.

Emiliano's icon

Haha, you're absolutely right, that photo with the cables is really explanatory! 😄 Indeed, the patch was a real mess! But I've redone everything, and now it should be much tidier. I also tried using the list.len object, which works perfectly to list the number of elements. However, I still can't manage to transmit the number correctly during each buffer analysis... but I'm getting there! maybe

Thanks a lot for the suggestion, it was really helpful!

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

Emiliano's icon

I'll post the screenshot here, maybe it's clearer.

Basically, I use the Flucoma tools to extract the slicepoints from a file and put them into a list. Here, I’ll need to know how many elements are in that list using the zl.len object. The total number of slicepoints will serve as the maximum value for the reading index, where I've inserted a random metro to perform the slice playback, from the first (0) to the last, which is the variable value generated from the list (number of elements in the list). This value is necessary to read all the indices randomly. The problem is that after the analysis and slicing, once the list is generated, I have to click on the message to update that value. Instead, I want the value to be automatically written into the vs.between patcher after the analysis. I hope this is clear enough, but let me know if I need to explain it better.

Source Audio's icon

All that long posting arround makes no sense without the problematic part :

that vs.between patch.

It is missing because it is abstraction, not a subpatch.

I showed you allready what to do to get that simple task work in my reply,

no matter if random gets triggered from zl.len input

or metro

Emiliano's icon

this is theabstraction vs.between

Sorry, but that's not the problematic part. The problem is always the same, and I'm trying to explain it as best as I can. The issue is that when the list is loaded, the numeric value generated by list.len doesn't update automatically, not even with triggers

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

Source Audio's icon

I am sure that it makes no sense - I mean that vs.....

but this is what I get inside

Source Audio's icon

P.S.

did you have a look at the screenshots I posted at all ?

here it is again

Emiliano's icon

This is an abstraction taken from Maurizio Giri's Max book. This is what I see

Source Audio's icon

Why do you expect that other must have read that book, or

downloaded some patches from that stuff?

You are new to max, and complicate stuff,

which is understandable.

why on earth use abstractions which you don't understand anyway,

instead of trying to get that random numbers in simplest form.

By the way that vs, as well as max random object

will not do what you ask for :

play ALL slices in random order.

for that you should use urn, which creates numbers without repetitions.

Emiliano's icon

Thanks for clarifying! About that piece of code, I'm just interested in understanding if it can generate a series of numbers within a range. I can’t learn all of Max just to do a few experiments, lol. I’m trying my best by exploring a bit of everything.

I just tried urn, and thank you for introducing me to it! However, that object stops once it finishes counting to a given number. I’m looking for something that randomizes the playback order, but I don’t mind if it repeats the same slice multiple times and I believe rnd works for that purpose.

Source Audio's icon

from max 8.5 up,

random can generate float numbers and get range set

urn bangs at right outlet when all numbers get created.

you can use that to clear urn and reset it.

Emiliano's icon

thanks for telling me but unfortunately I have to update I still have a version 8.0.8 :(

Source Audio's icon

urn makes no difference between Max versions.

random can then be used like in that abstractions ...

or simpler, but only when you need float. like in speed factor.

your problem with list update etc was caused by order of execution.

connect outlet of fluid,buf2list directly into zl.len as shown before.

don't forget that zl.len as all other zl objects has default list length limit

of 256

Emiliano's icon

Simply, thank you. I kept making mistakes trying to get that numeric update by mistakenly connecting the outlet of the message object.

Thanks again, and sorry for explaining it poorly.

(:

Source Audio's icon

don't worry, be happy ...

Emiliano's icon

Thanks again :))))