Songpart script

Hello!

I’m using rackspace scripts to automatically activate the right track in Ableton Live if a rackspace is selected. I have a controller button on my keyboard to select next rackspace, so I always move forward. If I need the same rackspace again, I’ll just duplicate it.
To reduce the number of rackspaces, I would like to start using the setlist, so I can reuse the same rackspace again.
If I need the same rackspace in a song twice, I need two different tracks in Ableton Live.

  • So in the first songpart I need to activate track 1
  • In the second songpart I need to enable track 2 in Ableton Live, using the same rackspace.

The easiest way to do this: move the rackspace script to a songpart script.
Unfortunately, there’s no support for songpart scripts.

Do you have any ideas how to deal with this?
Going back to duplicate rackspaces is probably the easiest way:

  • Use rackspace 1 to activate track 1.
  • Use rackspace 2 (a duplicate of rackspace 1) to activate track 2.

Are you using Arrangement View or Scene View in Ableton Live?
With a M4L Device you can automatically change Scenes.
Are you on Mac or Windows?

Sure there is. In a song script you can write callbacks that are triggered when a songpart is selected.
Also, song parts support actions and one of the actions is the ability to send an OSC message so you could send a specific OSC message to Live as you select different song parts.

1 Like

I’m using Scene View, but not really using them, I’m playing / recording / looping everything live on the fly.
And yes, I’m using an M4L device: not to change Scenes, but to activate / disable tracks. My M4L device is not quite as fancy as yours, but it does the job for what I need :wink:
…and finally, I’m a Mac user.

Oh, that sounds like the missing piece I didn’t know about! :grinning:
I’ll start looking into this, thanks for the hint!

Nice, works as expected! :grinning:
I can continue setting the default track to arm for a rackspace in the rackspace script (like a bass sound is always in track 1).
Only in the few cases when I use the same rackspace in a song twice, I can use the song script with a Songpart event to arm a different track, thus overriding the rackspace script.

Below an example how this looks like:

var mOSC      : OSCMessage  
    mOSCP     : OSCMessage
    mOSCT     : OSCMessage   
     

Function sendMessage (track : Integer, command : String)
    OSC_SetAddress(mOSCP, command)
    // Track-Nr, index starts at 0
    OSC_AppendIntArg(mOSCP, track)
    OSC_SendSpecific(mOSCP, "127.0.0.1", 8000)
    OSC_ClearArgs(mOSCP)
End

Function armTrack (track : Integer)
     sendMessage(track, "/ArmTrack")
End

Function disarmTrack (track : Integer)
     sendMessage(track, "/DisarmTrack")
End
    

on Activate
 // arm the default track in Ableton for this rackspace, disarm all other tracks
 disarmTrack(0)
 disarmTrack(1)
 disarmTrack(2)
 disarmTrack(3)
 disarmTrack(4)
 armTrack(5)
 disarmTrack(6)
 disarmTrack(7)

end

And here the relevant snippet from the Songpart script (not replicating the other identical code from the rackspace script): This one will arm a different track in Ableton if Songpart 5 is selected.

On Songpart(oldSongpartIndex : integer, newSongpartIndex : integer)
    // Called when you switch to another songpart
    
    If newSongpartIndex == 4
	Then
		disarmTrack(0)
		disarmTrack(1)
		disarmTrack(2)
		disarmTrack(3)
		armTrack(4)
		disarmTrack(5)
		disarmTrack(6)
		disarmTrack(7)

    End
End

An M4L device in Ableton is receiving these messages and then arms / disarms tracks as configured in the rackspace / songpart script.

Glad it works for you but I’m wondering why you are declaring all those OSCMessage variables and that sendMessage function.

Change your call to armTrack (and similarly disarmTrack) to

Function armTrack (track : Integer)
     SendOSCMessage { /ArmTrack, track }  to "127.0.0.1" : 8000  
End

Function disarmTrack (track : Integer)
     SendOSCMessage { /DisarmTrack, track }  to "127.0.0.1" : 8000  
End

1 Like

I found that script quite a long time ago, it supported also other features, see the instructions from the M4L device below. For these features some variables were used. As I’m not using these, I also started removing that code from rackspace scripts, apparently not really cleaning up everything…
Thanks for the hints, some cleanup makes sense, removed all the variables and the sendMessage function, the new SendOSCMessage makes things easier :slight_smile:

M4L Device
Config in GigPerformer:

  • Activate OSC
  • Use Port 8000

Functions:

  • StartClip [TrackNr] [ClipSlotNr]
  • ArmTrack [TrackNr]
  • DisarmTrack [TrackNr]
  • SetScene [SceneNr]
  • LaunchScene

There would probably also be quite some room for improvement in my very old M4L device, but as long as it works I’m just too lazy and also not familiar working with M4L…