Doubling metro speed output?

MaxMadMike's icon

Got another brain buster. I am trying to use one main metronome to control 3 separate bpatchers. The problem is, I need to divide the metro output for each bpatcher so that bpatcher 1 gets a bang every metro cycle (every 1/4 note), bpatcher 2 gets 2 bangs per metro cycle (every 1/8 note), and bpatcher 3 gets 4 bangs per metro cycle (every 1/16 note).

I tried using 3 separate metros, one in each bpatcher, and just dividing the int generated by a BPM setting into each metro's right inlet. But after changing the BPM setting, the metros started falling out of sync.

Can anyone tell me the easiest and simplest way to use split up the metro output so that I can do this and keep all my bpatchers in sync?

Thanks!
Mike

Zh's icon

use the tempo object dude!

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

LoneMonad aka don malone's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Chris Muir's icon

On Jun 13, 2008, at 5:30 PM, mike wrote:

> Can anyone tell me the easiest and simplest way to use split up the
> metro output so that I can do this and keep all my bpatchers in sync?

Use Max 5. The new timing objects make this sort of thing trivial.

-C

Chris Muir
cbm@well.com    
http://www.xfade.com

MaxMadMike's icon

Chris,

Unfortunately, I'm a student and have to use MaxMSP v4.6 at the school until I can actually afford to buy the software, at which time I would no doubt get v5.

Zh,

I tried to use the patch you gave, and even looked at the help file for the tempo object, but it doesn't seem to have any output. What am I doing wrong? How can I actually get bangs generated at intervals determined by the tempo object?

LoneMonad aka don malone,

Your patch works. I just had to change the max number on the count object to 3 to get it counting right. However, this unfortunately makes it difficult to change the timing for each bpatcher. If I wanted to switch the timing, I would have to change the receive object. Although, I guess I could use a umenu and change the argument in the receive object through the GUI that way. I'm still just a bit fuzzy on that part.

Thanks,
Mike

Gregory Taylor's icon

Have you considered using a phasor~ and a series of
rate~ objects with a litle logic tacked on to produce
a bang? That'd be nice and tight. There's something in
your examples folder for audio-rate sequencing in Max
4. Good luck

MaxMadMike's icon

Gregory,

I think those objects are for use with audio. I am only working with triggering MIDI notes right now. We haven't even started learning about the MSP side of things yet.

Here's the solution I came up with to my problem based on the help I got from all of you. If you know of a simpler way to do this in v4.6, please send me the patch text so I can see it.

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

Thank you all again for your help. I'm having a great time learning this language thanks to help from great MaxMSP users like yourselves.

Mike

MaxMadMike's icon

Oops. I forgot to add a toggle for the metro since I am using it in a subpatch. But you guys probably figured that out without any trouble. Just thought I would mention it.

seejayjames's icon

For these things I use metro-->counter, then the counter output goes into three modulo objects (in your case, % 1, % 2, % 4). Each of these goes to its own sel 0. The mods give you the remainder of the incoming number, so % 1 will always be 0, hence always bang---your bpatcher which needs the most bangs. In this case, set the metro to the *fastest* pulse, or the 1/16 note. So, the % 2 will give you a bang every other pulse, and the % 4 will bang every 4.

You could have a dropdown with a selection of numbers to set the mods, like 1, 2, 3, 4, 6, 8, 12, 16 perhaps. This gives you a wide selection of common subdivisions to choose from; I use something like this a lot. The counter doesn't need any min or max arguments at all; it doesn't matter how low or high it goes, the remainders will always behave in these cyclical patterns.

Gregory mentioned the phasor~ etc. objects because they have much better long-term accuracy than metro (which is not designed for this and tends to drift). If you use the above example, everything will be synched together (only one metro), but compared to an external clock it will drift. Using phasor~ and edge~ to generate your bangs is much more reliable (audio objects are processed at a higher priority than scheduler objects like metro). So you can use that piece to generate the bangs instead of metro, then go into the counter etc.

Modulo is often overlooked but can be very useful.... another common use is to filter octave displacement out of a MIDI note, in other words, take the note into a % 12, and the output is 0-11, corresponding to that semitone in the scale---no matter which octave it's played at. So 63, 75, and 27 will both give you 3, or E-flat, though they are in different octaves.

--CJ

MaxMadMike's icon

CJ,

Thanks! Great info. I like the idea of using modulo. I wish I had thought of that instead of using a big select like I did. My solution limits the note division a bit more than your way. Unfortunately, however, I already finished my project and turned it in. But I think I did a good enough job on it that I will get a good mark anyway.

Thanks again!
Mike