Packing into a list unknown amount of integers

R_Gol's icon

I would like to passing into a list only the numbers that are changed out of maximum 5 integers.
for the moment I have the following:

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

The issue with that patch is that no matter what It will always generate a list of 5 integers and I must also pressing the bang to generate that list. I would like that my list will constantly change based on the numbers I change. So if I change only numbers 1 2 and 3 my list will contain only those three numbers and no more. How can I do so?

double_UG's icon

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

pak and zl.filter

R_Gol's icon

Your explanations inside the patch are great! thanks. For some reason it is not working as it should using the pak object. only one number is presented after the zl.filter object

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

11OLSEN's icon

But how do you want to change multiple numbers without using the bang? As soon as you change a number it will trigger the process and then you will have only 1 changed number as a result of course.

R_Gol's icon

You are right. The only option is by using the bang...

11OLSEN's icon

[zl.filter] might not be the best option. Try the following:
Change number1 to 1 then bang. [zl.filter] outputs 1, all good.
Now change number2 to 1 then bang. [zl.filter] does not output eventhough there was a change.
This might be a more reliable way:

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


Andy Maskell's icon

I'm not quite clear in my mind what the final objective is but do either of these help?

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

I the first example, the objects with red text are not essential - they are just there to make testing easier.

The second example could accept a list from any source.

R_Gol's icon

I'm using sprintf object to add "," after each number (maximum numbers in list is five numbers), When I am sending a list of numbers that are less then 5 the remaining unused %i places are outputted as zero. How can avoid that?

so instead of output list of 65, 44, 0, 0, 0
I will have list only containing 65, 44

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

double_UG's icon

perhaps you are look for [zl.Iter 1]

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

R_Gol's icon

Thanks! thresh object seems very useful too

Andy Maskell's icon

Why do you need to put the commas in?

R_Gol's icon

In order to generate a list of notes to play a chord

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

Andy Maskell's icon

Something like this might work as it will deal with any number of integers. It depends on what you are plugging the output into though:

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

R_Gol's icon

It should be plugged into a make note object which is not ok with those signs " " .

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

Andy Maskell's icon

Ah! Well you don't need the commas either. If you only plug values into the left inlet of makenote, it will assume that the first integer is a note number, the second is a velocity and third is the duration. So just send each note value in one at a time:

Edit: and you might need to retype the makenote command in your own patch as the stored values might have been changed by previous input.

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

Source Audio's icon

why not simply type numbers into list an send the list.
Is anyway much faster then to select 5 numbers by mousing.

You can use textedit, dialog etc

jg's icon

Perhaps this?

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

R_Gol's icon

I would like the user to enter midi notes and not numbers this is why I wanted to use number box like that:

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

Source Audio's icon

if you posted from beginning what the usage is ...
All this list sorting , matching etc makes no sense,
because position in the list plays no role.
And also if notes from previous chord are still sustaining or not ...
22 34 56 or 55 78 22 34
What do you want exactly?
To let users enter chord and play.
Wy should they not be able repeat same note in a chord ?

max number is more clever than that live toys.
in max number set to display midi notes , you can type note number ...
and disable it too

R_Gol's icon

Yes I was needed to say my goal from the beginning I was not clear about it. Will learn for next time.
The thing is I don't want the user to enter note numbers rather a note name (C D# Gb etc). The only reason for the live.number is it's size that is much smalls seems to be.

11OLSEN's icon

If I was the user, I would like to enter my chord notes like this and not fiddle with number boxes

Source Audio's icon

a week argument.
max number can use font size 4 if one wants it so.
can you really type into the live numb whatever ? not that I know
into max number you can type both note number or note name , C#4 for example
mousing arround is tooo slow. no fun.
If you want to educate users so that they learn harmony,
than what about flats and sharps ? only # tonalities ?

but this is all less important, more questionable is that "only if changed"
what are criteria ?
no note repeated in a chord?
we agree that note list position is irrelevant, or ?

R_Gol's icon

I have build a system that generate a chords based on a scale (major, minor, harmonic minor) (the majority of it was thanks to the help of this forum).
the system is outputting those chords into a text buttons and when the user is hover with the mouse over those boxes the chords are playing.
I want to add an option to add chords that are not in the scale, therefore the above question.

the patch itself became super mega giant. I won't mind to share it all but I think it might be confusing. In any way here is it:

chords.amxd
amxd 969.29 KB

Source Audio's icon

I woulds suggest you embed colls into patch

R_Gol's icon

I have placed them inside here

What do you mean by embed calls into patch?

R_Gol's icon

here is the Coll text files

coll text files.zip
application/zip 6.21 KB

Source Audio's icon

you know what embed coll data means,
look into your own patch


Missing colls are not so important,
but the structure seems soo overloaded for recalling of few chords & scales.

here few things I find you could do better.
I have a feeling that adding new chords does not work at all .
are they free to enter ?
What dictates chord kind - names ?
Seems they have no relation at all to key-scale selected .
you reduced range of notes to 1 octave starting from c-2 to c-1,
that can not be used to create Gbm7-5 without juggling with chord inversions.

Notes names should be octave neutral, also on main page
You could use umenu for that for example.

Lock chord names display, one should not be able to rename them
I had no time to look into store and recall structure,
but as I don't use live at all can also not say much about it.

R_Gol's icon

Thanks for your inputs.
As I could not manage build a system that dictates the chord type/name I wanted to have the option to edit the chord name by writing. So I could choose the notes then change the chord name to be display for the user.
In any case I should try and simplify my patch as even for me it become difficult to follow.

The main idea was to build a system that generate chords based on a specific scale that could be shift by semitones and be placed within a specific octave. I did manage to do it ok using minor and major scale for the moment. I did get issue with the chords names (therefore the option to edit the names manually) .

Source Audio's icon

I know - it is a not easy to change directions, once a lot of work is invested.
But it is a learning process as well.

In principle you need b and # note names in a coll or umenu,
assigned key signatures, and basic triad chords to start with.
All can be done easy.
For example E Major
you offset major scale root from 0 C to 5 E
and from there on pick scale chords.
I would keep all chromatic, not diatonic.
0 4 7, 2 5 9, 4 7 11, 5 9 12, 7 11 14, 9 12 16, 11 14 17

you add key offset to this triads to get note numbers and names