Global Quantization Clock

ironlion's icon

Something I've been wanting to put together is a device that creates a pie chart counter of the global quantization value (image attached - ignore the master record part) - in a large breakout window so I have something really visible on stage that shows me where I am in within that time count.

The closest thing I've been able to find is this metronome counter (with pop out window – unfotunately it only counts 1,2,3,4 and not the GQ value):
http://www.maxforlive.com/library/device/228/metronome-graphic

I'm just about to take my first plunge into Max so if anyone has any helpful ideas on perhaps modifying the above device, they would be appreciated!

all-features-combined.jpg
jpg
Evan's icon

Would be pretty easy to do. You would need two major calculations.

1) The amount of time you are through the quantization value. Easily done with some modulo math on the current bar/beat count that you can get from plugsync~ or Live API object.

2) calculating the drawing of the circle. I'm no graphics wizard, so I don't have the equation handy. You could definitely do this in Jitter, or Mgraphics, or maybe with some creative uses of the built in UI objects.

ironlion's icon

Hi Evan,

I did take a look at starting to learn Max earlier today and I can see it's going to take me some time. This clock is something that I think might be useful for a lot of people. The coolest thing would be some kind of physical device, but that's on another level. To be honest, I think I might enjoy starting a company that produces looping related hardware devices. This stuff is so complicated, it would be nice to create some dedicated devices (like a footboard for looping with Ableton) that make it easy for people.

Is this M4L gq clock perhaps something you'd be interested in pulling together and I could pay you for your time? And then perhaps I'll set it up as a paid download so it can pay for itself - if I'm correct that a lot of people would enjoy having a large breakout window GQ counter.

Just thinking out loud.

John

Evan's icon

Didn't take long to mock something up, check out the attached device. The colors suck, and it needs support for odd meters, but this works in 4/4 pretty well.

EDIT: It doesn't follow global quantization yet.

Quantization_Circle.amxd.zip
zip
ironlion's icon

Sheesh man. Awesome!

It seems to run a little choppy on my machine. Is it smooth for you?

Metronome-Graphic-31.amxd
amxd
Evan's icon

It's not totally smooth, as I have a speedlim object limiting the update rate to make sure the device doesn't get overloaded with drawing commands. But I don't think that the 'choppiness' I'm seeing detracts from the point of the object. Try adjusting the number box. Of course it's not perfect, I threw it together in 20 minutes.

Quantization_Circle.amxd
amxd
Source Audio's icon

As first, visual metronome is hardly helpful for any kind of precise timing.
Try recording audio with simple quarter note click, and then with just
visual flash and compare recordings
-------------.
As plugsync outputs time signature as well, a simple calculation can be done to
make any kind of Time Signature like 7/8 into a bar, just multiply number of ticks per beat with beats,
and feed that to modulo / division or whatever.
I personaly prefer horisontal slider form for length progress, rather then circular.
There are many better options than jsui_3ddial.js for that task...

ironlion's icon

Ok Evan, small miracles here. I don't know anything about coding or Max but have managed to jackhammer my way into the Max UI enough to change the dial from the 3d one to the simple dial which I prefer for this. I've also managed to change the menu text to 1,2,4 and 8 bars using the inspector but I can't yet understand how you're using the + and * and % and / to bring together the menu values and the tic counts coming out of Ableton to create the proper visual count. If I stare at it some more tomorrow , maybe it'll start to make sense.

I also increased the speedlim from 60 to 200 which gives me a smooth read on my computer. Thanks for the tip.

ironlion's icon

Ok, and also managed to add the ability to change the color as well as forcing the window to stay on top when open. Beginning to understand the Max interface a little bit.

Edit: any thoughts on how to link it to the GQ value automatically?

Quantization_Circle_John-v2.amxd
amxd
Evan's icon

Nice additions! I made some adjustments to your math going from the menu. If you selected 1 bar, the circle wouldn't move, liekly because you didn't account for the zero-indexing of the menu.

I also added some code to observe the session quantization and forward it to the menu. This is a very basic utilization of the Live API, something that is pretty powerful when you understand how to navigate it and use it.

Quantization_Circle_John-v3.amxd.zip
zip
ironlion's icon

Man, that is SO AWESOME!

One thing I don't understand is, with the menu bar, how is the value assigned? It's moot now that you've hooked it up to the GQ, but I feel like I'm missing a layer in understanding the M4L UI. What I would expect would be something like this in the inspector:

menu item 1, text="1 bar" value = "1"
menu item 2, text="2 bars" value = "2"
menu item 3, text="4 bars" value = "4"
etc...

where the value would be passed on and used for a calculation. But all I could find was how to change the text, not the corresponding value. I know you've already answered my question by referencing the "zero indexing " of the menu. I'll research that and see if I can understand what's going on.

Here's a question: do you know how to flip (rotate 180) the pie (so it matches the tiny ones in ableton?) I tried to find an answer to that the other night and came up with nothing.

Thanks for getting me going with this.

Evan's icon

So the way the live.meu works:

You can enter text/values in the menu. If you want the menu to spit out 1 bar, 2 bars, 4 bars. Just fill the menu with 1, 2, and 4 and figure the UI out later. The live.text doesn't work in key/value pairs (as is your example), it works in index/value pairs.

