Last active
September 8, 2023 09:45
-
-
Save cowboy/5b1a2ec4a2c8757985df25194b958dc4 to your computer and use it in GitHub Desktop.
Amits Launch Pad Pro Light Show Editor - Unofficial Launchpad Mini Mk3 support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run this in the console at https://midi.amitszone.com/LPP_LIGHTSHOW_BUILDER/ | |
// to get it to work with the Launchpad Mini Mk3. It may work with other new | |
// Launchpads, I'm not sure (If it does, comment below, thanks!) | |
(() => { | |
// Create mapping of Launchpad Pro -> Mini Mk3 notes | |
// (This is only the mapping for the 8x8 grid area) | |
const noteMap = {} | |
for (let i = 1; i <= 8; i++) { | |
for (let j = 1; j <= 8; j++) { | |
noteMap[10 * i + j] = i * 4 + j + (j > 4 ? 59 : 31) | |
} | |
} | |
// Override existing app grid/preview behavior with our own | |
const midiChannel = 1 | |
const obj = vueApp.MIDI.OUT1.PORT | |
const playNote = obj.playNote.bind(obj) | |
obj.playNote = (note, channel, options) => { | |
const newNote = noteMap[note] | |
if (newNote) { | |
playNote(newNote, midiChannel, options) | |
} | |
} | |
// Override MIDI export | |
const toMIDI = Model.toMIDI.bind(Model) | |
const forEach = (fn) => Model.FRAMES.forEach(f => f.MAP.forEach(r => r.forEach(fn))) | |
Model.toMIDI = () => { | |
forEach(p => { | |
p._index = p.INDEX | |
p.INDEX = noteMap[p.INDEX] | |
}) | |
toMIDI() | |
forEach(p => { | |
p.INDEX = p._index | |
}) | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment