April 19, 2024, 11:01:08 pm
Welcome, Guest. Please login or register
News:

Arturia Forums



Author Topic: HOWTO: Get a virtual modwheel from Aftertouch in Logic Pro X  (Read 1014 times)

rgarner

  • Apprentice
  • *
  • Posts: 13
  • Karma: 0
HOWTO: Get a virtual modwheel from Aftertouch in Logic Pro X
« on: December 30, 2019, 06:15:01 pm »
This tiny keyboard is still great, and tbh I use more for expressive playing in a DAW than I do to trigger the 'freak's internal sounds. Like everyone else, I miss the modwheel, but we can make one ourselves.

If we take the average of all the key values and pipe them to CC1, we get quite a playable controller. I'm finding I prefer this to "real" modwheels. I've tested it with Omnisphere and u-he's Repro synths; both sound great with the MF to start with but this makes it a lovely controller.

By default, this transforms AT to CC1, but if you want to also pass through the AT to your soft synth, check the "Send AT" box.

Paste this into a Logic scripter Script Editor window for expressive soft-synth control:


/*
  Pass PolyPressure through to Mod Wheel.
  Mostly to smoothly emulate a modwheel with an Arturia Microfreak.
 
  Should work for other PP devices, but only tested with the above.
*/

const Notes = new Map();

PluginParameters = [
    {type: 'checkbox', name: 'Send AT', defaultValue: 1}
];

function HandleMIDI(event) {
    /*
      Keep track of notes that are on. Use an initial value of 0; this will almost immediately
      be overridden by PolyPressure events
    */
    if (event instanceof NoteOn) {
        Notes.set(event.pitch, 0);
    }
    if (event instanceof NoteOff) {
        Notes.delete(event.pitch);
    }

    // Average all last seen PolyPressure values to CC1
    if (event instanceof PolyPressure) {
        // Set current note pressure
        Notes.set(event.pitch, event.value);

        // Now average all of them
        noteValues = [...Notes.values()];
        averageValue = noteValues.reduce((total, current) => total + current) / noteValues.length;

        // Send this average to CC1
        mod = new ControlChange(event);
        mod.number = 1;
        mod.value = averageValue;

        mod.send();

        if (!GetParameter('Send AT')) {
            return;
        }
    }

    event.send();
}

 

Carbonate design by Bloc
SMF 2.0.17 | SMF © 2019, Simple Machines