Skip to content

Instantly share code, notes, and snippets.

@asus4
Last active April 29, 2023 02:19
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • 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()
@asus4
Copy link
Author

asus4 commented Apr 7, 2016

README

1.needs portmidi
brew install portmidi

2.requirements.txt
mido

3.midi chartsheet

chartsheet
chartsheet

@asus4
Copy link
Author

asus4 commented Jul 9, 2020

NOTE

def setup_apcmini():
    output = mido.open_output('APC MINI')

    # change all red
    for note in range(0, 99):
        send(output, led_red(note))
   
    # change all yellow
    for note in range(0, 99):
        send(output, led_yellow(note))
    
    # change all yellow
    for note in range(0, 99):
        send(output, led_yellow(note))

@rainsbury
Copy link

Hi, thanks for this it is exactly what I am looking for, but the AKAI community has changed into a forum and I can't get in with an invite from a a member. Is there another copy of the information somewhere please?

@asus4
Copy link
Author

asus4 commented Jun 22, 2021

Hi @rainsbury, here's a copy. - I haven't tested it as I don't have APC Mini now :)
https://discourse.zynthian.org/t/zynseq-a-native-step-sequencer/4043/366
apc_mini_midi_inline

@rainsbury
Copy link

Thanks that is great.
I still have one, although the master volume slider is very erratic and I can't find anybody who sells a replacement at a reasonable price.
I want to use it now with model railway controller digital control. Each channel would be assigned to a loco with the slider controlling speed, and the buttons controlling functions on the sound chip and lights etc.

@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