I flipped the first example, So the answer lies deep within that js file. You need to adjust the start point of all the drawings.namely the line, and the arc outline. I've flipped it again, and commented in the js file where I made the changes.

Quantization_Circle_John-v4.amxd.zip
zip
ironlion's icon

Sweetness. Thanks for flipping it again. I really can't tell you how awesome it is to have this working. There are posts from three years ago where I was trying to do this (and the Streuner looping thing).

It occurred to me that I should try and optimize the draw rate using speedlim (again, still don't really know what I'm doing - just banging around in the dark and trying different things). Interestingly, Ableton seems to run better with speedlim set to 300 than when using lower values. I tried even setting it to 10 just to see what it would look like and that makes the device unopenable in the max editor (the whole editor just freezes up - can't understand why the editor would freeze up based on a value?). And interestingly, when the speedlim is set to 300, the Max editor itself becomes super snappy and responsive. Wierd.

Setting it to 400, I think I start to hear clicks and pops. So I I guess I'll just go with 300 as that is seeming to work best. If you have any thoughts on this, I'd be interested to hear. Otherwise, I think this baby is done! Incredibly awesome.

Evan's icon

Honestly I don't think that using the jsui is the best option here, as Source Audio mentioned. Although his post was hardly helpful as it basically said 'you're doing it wrong' with no helpful suggestion. Would be nice if he provided a point in the right direction, rather than a cryptic 'there's better objects out there' type of thing.

Anyway, as you've noticed, with high refresh rates (lower values in the speedlim) it will lock up the UI. With the speedlim set to 33, that is roughly 30 frames per second. Anything higher than 33 will begin to lose visual resolution. I'm sure that this could be done in openGL via jitter, I just don't have the chops.

Source Audio's icon

Sorry, but I am also a living and working person, so I am not having allways enough time
to provide solutions for all problems that come along when You start learning Max.
As I allready said, forget jsui, get the Bar list of plugsync object and calculate number of ticks per bar.
so if Bar is 6/8 that means 6 x 240 ticks = 1440 ticks
Have a modulo of 1440, route that to / 1440. and You get a 0. - 1. ramp
that could be used with multislider, set to display 0. - 1. float.
Or scale it to whatever kind of slider.
When more than 1 Bar is needed just multiply calculated Bar size in ticks and send it to modulo/ divide combo.
Do You need a patch provided for that simple task ?
If so I will do it.

Evan's icon

No, I definitely don't need that. Especially not if the patch is as patronizing as you seem to be ;). I'm quite comfortable accommodating odd meters. But the OP might, although he never mentioned it, so I never bothered.

The only reason we are using jsui is because he specifically asked for a circle. Of course a slider would be easier, and likely more efficient.

Thanks for the tips!

Source Audio's icon

sorry if I seemed to be patronizing, was not my intention at all.
It just that if one can say something with few words, it seems more efficient, just as
programming in max.
Just a need to do speedlimiting on a dial is a sign that it is going to make trouble,
it is really annoying that one slider makes whole App go to knees, isn't it.

ironlion's icon

Hi guys, the reason I asked for a dial is that I want something giganticly visible when I'm on stage. The dial as you set it up Evan is perfect for that. I suppose a strip would be ok, but I do really like the dial. It just feels right (for that side of my brain).

"Just a need to do speedlimiting on a dial is a sign that it is going to make trouble"

Evan, is the speedlim actually required or did you just put that in there as a caution? Could it possibly run more smoothly without it?

Source Audio, I'm not using this as a metronome. I'm playing (and looping) multiple instruments and so I need to be able to let go of counting in my head and just be able to see at a glance where I am in the GQ. (I'll post a video soon of what I'm doing)

I did realize later last night that time signatures other than 4/4 hasn't been addressed yet. I noticed in the attached device there is a system for changing meters that perhaps could be adapted and was planning to look at that and see if I could start to make sense of how to approach it. I wasn't going to come back to dealing with odd times until I have an actual need for it.

My next step is to get back to Streuner's device and see about adding 8 and 16 bar buttons to that. I got a message from him this morning on that subject.

Thanks guys.

Metronome-Graphic-311.amxd
amxd
ironlion's icon

Hey again, I tested the whole setup this afternoon and it's running fine on my fairly old machine (8GB RAM) so I think the jsui dial is a workable solution. Here's a video of the clock and Streuner's looping device in action:

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

Hi IRONLION,
glad to hear that it is working for You finally.
I see that You are using Dial instead of JSUI.
That is definitely helping.
Probably one could get it running with JSUI as well, just one would need to carefully
scale and limit data sent to JSUI.
I have here a little patch, with simple Tick to Dial translation, auto Time Signature
an adjustable Bar Length for Dial Range.
Hope it helps You.

Rodrigo Rosales's icon

Hi, I know it's an old post but I'm still asking :)
It would be difficult to do something similar but with global quantization?
What I imagine is with all the quantization options ....1/64.... , 1/8 , 1/4 , 1/2 ...etc. Each of those options expressed in a different button to select and that can be selected with a midi parameter. Also if it can be placed visually in the air, I think it's called POP.

Because I got tired of searching and there is nothing as simple as that. If it is very difficult, no problem, thanks and regards :D

Something like that would be, simple, zero aesthetics.