API-functions "quantize" and "get_notes" -how to format messages??

Soundaddicted's icon

Hi,
i'm trying to use the functions "call quantize" and "call get_notes" on a live.object to manipulate midinotes in a clip.

My problems are the parameters:
"quantization_grid [int] and amount [double]" for quantize
and "from_time [double] , from_pitch [double] ,time_span [double] ,pitch_span [double] " for get_notes
I'm not able to find the right format for this messages, i've tried many variations of numbers after "calll quantize" but the max-window always says "invalid arguments. 'quantize...' ,
for example "call quantize 1 100" for quantization grid 1n at 100% amount doesn't work...

Also with "get_notes" i have no luck... is it necessary to to use all arguments or can i just use the time related when the pitch doesnt matter? My purpose is to select all notes in the loop-range of a clip.

I've searched the Max-documentations but didn't find out which mistake(s) i've done...
Can someone give me an example for this??

many thanks in advance!!!!

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

sorry for bumping this one again, but i still have problems with the "quantize" call..

someone here who can have a look?

lumbafritz's icon

--sorry double post--

lumbafritz's icon

Die you find out how to format the get_notes parameters?

the call in your patch works for me

on the right you have to use this path: path live_set tracks 0 clip_slots 0 clip view
the numbers represent witch track an clip_slot

denleschae's icon

I was struggling with formatting the quantize command too. The quantize_grid parameter was tricky to figure out, but I found the answer in the description for the midi_recording_quantization function. In the LOM document there is a table of quantization values like this:

1: 1/4
2: 1/8
3: 1/8T
4: 1/8 + 1/8T
5: 1/16
6: 1/16T
7: 1/16 + 1/16T
8: 1/32

quantization_grid wants any whole number between 1 - 8 and amount wants a double in the range of 0.0 - 1.0.

Jay Walker's icon

I still don't have a clear understanding of the syntax of this.. the documentation seems very dismal around providing examples. Is this the correct format?

//
    liveSet = new LiveAPI('live_set tracks 0 clip_slots 0 clip');
if (liveSet){
liveSet.call('quantize', 8, 1.0);
}

tyler mazaika's icon

Hi Jay, I haven’t tried using the quantize function, but depending on what error you’re seeing this might be similar to https://cycling74.com/forums/liveapi-can't-set-notes-at-integer-times-gives-%22invalid-syntax%22-error·

The upshot of that was sometimes the function call accepted a string representation of a number instead of the number. Might be a similar situation here?

Cheers,
Tyler

Jay Walker's icon

Hey Tyler, thank you for your response!! It led me to the answer that floats are required for the "amount" parameter, if converted to an integer, it doesn't seem to work. Another thing I found that was messing me up was that if the swing amount is 1.0, the notes seem to disappear, probably quantized to the next value in the grid and no longer in the "quantization" space, so I've had to impose limits to avoid that.