Random notes in clip.
  1. Install AbletonOSC.
  2. Install Python for Windows. Type “Python” in Windows Terminal to open the latest Microsoft Store page for it.
  3. Use the following script …
    from pythonosc import udp_client
    
    import argparse
    import random
    import time
    
    parser = argparse.ArgumentParser()
    parser.add_argument("--ip", default="127.0.0.1",
        help="The ip of the OSC server")
    parser.add_argument("--port", type=int, default=11000,
        help="The port the OSC server is listening on")
    args = parser.parse_args()
    
    client = udp_client.SimpleUDPClient(args.ip, args.port)
    
    notes = range(40, 90)
    times = range(0, 8)
    lengths = range(1, 8)
    
    for i in range(20):
        note = random.choice(notes)
        time = round(random.uniform(0, 3.9), 6)
        duration = round(random.uniform(0.001, 0.3), 6)
        # track_id, clip_id, pitch, start_time, duration, velocity, mute
        print("/live/clip/add_new_note", (0, 0, note, time, duration, 100, 0))
        client.send_message("/live/clip/add_new_note", (0, 0, note, time, duration, 100, 0))
    
  4. You might have to install some things. For example “pip install mido –user“.
  5. Manually create clip in the first track of Ableton.
  6. Run the script from the command line, “python <script name>.py“.
  7. You should now have random MIDI notes in the clip item.

Please not that the script is somewhat unrefined. It should ask what track and clip you want to send the MIDI to, as well as creating the clip for you, but that’s for a future update. Enjoy !

1,228 views

Leave a Reply

Your email address will not be published. Required fields are marked *