MIDI Note In Triggers Session Record

Drew Heaton's icon

Hi,

Complete M4L noob here. I've been poking around for a few days trying to figure out how to make what (I think) should be a relatively simple device, and I could really use a little help if anyone is able.

I'd like to create a device that would receive a MIDI note on a track in Ableton, and if Ableton's transport is stopped, trigger the session record button. I know how to create the MIDI In/Out, but I'm really struggling to make sense of anything past that.

Anyone have ideas or suggestions?

Drew Heaton's icon

OK, I think I'm about 80% there. I've got a sel monitoring M4L.api.ObserveTransport, but I'm not sure if I've set up the sel right.

As it stand currently, I need to first figure out how to get this device so that a MIDI in triggers the transport to start only if the transport is stopped. What does M4L.api.ObserveTransport output? I'm assuming a '1' if the transport is running, and a '0' if it's not?

After that, all I need to do is replace M4L.api.ToggleTransport with whatever will enable Session Record.

Anyone have any thoughts?

NOTE_ON_TRIGGER.amxd
amxd 13.25 KB

Evan's icon

You're missing a few things in that patch. You do indeed having the select object setup incorrectly to do what you are after. I would use a gate instead. Here's something that does what you're after with some comments explaining what I did.

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

Drew Heaton's icon

Thanks for your input Evan! I'll try it out a little later.

I ended up hacking something together that ended up working for me.

I've always wanted to get into M4L, but it's so daunting. I really appreciate your input. There are so many objects to use, I'm a bit overwhelmed. I didn't even know about a gate. Super useful!

In your example, you have "set session_record $1" and in mine I have "set session_record 1". What's the "$" do?

NOTE_ON_TRIGGER.amxd
amxd 18.10 KB

Evan's icon

That's a variable. That's replaced by whatever is sent to the message. In this case a one or zero from a toggle.

Drew Heaton's icon

Cool. Thank you!