An easy-to-use and feature-rich Node.js package for interacting with one or multiple Apc Mini's (Mk2) from Akai Professional. It features Full RGB LED color support, button/slider events, input polling, startup animations & so much more! Perfect for scripts, Electron apps, automation, smart home, music production, games, event lightning, ...
Need help? Feel free to join our support server and we will help you fruther!
npm install apc-mini-mk2
We're still searching for sponsors! Would you like to sponsor us?
- βοΈ Lightweight β Minimal footprint, maximum performance.
- π¨ Built with TypeScript β Enjoy full type safety and intelligent autocompletion.
- π¨ Full RGB Color Support β Display awesome RGB lights with full (0-255) RGB.
- π’ Multiple Controllers β Use multiple controllers at the same time.
- βοΈ Highly Customizable β Choose your own coordinate system, limits & more.
- πͺ© Built-in Effects β Choose between 20+ built-in pulse, flicker & fade effects.
- π Coordinates β Use a location index or
(x,y)coordinates for inputs & outputs. - πͺ¦ Preserves State β Preserve the state of the LEDs when disconnected.
- π’ Event Driven β Listen to events and define your own custom reactions.
- π― Input Polling β Fetch the current state of sliders & buttons without events.
- π¬ Startup Animations β Display RGB animations while the device is connecting.
- β Multi Platform β Tested on MacOS & Windows. Linux is untested but should work.
Images will be added to the README soon!
TIP: Detailed examples are available in the
./examples/directory in the Github repository.
const {APCMiniController,rgbToHex,hexToRgb} = require("apc-mini-mk2")
//import {APCMiniController,rgbToHex,hexToRgb} from "apc-mini-mk2"
const apcMini = new APCMiniController(2) //max 2 controllers
//list all connected controllers
apcMini.listAvailableControllers()
//listen for errors
apcMini.on("error",(err) => {
console.error(err)
})
//listen for connected & disconnected controllers
apcMini.on("connect",(id,midiName) => {
console.log("Apc with id "+id+" and name "+midiName+" connected succesfully!")
})
apcMini.on("disconnect",(id,midiName) => {
console.log("Apc with id "+id+" and name "+midiName+" disconnected!")
})
//automatically connecting APC Mini Mk2 controllers
apcMini.startAutoConnect()
// RGB LIGHT EXAMPLES:
//(1) first light: static cyan
//(2) light 2 & 3: static red
//(3) last light & (3,3): blinking white
//(4) first 3 lights on second controller: fading-out blue
apcMini.setRgbLights(0,0,"brightness_100","static","#00ffff")
apcMini.setRgbLights(0,[1,2],"brightness_100","static","#ff0000")
apcMini.setRgbLights(0,[63,{x:3,y:3}],"brightness_10","blinking_1/2","#ffffff")
apcMini.setRgbLights(1,[0,1,2],"brightness_100","fade_out_1/2","#0000ff")
//set & configure horizontal/vertical sidebar lights
apcMini.setHorizontalLights(0,[0,2,3,6],"blink")
apcMini.setVerticalLights(1,[0,1,2,3,4,7],"on")
//listen for button events
apcMini.on("padButtonChanged",(id,location,coords,pressed,shift) => {
console.log("pad button event:",pressed,location,coords,"withShift: "+shift,"controller: "+id)
})
apcMini.on("horizontalButtonChanged",(id,location,pressed,shift) => {
console.log("horizontal button event:",pressed,location,"withShift: "+shift,"controller: "+id)
})
apcMini.on("verticalButtonChanged",(id,location,pressed,shift) => {
console.log("vertical button event:",pressed,location,"withShift: "+shift,"controller: "+id)
})
apcMini.on("sliderChanged",(id,location,value) => {
console.log("slider changed:",location,value)
})
//poll current state of buttons & sliders
console.log("horizontal buttons:",apcMini.getHorizontalStates(0))
console.log("rgb pads:",apcMini.getPadStates(0))
console.log("sliders:",apcMini.getSliderValues(0))This is the main class used to connect, manage and control APC Mini Mk2 devices.
Almost all described functions are a method of this class.
Construction Parameters:
maxControllerAmount?(number): Maximum simultaneously connected controllers. Default:1manualIdAssignmentsEnabled?(boolean): Require manually selecting device IDs by pressing a horizontal button.coordinates?(APCMiniCoordinateSystem): Custom coordinate orientation of the 8Γ8 RGB grid.lightBpm?(number): BPM used for blinking/pulsing modes. Default:60
- (
lightBpm:number) The BPM used for pulsing/blinking light effects. - (
maxControllerAmount:number) Maximum allowed connected APC Mini devices. - (
manualIdAssignmentsEnabled:boolean) Enables manual device ID assignment via pad press during connection. - (
coordinates:APCMiniCoordinateSystem) The coordinate system mapping used for pad grid orientation.
Begins automatically detecting and connecting APC Mini controllers until the max limit is reached.
Stops auto-connecting new controllers.
Connects to a specific controller by MIDI name.
Returns false on failure.
Parameters:
midiName(string): Name fromlistAvailableControllers().customId?(number): Optional forced ID number.
Disconnect a controller by MIDI name or ID.
Returns false on failure.
Parameters:
midiNameOrId(string | number): The controller name or ID.
Disconnects all currently connected controllers.
Returns false on failure.
Returns all unused / available APC Mini Mk2 device names.
Returns all currently connected controller names.
Returns all assigned controller IDs.
Returns how many controllers are currently connected.
Sets the blinking/pulsing BPM for all RGB LED effects.
Parameters:
bpm(number): New BPM value.
Each .on(event, callback) registers a listener for one of the following events:
Triggered when a controller successfully connects.
Callback:
(controllerId: number, midiName: string) => void
Triggered when a controller disconnects.
Callback:
(controllerId: number, midiName: string) => void
Triggered upon connection errors or failures with lights or buttons.
If the error is specific to a controller, it will include the ID.
Callback:
(err: string, controllerId?: number) => void
Triggered when one of the 64 pad buttons has been pressed.
The location & coordinates correspond to the selected coordinate system.
Callback:
(controllerId: number, location: number, coordinates: APCMiniCoordinates, usingShift: boolean) => void
Location Values: (0-63)
Triggered when one of the 64 pad buttons has been released.
The location & coordinates correspond to the selected coordinate system.
Callback:
(controllerId: number, location: number, coordinates: APCMiniCoordinates, usingShift: boolean) => void
Location Values: (0-63)
Triggered when one of the 64 pad buttons has changed states (pressed/released).
The current state of the button is available in the pressed parameter.
Callback:
(controllerId: number, location: number, coordinates: APCMiniCoordinates, pressed: boolean, usingShift: boolean) => void
Location Values: (0-63)
Triggered when one of the 8 horizontal or vertical buttons has been pressed.
Callback:
(controllerId: number, location: number, usingShift: boolean) => void
Location Values: (0-7)
Triggered when one of the 8 horizontal or vertical buttons has been released.
Callback:
(controllerId: number, location: number, usingShift: boolean) => void
Location Values: (0-7)
Triggered when one of the 8 horizontal or vertical buttons has changed states (pressed/released).
The current state of the button is available in the pressed parameter.
Callback:
(controllerId: number, location: number, pressed: boolean, usingShift: boolean) => void
Location Values: (0-7)
Triggered when one of the shift buttons on any controller has been pressed.
Callback:
(controllerId: number) => void): void
Triggered when one of the shift buttons on any controller has been released.
Callback:
(controllerId: number) => void): void
Triggered when one of the shift buttons on any controller has changed states (pressed/released).
The current state of the button is available in the pressed parameter.
Callback:
(controllerId: number, pressed: boolean) => void
Triggered when one of slider values changes.
The current state of the slider is available in the value parameter.
Callback:
(controllerId: number, location: number, value: number) => void
Location: (0-8), Value: (0-127)
Set RGB pad color, brightness and animation (mode) for one or many pads.
Parameters:
controllerId(number): The Controller IDpositions(number|APCMiniCoordinates|Array<...>): Pads to change.brightness(APCMiniBrightnessMode): Brightness of the LEDs.mode(APCMiniLightMode):staticor one of the available LED Effects.color(string): Hex color (e.g.#f8ba00)
Changes the horizontal (red) button LEDs.
Parameters:
positions(number|number[]): A position from0β7.mode("off"|"on"|"blink"): The LED effect to apply.
Changes the vertical (green) button LEDs.
Parameters:
positions(number|number[]): A position from0β7.mode("off"|"on"|"blink"): The LED effect to apply.
Turns off all lights for a specific controller.
Turns off all lights for all controllers.
Fills a rectangular region of pads with an RGB color/mode.
Parameters:
controllerId(number): The Controller IDstartPos(number|APCMiniCoordinates): Start position.width(number): Width of the rectangle (follows the coordinate system).height(number): Height of the rectangle (follows the coordinate system).brightness(APCMiniBrightnessMode): Brightness of the LEDs.mode(APCMiniLightMode):staticor one of the available LED Effects.color(string): Hex color (e.g.#f8ba00)
Returns whether any controller has its Shift button pressed.
Returns pressed state of all 64 RGB pads.
Parameters:
controllerId(number): The Controller ID
Returns state of horizontal buttons.
Parameters:
controllerId(number): The Controller ID
Returns state of vertical buttons.
Parameters:
controllerId(number): The Controller ID
Returns slider values (0β127) for the specified controller.
Parameters:
controllerId(number): The Controller ID
All 3 animation methods accept the following callback:
(time: number, currentFrame: Map<padLoc, hexColor>) => void
Parameters:
time(number): The time since the start of the animation in milliseconds.currentFrame(Map<padLoc,hexColor>): The current (8x8) animation frame, changes made to this map will update the next frame.
Sets the animation displayed before the user selects the controller ID.
Parameters:
animation(APCMiniPreconnectAnimation | null)durationMs(number): The duration of the intro animation.
Animation played while selecting the controller ID.
Parameters:
animation(APCMiniPreconnectAnimation | null)
Animation played after controller ID selection is completed.
Parameters:
animation(APCMiniPreconnectAnimation | null)durationMs(number): The duration of the outro animation.
Utility functions are available directly, outside the APCMiniController class.
Checks if a string is a valid hex color.
Converts a hex color to 0β255 RGB values.
Converts RGB values into a hex color string.
Modifies brightness of a hex color using a (0β1) multiplier.
Converts a pad index (0β63) to X-Y coordinates.
Converts X-Y coordinates to a pad index (0β63).
All contributions are welcome! Feel free to create a pull-request or issue in the Github repository.
![]() |
| π» DJj123dj |
|---|
Thank you for using our package! β support us by sharing it! π
v1.0.3 - README.md
Β© 2026 - DJdj Development - Discord - Terms - Privacy Policy - Support Us - License

