Jump to content

Quickly mapping V-Drums to a note


kotrl

Recommended Posts

When using drum libraries that span several octaves, does anybody have a workflow for quickly mapping either drum pads or V-Drums to the sounds they want?

Reconfiguring the drums MIDI output each time is usually a hassle, so I was wondering if a MIDI transform script was the best way to do this on the fly? Or am I looking at this the wrong way?

Link to comment
Share on other sites

After playing with the stock Logic scripts and complaining to ChatGPT for a while I've cobbled together the beginnings of a script. For some reason the note numbers I thought the drums corresponded to didn't add up.

var NOTES = MIDI._noteNames;

var Snare = 38; // D1
var Tom1 = 36; // C2
var Tom2 = 33; // A1
var Tom3 = 31; // G1
var Kick = 24; // C1

//create numbered MIDI CC names, with added "-- Off --" option
var MIDI_CC_NAMES = ["-- Off --"];
for (var i = 0; i < MIDI._ccNames.length; i++) {
  MIDI_CC_NAMES.push(i + " - " + MIDI._ccNames[i]);
}

var PluginParameters = [
  {
    name: "Snare",
    type: "menu",
    valueStrings: NOTES,
    numberOfSteps: 127,
    defaultValue: Snare
  },
  {
    name: "Tom 1",
    type: "menu",
    valueStrings: NOTES,
    numberOfSteps: 127,
    defaultValue: Tom1
  },
  {
    name: "Tom 2",
    type: "menu",
    valueStrings: NOTES,
    numberOfSteps: 127,
    defaultValue: Tom2
  },
  {
    name: "Tom 3",
    type: "menu",
    valueStrings: NOTES,
    numberOfSteps: 127,
    defaultValue: Tom3
  },
  {
    name: "Kick Drum",
    type: "menu",
    valueStrings: NOTES,
    numberOfSteps: 127,
    defaultValue: Kick
  }
];


function HandleMIDI(event) {
  if (event instanceof NoteOn) {
    switch (event.pitch) {
      case 38: // D1 (Snare)
        event.pitch = Snare;
        break;
      case 48: // C2 (Tom 1)
        event.pitch = Tom1;
        break;
      case 47: // A1 (Tom 2)
        event.pitch = Tom2;
        break;
      case 45: // G1 (Tom 3)
        event.pitch = Tom3;
        break;
      case 36: // C1 (Kick Drum)
        event.pitch = Kick;
        break;
    }

    event.send();

    // Create and send NoteOff event
    var off = new NoteOff(event);
    off.sendAfterMilliseconds(100);
  }
}



function ParameterChanged(param, value) {
  switch (param) {
    case 0: // Snare
      Snare = value;
      break;
    case 1: // Tom 1
      Tom1 = value;
      break;
    case 2: // Tom 2
      Tom2 = value;
      break;
    case 3: // Tom 3
      Tom3 = value;
      break;
    case 4: // Kick Drum
      Kick = value;
      break;
  }
}

                                         

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...