Jump to content

Midi note to Midi CC


Tabula

Recommended Posts

Hello,
I would like to convert Midi note to midi CC, my volca drums can play melody if we trig the CC pitch of the drums parts.
If anyone knows how to make a script for that, It will be very useful !

So to be clear, something like that, for example : 

C1 > CC30
C#1 >CC31
D1>CC32
D#1>CC33
etc....

Thanks ! 
 

Link to comment
Share on other sites

Hi Tabula,

It fairly easy to convert Notes to CCs but as MIDI notes usually come as a pair of Note On and Note Off you need to be specific about how you want to deal with that.

In other words, would you take into account both Note On and Note Off for the conversion to CC or just one of them (On or Off)? 

Then there's the velocities. Would you use those values "as is" for the resulting CCs? For example: 

C1 with velocity 90 should result in CC30 with a value of 90?

J.

  • Like 1
Link to comment
Share on other sites

thanks for your answer!  I just realized that I made a mistake.  I always want to make different note to one midi cc, but rather like this:

C1 > CC30 value 20 
note on/off short sustain
C#1 >CC30 value 25
D1>CC30 value 30
D#1>CC30 value 35
etc..

I don't need to manage sustain, volca drum doesn't manage it, I just need to impulse a midi CC value

I hope I make myself understood

Edited by Tabula
Link to comment
Share on other sites

Hi Tabula,

Thanks for clarifying.

Here's a version (no GUI, just code). I added plenty of comments so it should be clear what's going on:

// Create Control Change object
const cc = new ControlChange();

// Return true if event is a specific Note On
function incomingNote(event, note) {
  return event instanceof NoteOn && event.pitch === MIDI.noteNumber(note);
}

// Send a CC of choice
function outgoingCC(num, val) {
  cc.number = num;
  cc.value = val;
  cc.send();
}

function HandleMIDI(e) {
  // Take incoming C1 Note On
  if (incomingNote(e, 'C1')) {
    // Output CC30 value 20
    outgoingCC(30, 20);
    // Take incoming C#1 Note On
  } else if (incomingNote(e, 'C#1')) {
    // Output CC30 value 25
    outgoingCC(30, 25);
  } else if (incomingNote(e, 'D1')) {
    outgoingCC(30, 30);
  } else if (incomingNote(e, 'D#1')) {
    outgoingCC(30, 35);
  } else {
    // Let non-matching events pass through
    e.send();
  }
}

J.

Edited by Jordi Torres
  • Like 1
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...