Logic Pro Scripter for Humanizing Notes with Fixed Length
-
michaelrasbury michaelrasbury https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=480887
- KVRer
- 9 posts since 1 Dec, 2020
I posted this over on Logic Pro Help also... Is it possible to create script for Logic’s Scripter that does the following? I'm trying to humanize a bunch of notes with perfect lengths, without also having to do so note by note. My hope is that I can create an articulation set and assign the articulations to the range of perfect notes beforehand, and then have scripter send an altered length to the virtual instrument based on the articulation.
The script will assume that MIDI notes have been imported from a notation program or all note lengths has been quantized so all note values have perfectly quantized lengths (like MIDI looks exported from Finale.)
It will rely on a Logic Articulation Set that has at a minimum the following articulations:
No. Articulation
1 Sustain
2 Legato
3 Marcato
4 Staccato
5 Staccatissimo
6 Tenuto
-If the articulation is marked Legato it will sound a 5% longer MIDI note or 105% of the original length MIDI note to the instrument.
-If the articulation is marked Marcato it will sound a 15% shorter MIDI note or 85% of the original length MIDI note to the instrument.
-If the articulation is marked Staccato it will sound a 50% shorter MIDI note or 50% of the original length MIDI note to the instrument.
-If the articulation is marked Staccatissimo it will sound a 75% shorter MIDI note or 25% of the original length MIDI note to the instrument.
-If the articulation is marked Tenuto it will sound a 5% shorter MIDI note or 95% of the original length MIDI note to the instrument.
-All other notes of any other articulation or without articulations will sound a 15% shorter MIDI note or 85% of the original length MIDI note.
The script will assume that MIDI notes have been imported from a notation program or all note lengths has been quantized so all note values have perfectly quantized lengths (like MIDI looks exported from Finale.)
It will rely on a Logic Articulation Set that has at a minimum the following articulations:
No. Articulation
1 Sustain
2 Legato
3 Marcato
4 Staccato
5 Staccatissimo
6 Tenuto
-If the articulation is marked Legato it will sound a 5% longer MIDI note or 105% of the original length MIDI note to the instrument.
-If the articulation is marked Marcato it will sound a 15% shorter MIDI note or 85% of the original length MIDI note to the instrument.
-If the articulation is marked Staccato it will sound a 50% shorter MIDI note or 50% of the original length MIDI note to the instrument.
-If the articulation is marked Staccatissimo it will sound a 75% shorter MIDI note or 25% of the original length MIDI note to the instrument.
-If the articulation is marked Tenuto it will sound a 5% shorter MIDI note or 95% of the original length MIDI note to the instrument.
-All other notes of any other articulation or without articulations will sound a 15% shorter MIDI note or 85% of the original length MIDI note.
- KVRAF
- 8043 posts since 28 Dec, 2015 from Atlantis Island
Isn't this possible with the MIDI humanizer?
https://sonograyn.bandcamp.com/music Experimental Ambient
https://martinjuenke.bandcamp.com/music Alternative Instrumental
https://martinjuenke.bandcamp.com/music Alternative Instrumental
-
michaelrasbury michaelrasbury https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=480887
- KVRer
- Topic Starter
- 9 posts since 1 Dec, 2020
Not sure I follow... MUCH is possible in the MIDI Transform window, but I'm not sure if would retranslate a range of MIDI notes in the way I'm asking without me meticulously repeating multiple functions. I could also go through the entire track resizing MIDI notes while referring to the notation's articulations. I'm hoping that scripter can do this in real-time if all the notes are already exact as listed above. I'm not trying to do a random humanization to be clear. I have perfect notes with exact lengths coming from notations programs and want to translate each into a slightly shorter note but with specific outcomes based on the articulations I assign them.
- KVRian
- 687 posts since 29 Nov, 2002 from Finland
One issue might be the fact that Scripter doesn’t know in advance the length of a note, as it just receives note on & note off events... so it can’t make notes shorter by a specific ratio without knowing the original length. Hmm. Maybe there is some way I can’t think of right now... I’ll try to take a look at it when I’m back at the computer. 
EDIT: Stupid me, you said that the original note lengths are fixed? In that case it should definitely be possible! Or, do you mean they are just quantized to some nearest note value?
EDIT: Stupid me, you said that the original note lengths are fixed? In that case it should definitely be possible! Or, do you mean they are just quantized to some nearest note value?
-
michaelrasbury michaelrasbury https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=480887
- KVRer
- Topic Starter
- 9 posts since 1 Dec, 2020
The notes would be coming in as imported MIDI from Finale. A quarter note would be an exact quarter note, and eighth note would be an exact eighth note, etc. The only difference is for example I need to first identify that some eighth notes to be marked as Staccato where others are not. This would cause the eighth note that has been identified by an articulation set to be played Staccato, to also be sounded a different predetermined length compared to an unmarked eighth note. The only way I know to identify what type of note in Logic I want it to be (whether it be already an exact quarter note, whole note, 16th note, etc.) is to use Logic’s articulation set to apply an articulation number to teach note first. You can also add articulation markings in the notation editor, but these seem to have no bearing on the midi performance. My guess is that scripter probably can’t perceive what articulation has been applied to a midi note in a track, though.
- KVRAF
- 9590 posts since 6 Jan, 2017 from Outer Space
You would always have to process the sequence in advance. Might be easier to do it in Finale...
Or you hack something into the sequence like make every note very short and use release velocity as information for the duration... Then have the scripter correct it accordingly...
You might be able to have one scripter transform the sequence into short notes with release velocity (record it to a new track) and another scripter to do your envisioned magic...
Or you hack something into the sequence like make every note very short and use release velocity as information for the duration... Then have the scripter correct it accordingly...
You might be able to have one scripter transform the sequence into short notes with release velocity (record it to a new track) and another scripter to do your envisioned magic...
-
michaelrasbury michaelrasbury https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=480887
- KVRer
- Topic Starter
- 9 posts since 1 Dec, 2020
Yeah I’m starting to think this is impossible! Scripter could indeed shorten all notes to a prescribed length, but I still need it to read some kind of marking that differentiates for example one eighth note from another eighth note. There are instances when one of those eighth notes would need to be shorter than the other. And, in order to make things sound good in finale without making a lot of work, it has to create notes of perfect length! So, I guess I will be resizing notes by hand one by one 
-
- KVRian
- 826 posts since 28 Oct, 2014
I was looking into this last night. Scripter can read articulation IDs, so if you want to set notes to a specific length based on the articulation, it can be done. What can't be done is to shorten a note length by a particular amount because there's no way for Scripter to see the MIDI information as a whole, but instead it looks at the note-ons and offs as they occur in real time.
-
michaelrasbury michaelrasbury https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=480887
- KVRer
- Topic Starter
- 9 posts since 1 Dec, 2020
I guess that answers the question then! Scripter will see the ID but then can't do what I want it to do with that information. Thanks!
- KVRAF
- 9590 posts since 6 Jan, 2017 from Outer Space
Unless you place the missing information into the release velocity of a shortened note... Its all about information you need and how to communicate it... filter the note off of that shortened note (lets put it to a 64th) and then have the original length coded into a release velocity value. For example 1 for a whole note 2 for a half note etc. some extra codes for triplets and dotted notes. Then when that information arrives with the release velocity you can calculate the delay to send the note off according to the articulation and that decoded length... I don’t know why that shouldn’t work...michaelrasbury wrote: Thu Feb 11, 2021 6:54 pm I guess that answers the question then! Scripter will see the ID but then can't do what I want it to do with that information. Thanks!
Its quite a bit of programming work though. Only valuable if you need it for more than one piece...
- KVRian
- 687 posts since 29 Nov, 2002 from Finland
I was thinking of something similar, you could also "hide" the original length in this new short length, so that one tick stands for 1/16, for example. Or you could try using the articulation ID itself, there's 256 of them, so with 6 proper articulations, that would allow us to encode 42 note lengths into the articulation ID. But all this gets a little complicated, is not very beautiful, and messes up the original note data. Probably a non-realtime solution would be the best way to approach this.
- KVRAF
- 9590 posts since 6 Jan, 2017 from Outer Space
It depends a bit also how the original Finale score is done and how much tweaking score details is maybe algorithmical. I don’t know Finale, but usually I would assume that a scoring program should be capable to translate articulations into Midi. A staccato note has always the same length, no matter what the note duration is set to, but also sounds different. If staccato is just set with an articulation to a short staccato sound the length isn’t important anymore. Most orchestral libraries can be played lively without changing note lengths...
And the best humanizer is still the human being, a musician interpreting the score in one go...
I played a bit with Bach, Cage and Dada in Max which allows endless manipulations. But thats a bit nerdy with a very steep learning curve...
And the best humanizer is still the human being, a musician interpreting the score in one go...
I played a bit with Bach, Cage and Dada in Max which allows endless manipulations. But thats a bit nerdy with a very steep learning curve...
-
michaelrasbury michaelrasbury https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=480887
- KVRer
- Topic Starter
- 9 posts since 1 Dec, 2020
I’m trying to emulate to some degree what NotePerformer3 does automatically. It doesn’t use samples. It uses synthesis/modeling to re-create brass instruments. It shortens notes based on articulation markings added in the score in finale and then uses those same articulation markings to determine what envelope shape to use to emulate the articulation. The notation exported from finale is perfected MIDI notes of exact length. I am aware I’m going to have to redraw all of the cc data to emulate the various envelope shapes but I was hoping I could find a more automatic process for determining note length.
The reason why notation programs make perfect looking MIDI notes is because this is required to display the notation correctly. You could create “Messier“ notes in notation programs, but that would really defeat the purpose. We see this all the time in digital audio workstations because of the very reasons noted in your responses. In notation programs, you can assign playback to sample libraries that include different recordings of articulations. You can then export this with included patch changes. I’m 100% certain I’m not telling you anything you don’t already know about notation programs! This is something a little different from that though.
I do know one thing-this level of programming is going to be way over my head. I only understand basic commands. I appreciate all the brainstorming though. This could be a useful script for others who regularly import Finale notation into logic. That notation is going to almost always produce connected MIDI notes. Of course, when real musicians see an eighth note with a staccato articulation, they will almost always play it shorter than the actual length of an eighth note. My thought is, if you first go through the performance quickly adding articulation set markings, then the script should be able to automatically play an eighth note, for instance, a little shorter than another based on its articulation marking. This would save some significant amount of time because otherwise each note has to be visited and the length manually altered. Step one to humanizing perfected midi notes is to make sure all the notes aren’t sounding connected- unless there is a slurred or legato passage that requires it!
The reason why notation programs make perfect looking MIDI notes is because this is required to display the notation correctly. You could create “Messier“ notes in notation programs, but that would really defeat the purpose. We see this all the time in digital audio workstations because of the very reasons noted in your responses. In notation programs, you can assign playback to sample libraries that include different recordings of articulations. You can then export this with included patch changes. I’m 100% certain I’m not telling you anything you don’t already know about notation programs! This is something a little different from that though.
I do know one thing-this level of programming is going to be way over my head. I only understand basic commands. I appreciate all the brainstorming though. This could be a useful script for others who regularly import Finale notation into logic. That notation is going to almost always produce connected MIDI notes. Of course, when real musicians see an eighth note with a staccato articulation, they will almost always play it shorter than the actual length of an eighth note. My thought is, if you first go through the performance quickly adding articulation set markings, then the script should be able to automatically play an eighth note, for instance, a little shorter than another based on its articulation marking. This would save some significant amount of time because otherwise each note has to be visited and the length manually altered. Step one to humanizing perfected midi notes is to make sure all the notes aren’t sounding connected- unless there is a slurred or legato passage that requires it!
-
- KVRian
- 826 posts since 28 Oct, 2014
Here's something. This script lets you assign a note length to any given articulation ID. In the version I've pasted here I added a couple of example settings for articulations 1 and 29. These are the numbers used by Logic's Studio Strings instrument (using the Violins 1 preset) for the 'Sustain' and 'Trill Semi' articulations.
You'll need to find out what the articulation ID numbers are as Scripter doesn't work with the text names of the articulations. You can see what the numerical IDs are by opening the articulation editor window.
Code: Select all
var NeedsTimingInfo = true;
var artID = [];
// A list of articulation IDs with an associated note length.
// artID[ID] = note length;
artID[1] = 1;
artID[29] = 0.75;
function HandleMIDI(event)
{
// See if an incoming articulation ID matches our list.
// If it does, create a Note Off event and send it after the listed number of beats.
if(event instanceof NoteOn && artID[event.articulationID])
{
var newNoteOff = new NoteOff(event);
newNoteOff.sendAfterBeats(artID[event.articulationID]);
}
// Pass through all MIDI events other than the Note Off we're adjusting.
if(!(event instanceof NoteOff && artID[event.articulationID]))
{
event.send();
}
}-
michaelrasbury michaelrasbury https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=480887
- KVRer
- Topic Starter
- 9 posts since 1 Dec, 2020
Cool! I look forward to trying this. To be sure I understand, artID[1] = 1 is telling the scripter to pass the note at its original full length and artID[29] = 0.75 is telling the scripter to play that note at 75 percent its original length? Can I do 1.05 or something like that to make a note sound longer than its original length?
