Coder Social home page Coder Social logo

midimorph's Introduction

MidiMorph

MidiMorph is a Max for Live device that allows smooth interpolation between two MIDI clips. The output can be played directly from the device, saved to a new clip, or continuously updated to a destination clip. Source and destination clips are monitored for changes.

Download under releases or at maxforlive.com

UI Demo

Usage

  1. Drag the device into a MIDI track
  2. Select the source clip
  3. Click the From button
  4. Select the destination clip
  5. Click the To button
  6. Adjust the Morph dial (0 is identical to source, 1 is destination, 0.5 is half-way)

Output:

  • Play directly from the device (if the Play toggle is on)
  • Click the Clip button to save the current state selected by the Morph dial to a new clip
  • Create a new clip, select it, then click the Out button to select permanent output to the newly created clip (will be overwritten whenever a new Morph value is selected or parameters changed)

Algorithm

MidiMorph works by assigning pairs of notes from the source and destination clips, then interpolating between the two notes of each pair to generate the intermediate notes. The pairs are assigned so that the sum of note distances is minimal, where distance is defined as the euclidean distance in the pitch/time-plane (like in the piano roll). Finding the pairs in this way presents the classic assignment problem which is solved here using the Jonker-Volgenant algorithm implemented in https://github.com/Fil/lap-jv.

Notes that remain unpaired (because the number of notes differ between the source and destination clips) can be handled in one of two ways:

  1. They can be paired in additional assignment rounds, such that one note from the clip that has fewer notes then has multiple notes from the other clip assigned to it.
  2. They can remain unpaired and get faded or muted. Technically, they get paired with pseudo notes that are silent versions of themselves.

Quantization

Selecting any of the values from the Quantize menu will quantize notes to the selected value. This applies to the endpoints as well, i.e. output at 0.0 and 1.0 is quantized, too.

Unpaired Notes

Using the Assign toggle you can select what happens to notes that remain unpaired after the first assignment pass as outlined above. If it's on, the remaining notes are assigned in additional assignment rounds using the same algorithm until all notes have been paired.

If the Assign toggle is off, the remaining notes will not be assigned to notes from the other clip. Instead, they will get paired with pseudo-notes that are silent versions of themselves. This means they will stay in place and fade out or get muted (depending on the Mute/Fade selection described below).

The image below shows the transition between the same two clips as the demo at the top but with Assign enabled. The single note at the top right (F3) is now paired and converges to the note at the bottom right (A2).

Assign enabled

Mute/Fade

Notes that remained unpaired after the first round of assignment will either fade out or get muted. You can choose either behavior from the Mute/Fade menu. In the fade case, the velocity will transition to zero and once it reaches zero, the note will be removed. When mute is selected, the note will stay at its original velocity up to half way, then get removed.

Skip Mute

If the Skip Mute toggle is on, notes in either clip that are muted will be ignored. If it's off, muted notes will participate in the assignment and interpolation process. If they are paired with non-muted notes, intermediate notes will be unmuted at half-way.

Overlap

If intermediate notes overlap and the Overlap toggle is on, the overlapping notes are merged into one note which is identical to the one that starts earliest.

Drums

If the Drums toggle is on, all notes that have the same pitch will be handled independently from those that have a different pitch, i.e. notes of one pitch will only be morphed into notes that have the same pitch.

Steps/Sequences

The Steps dial selects the number of interpolation steps. The Sequences dial selects the number of "sequences" which can be thought of as sub-steps. Consider the case where you have 10 notes in both the source and destination clips and the number of steps is 100. If the number of sequences is 100 all notes will be moved 1/100 of the distance at each step. If the number of sequences is 10, only one note will be moved 1/10 of the distance at each step. The idea is to get more subtle changes at a single step in this way.

The images below show the same transition, both have steps set to 4, the first one has sequences set to 2, the second one has sequences set to 4.

2 Sequences 4 Sequences

Pitch Scale

The cost function used to assign note pairs calculates a distance in the pitch/time plane. The Scale dial selects the number of semitones that are equal in distance to one beat.

Technical Notes

Whenever a parameter changes, all steps are precalculated. For immediate playback from the device, all values are saved to a coll and playback is triggered by a metro with resolution of one tick.

midimorph's People

Contributors

mganss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

midimorph's Issues

Can't assign clips in Live 11

Hey,

Rly sick work! Exactly what I was looking for, v much appreciated that you've made it available for free. On the off chance you might still be patching I wanted to flag that it doesn't seem to be working with Live 11.

I tried applying the device to both a drum rack and some standard MIDI clips in Live 11. In whichever order I did things - whether I selected the clips first then clicked the 'from' and 'to' buttons, or armed the buttons first then selected the clips - they'd still appear as <empty>. Ableton also gave me a dialogue about the device using an 'older process' that might lose newly-introduced data like MPE and probability; this isn't so much an issue for me but I suspect it could have smth to do with the compatibility issues, esp. since at one point the dialogue would pop up again every time I hit 'proceed'. This made stopping the playback I already had running inaccessible, so in my silliness I clicked 'don't show again' without snagging a screenshot first, but I could probably dig one up online.

Would happily buy a patched version.

Cheers :))

Doesn't appear to work on my set-up - possibly user error!

Thank you for your more detailed instructions on https://maxforlive.com/library/device/5550/midimorph
However I'm still having issues - no hassle - just wanted to get back to you as I cant get this to work for me.

Windows 10, Ableton Suite 10.1. This is a new clean build PC about 12mths old.

I select the clip on the track for FROM and I then select the clip and then TO I then select the clip for the output. The buttons trun yellow - I get "Midi 1" for From and "Midi 2" for To - although th e track name is Synthmaster and the clips are called A and B respectively.

There is a VST on the track along with MidiMorph - selecting "Clip" dosent appear to do anything - nothing is written to the selected clip. Also even though "Out" is selected - there are no notes heard - even though the transport is playing. Nothing really seems to be happening?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.