Skip to content
Back to skills

Apc Code Samples

ASecurity

TypeScript and Node.js code samples for APC Mini MK2 development. Use when user needs "code example", "implementation", "easymidi", "@julusian/midi", "sample code", "how to implement", or wants working code for LED control, button handling, or MIDI communication.

  • 57 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 17, 2026
developmenttypescriptbashnodeapi

Works with

  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned October 17, 2026

npx -y skills add diegosouzapw/awesome-omni-skill --skill apc-code-samples --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Apc Code Samples?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Apc Code Samples
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/diegosouzapw-apc-code-samples/badge)](https://www.skillsdirectory.com/skills/diegosouzapw-apc-code-samples)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: apc-code-samples
description: TypeScript and Node.js code samples for APC Mini MK2 development. Use when user needs "code example", "implementation", "easymidi", "@julusian/midi", "sample code", "how to implement", or wants working code for LED control, button handling, or MIDI communication.
---

# APC Mini MK2 Code Samples

Quick start examples. For complete implementation details, see [reference.md](reference.md).

## Library Setup

```bash
# Rapid development
npm install easymidi && npm install -D @types/easymidi

# Production
npm install @julusian/midi
```

## Basic Connection

```typescript
import easymidi from 'easymidi';

const createConnection = () => ({
  output: new easymidi.Output('APC mini mk2'),
  input: new easymidi.Input('APC mini mk2')
} as const);
```

## Set Pad Color

```typescript
// Red at full brightness (channel 6)
const setPad = (output: Output, note: number, velocity: number, channel = 6): void =>
  output.send('noteon', { note, velocity, channel });

// Turn off
const setPadOff = (output: Output, note: number): void =>
  output.send('noteon', { note, velocity: 0, channel: 0 });
```

## Handle Button Press

```typescript
const onPadPress = (input: Input, callback: (pad: number) => void): void =>
  input.on('noteon', (msg) => {
    if (msg.note < 64 && msg.velocity > 0) callback(msg.note);
  });

const onTrackButton = (input: Input, callback: (track: number) => void): void =>
  input.on('noteon', (msg) => {
    if (msg.note >= 100 && msg.note <= 107) callback(msg.note - 99);
  });

const onSceneButton = (input: Input, callback: (scene: number) => void): void =>
  input.on('noteon', (msg) => {
    if (msg.note >= 112 && msg.note <= 119) callback(msg.note - 111);
  });
```

## Handle Fader

```typescript
const onFader = (input: Input, callback: (fader: number, value: number) => void): void =>
  input.on('cc', (msg) => {
    if (msg.controller >= 48 && msg.controller <= 56) {
      callback(msg.controller - 47, msg.value);
    }
  });
```

## Custom RGB

```typescript
const encodeRGB = (v: number): readonly [number, number] =>
  [(v >> 7) & 0x01, v & 0x7F] as const;

const setRGB = (output: Output, pad: number, r: number, g: number, b: number): void =>
  output.send('sysex', [
    0xF0, 0x47, 0x7F, 0x4F, 0x24, 0x00, 0x08,
    pad, pad, ...encodeRGB(r), ...encodeRGB(g), ...encodeRGB(b),
    0xF7
  ]);
```

## Color Constants

```typescript
const Colors = {
  OFF: 0, WHITE: 3, RED: 5, ORANGE: 9, YELLOW: 13,
  GREEN: 21, CYAN: 33, BLUE: 45, PURPLE: 49, MAGENTA: 53
} as const;
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.