Skip to content

Instantly share code, notes, and snippets.

@asus4
Last active April 29, 2023 02:19
Show Gist options
  • Save asus4/bb4e14b1998814f27bc4c7905da650ce to your computer and use it in GitHub Desktop.
Save asus4/bb4e14b1998814f27bc4c7905da650ce to your computer and use it in GitHub Desktop.
Setup AKAI APC mini button colors without Ableton Live
#!/usr/bin/env python
# coding: UTF-8
'''
Setup apc mini colors without Ablton Live
----------
> brew install portmidi
requirements.txt
mido
# https://github.com/olemb/mido
----------
API mini cheetsheet
http://community.akaipro.com/akai_professional/topics/midi-information-for-apc-mini
'''
import mido
import time
def led_off(note):
return mido.Message('note_on', note=note, velocity=0)
def led_green(note):
return mido.Message('note_on', note=note, velocity=1)
def led_green_blink(note):
return mido.Message('note_on', note=note, velocity=2)
def led_red(note):
return mido.Message('note_on', note=note, velocity=3)
def led_red_blink(note):
return mido.Message('note_on', note=note, velocity=4)
def led_yellow(note):
return mido.Message('note_on', note=note, velocity=5)
def led_yellow_blink(note):
return mido.Message('note_on', note=note, velocity=6)
def send(output, msg):
output.send(msg)
time.sleep(0.0015) # wait 1ms
def setup_apcmini():
output = mido.open_output('APC MINI')
# reset all
for note in range(0, 99):
send(output, led_off(note))
# set for unity
for note in range(0, 12):
send(output, led_green(note))
for note in range(64, 72): # 64-71 red only
send(output, led_red(note))
# set for resolume avenue
for note in range(40, 64):
send(output, led_yellow(note))
# set scene change
for note in range(82, 90): # 82 - 90 green only
send(output, led_green(note))
if __name__ == '__main__':
setup_apcmini()
@lastiq
Copy link

lastiq commented Sep 9, 2021

Hi there!
Thanks for the work, but have ever tested that script in Windows?

@asus4
Copy link
Author

asus4 commented Sep 9, 2021

@lastiq No only tested on macOS,
If mido works on Windows, this should work as well.
Please refer to the documentations for mido

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment