You are here

Easy articulation

After adding music to a track via MIDI keyboard, the material of course needs editing. Changing the "velocity" of individual notes to give a better shape to phrases is easy, and the result is easily tested.

What is much more difficult, I find, is adjusting the length of notes to produce a convincing legato or articulated effect. Although qtractor has a marvellous array of tools for editing midi tracks, it doesn't seem to have an easy way to to do this.

What I have in mind is a tool which would allow one to select 2 or more notes, and then adjust the end time of each of them (apart from the last) to coincide with the start of the next note, producing a legato effect. Alternatively, one could specify the amount of time there should be between each Note_off event and the following Note_on, to produce different sorts of articulation.

It is quite possible that this facility already exists in qtractor and I have just not managed to find it. But if not, is it perhaps something that could be considered for a future release?


rncbc's picture


maybe in another release? this next one v0.9.36 is already in translation freeze, so no cigar :)

could it be a new option to MIDI Tools > Resize > Duration > Legato (checkbox) ?


Hi, thanks for your encouragement!

I think that MIDI Tools > Resize > Duration is certainly the place for it. But even if it is called "legato" -- and I can't think what else to call it -- I would still hope for it to have an option to set a consistent (non-zero) gap between notes, as well as the true legato option with zero gap.

rncbc's picture

hi, just to let you know, that this new option is already up on develop branch (qtractor >=


ps. now thinking about yet another parameter to this "legato" option, like a percentage (of the gap) ?
pps. done legato/gap percentage is in (qtractor >=

That's great! I wasn't expecting such a quick result. I'll change to the git version tomorrow.


I have now got the development version of qtractor, which of course has the new Resize "legato" option.

This does not seem to work quite as hoped. Instead of joining each note to the subsequent one (regardless of pitch), it seems only to join a note of a given pitch to the final note of the same pitch, if there happens to be one.

Also I am wondering whether a percentage is the right way to specify the gap between notes - it rather depends on what it is a percentage of.

What I originally had in mind was a way of specifying that a selected series of notes should either join each to the next (i.e. NoteOff for note 'n' coincides with NoteOn for note 'n+1') regardless of pitch, or that one could have a consistent gap between successive notes. By 'consistent' I mean that the gaps should be equal in time, regardless of the horizontal spacing of the notes. The gap could be expressed as time, or better perhaps as a percentage of a beat, but it shouldn't be a percentage of the note-length, otherwise slow notes would be more separated than quicker ones.

I also think that it might occasionally be useful to have the option of specifying a "negative gap", i.e. a slight overlap between notes, perhaps by specifying a percentage greater than 100%.

rncbc's picture

I think you're asking for something that is probably impossible to accomplish: "polyphonic legato" ? i even wonder what that means, let alone how to implement it, in a deterministically way, I mean...

so, in my book, legato only makes sense on a monophonic scenario... so what happens, or should happen, when more that one note is being played simultaneously (ie. polyphonic'ally or in a chord context)? which notes, any or all, are to be extended to the onset of the next afterwards? can you actually show an example?

hope you (as an accomplished musician) may show the rightdirection, otherwise this new "legato" option is, perhaps, just nonsense (and thus will get thrown to trash bin in no time:))...

please enlight me ;)
thanks && cheers

I have never had the need to use legatos...
But apparently it is a common tool for musicians.

A legato is not polyphonic, but it is melodic.
Ardour has Legato in the midi editor. If he encounters polyphony (different notes starting at the exact same time), he eliminates arbitrary overlapping notes. It is an option but others could be found.
I point out Ardour as an example, but what we're talking about is Qtractor :-).

I think the implementation you propose is correct, but it is missing steps.

The way I see it:

1) I select the melodic line on which to apply legato
2) Qtractor remembers their tonal position.
3) Qtractor transposes them to the same note.
4) Qtractor applies the solution you have already created
5) Qtractor returns notes to their original tonal position.

And so, now we would only have a legato.

rncbc's picture

hi. hopefully fixed in qtractor >= v0.9.36.10git.89c7a5

please test && tell

thanks a lot for the enlightment :)~

It only works ALMOST as I expect with the following configuration.

I say almost because the last note (logically) also modifies its duration, which is not desirable.

My conclusion is that whenever Legato is activated, prior to legato, qtractor must apply a "duration 0 BBT", and restore the original duration of the last note after executing the legato. Or simply never modify the duration of the last note .

File attachments: 

Hi - thanks for both comments.

I hadn't thought about a polyphonic situation, but I don't see that it causes any difficulties. To help illustrate what I had in mind, I attach 2 png files. One shows a possible bar of music with 2 melodic lines, the other a qtractor version of this. In the qtractor version, I have deliberately slightly misplaced some notes, just as they might be if they were input from a keyboard without using quantization.

As regards a true legato, what I would hope to be able to do would be the following:
1) From the lower line, select the first 3 notes (C, D, C).
2) Use the Resize tool (or whatever is eventually decided) and use the default value (100%).
3) Qtractor then changes the timing of the NoteOff event of the first selected note to coincide with NoteOn of the second. It also moves NoteOff of the second note to coincide with NoteOn of the third. The third note itself is unaltered.
4) After deselecting these 3 notes, I would select the B and A from the upper line, and repeat step 2.
5) Qtractor would move NoteOff for the B to coincide with NoteOn for A.

I have deliberately made some of the notes in the lower line overlap. These notes would actually be shortened by the legato operation. In the upper line, which has no overlap, but has a gap between the B and the A, the B would be lengthened.

The same principle could be used for producing a consistent non-legato articulation, where we want a slight gap between notes to mimic the effect of separate bowings on a stringed instrument, or tongued notes on a wind instrument. Here we would need to specify the length of the gap, which should be an absolute amount (expressed either as time or as a proportion of a beat). - it shouldn't be a proportion of the existing note-length, because there is generally no reason why we would want the gap after, say, a 2-beat note to be 4 times as long as the gap after a ½-beat note. This would be bizarre and does not correspond to any normal practice of real instrumentalists. (The only difficulty I can see here is deciding what to do if a user asks for a gap greater than the length of one of the notes!)

In order to combine both the legato and articulation types into basically the same operation, perhaps it should be a separate tool, where we simply specify the gap we want between NoteOff for each note and NoteOn for the next. The default would be 0, producing a true legato. Negative values could be allowable, which would produce an overlap of successive notes - useful occasionally for idiosyncratic midi voices, or for certain styles of keyboard playing or perhaps, even, to give a "Mantovani strings" effect.

The general principle seems straightforward to me. Implementing it, of course, may be much more complicated than I realize, even though the logical steps involved are relatively simple compared to many of the fantastic tools we already have in qtractor ( e.g. tempo ramp).

File attachments: 
rncbc's picture

hi, can you (both of you) show with some pictures of what exactly is wrong with the new (2nd) implementation?

annotated examples of before and after situations would be very welcome, if you have the patience, please?

fyi. a few rules apply to this 2nd implementation:
1. as all other midi tools in qtractor, this so called "legato" transformation applies only to selected note events (as shown in a blue shade);
2. duration is changed so that to fill the gap between the end of one note (a note-off) and the nearest next note in the timeline (a note-on);
3. the percentage parameter applies to the gap being filled therein, so that a 100% parameter value means the new note-off will be coincidental to the next note-on in time;
4. this legato / gap fill is only applied iif the resulting duration is greater or longer than the original; iow. it serves to extend and never to reduce a note's duration--this rule indeed seems to be a good compromise in face to overlapping notes, chords and polyphony in general);
5. the last selected note will never see its duration affected, whatsoever, just because there's no other after it to fill the gap.

eager to ear your thoughts (and see your counter-examples, ofc.)
thanks && cheers

Let's imagine that we start from this point.

Why this strange beginning?

1- I don't know what a legato is, so I want to apply the effect to know what it is.
2- It is my first time using a mouse on a computer.
3- My dear pet Julita is a peacock. She is learning to play the midi saxophone, and I want to help her with recording it.
4- What difference does it make? We want a legaro effect to be applied at all costs :D

If I apply it as is I get this.

Case 1- I still don't know what legato is.
Case 2- I think I'm going to have to continue training in using the mouse, because the tool doesn't change things much.
Case 3- Julita looks at me with a poker face and swears that she is going to switch to ProTools on her MacBook M3
Case 4- :(

If I apply it like this

Everything seems to work correctly, except for the last note. Hence my previous post.

Please, I don't want Julita to spend years whispering: "I told you so."

Ah yes - the final result here is exactly what I would expect to see, apart from the truncated final note. OK, it's a rather bizarre starting point, but the logic of what I was suggesting would produce this result. So the system is almost working as intended.

Let us say that the user selects a number of notes. (Whether or not there are other unselected notes occurring at the same time is irrelevant.)

Let us number these notes from 1 to N, in chronological order of their NoteOn events.

NoteOff for note 1 should be set to occur at the same time as NoteOn for note 2.
NoteOff for note 2 should be set to occur at the same time as NoteOn for note 3.
NoteOff for note (N-1) should be set to occur at the same time as NoteOn for note N.
NoteOff for note N should not be changed.

Similarly for the articulated effect: here, we would need to specify a time interval (either positive or negative), and each note's NoteOff event should be set to occur at that interval before the next note's NoteOn. (Or you might want to reverse the effect of the sign of the time interval, but for me positive for a gap and negative for an overlap seems correct, since the overlap option would be much less used, I imagine, than the gap option.)

rncbc's picture

due to to rule 4. (as in my previous comment) the result is moot (legato2a.png); iow. it does nothing, because ALL notes overlap each other;

when you set duration to 0.0.000 you're actually making ALL notes to have a ZERO duration first and so they won't overlap each other BEFORE the legato effect is applied; so all is working as it's intended and thus gives you the result you end up with (legato3a.png). thanks.

please start with an example where there are no overlapping notes, at least having some just partially and not totally as in your example.


I can't start with that example, because it's just about solving the overlap.

"4. this legato / gap fill is only applied if the resulting duration is greater or longer than the original; iow. it serves to extend and never to reduce a note's duration--this rule indeed seems to be a good compromise in face to overlapping notes, chords and polyphony in general);"

Why do you want to safeguard a polyphonic principle to a monophonic technique?
It is precisely about ensuring that there is no polyphony... otherwise it is not legato.
A legato tool should avoid overlapping notes.

If I am playing a flute (or other monophonic instrument) with a midi keyboard, it is most normal for me to overlap notes while performing. If I want to emulate a monophonic instrument, this is not good, not realistic.
That's why some synths have the legato option built in.

If I want to avoid this while performing, I can use a legato midi plugin on the midi input.
(Interestingly, these types of plugins or option in sinths, do not avoid unconnected notes, because logically if I make two different melodies there will be silence between them, precisely what they avoid is the superposition of notes)

Now, if it is an already recorded document, legato must avoid overlapping notes. This is one of its tasks, not just lengthening notes.

In any case, as it is, it will help me if I ever need it. I would only include the option duration to 0.0.000 without selecting the last note. I would do that last ligation by hand.

Unintuitive? Sure, but better than not having the option. :)

I don't see the necessity for all this complication.

The legato effect (and its close relation, articulation) would only ever be applied to a series of notes selected by the user. In other words, the user is entirely in control of what (s)he considers to be a melodic line. If there are other, unselected notes in the same time-space, this does not matter at all. The user has not selected them, so they will be unaffected.

The required effect is simply described. The selected notes should be regarded as a series, arranged in chronological order of their respective NoteOn events. The existing timing of the corresponding NoteOff events is irrelevant: whether note X's NoteOff comes before or after or at the same time as note (X+1)'s NoteOn event is irrelevant.

What then needs to happen is that the NoteOff event of every selected note except the final one is changed to occur at the same time as the NoteOn event of the next note. None of the NoteOn events should be altered, and neither NoteOn or NoteOff of the final note is changed.

In the case of the articulation effect, the principle is the same, except that here the user specifies a time interval that should occur between each note's NoteOff and the following note's NoteOn. In other words, the final result would be the same as in the legato case, except that all the NoteOff events (apart from the final note) would occur sooner. I suggest, though, that the option of having a "negative gap" (i.e. an overlap) should also be available. Why restrict the user? There might be the odd occasion when this is useful.

I emphasise that the original lengths of the notes, as well as any considerations of pitch and any other unselected notes, are entirely irrelevant to the action required.

I'm not sure that I'm taking the right steps to get the latest version. I just did:

git pull origin develop
cmake -B build .
cmake --build build
cmake --install build

and the version I now have is

Is that what I should be seeing?

If so, the "legato" tool seems to do just what it did last time I tried it. That is, it joins every note to the next note of the same pitch, which is not at all what I would expect, and I can't see why this would be useful. If there are no repeated notes, then the tool does nothing.

rncbc's picture

yes and no is still about the previous, (1st) implementation, as of yesterday...
you should have, as of today;
maybe you changed something in the code? see the .dirty suffix? on those situations the git pull won't work until you either commit, reset or stash the working tree; or scrap that and start anew and complete git clone?

rncbc's picture

hi, everyone

so, to clear things out, let's start with this example baseline that is an extended version of G3N-es's:

and this are the tool settings to apply:

on the current 2nd implementation (v0.9.26.10), which honors the said "polyphonic" rule 4. above, we get the following results:

now, if we drop rule 4., making it a pure "monophonic" and 3rd. implementation, we shall get this results instead:

(the lighter areas represent the baseline, in both cases)

based on your recent comments, I now believe that it is the later "mono" mode what you've been asking for, from the start...

question is:
is it worth to make either of these modes, the later "mono" (no rule 4.) and the former "poly" (rule 4. applies), as an additional tool option?


ps. today's qtractor >= already features this 3rd implementation ;)

I'm trying qtractor 9.36.12 and everything works great. :-)
Being able to include percentages greater than 100% was necessary and now we have it.

I see the poly option as correct. It's complicated to explain why, but I'll try.

In legacy there should be no overlaps, right.
The problem is that a midi instrument is not a real instrument.
On a real instrument, legato means that there is only one attack and several notes. For example the flute, an initial attack of air and then a succession of notes. Guitar, you press once and develop several notes with that impulse.

That's really legato in music.

However in midi, each note has its own attack.

So if we want to emulate a legato, perhaps the best thing to do is with Samplv1 or equivalent, create an instrument with attenuated attack and then layer it slightly while playing.

So yes, for certain cases it is good that this option exists, and furthermore, as it is proposed on UI, it does not hinder either the view or the logic.

In summary. Now yes, and not only that. Now it is a more complete tool.

There is much wisdom in what you say, but I should like to express a slightly different view on a couple of your points.

1) You say that "on a real instrument, legato means that there is only one attack and several notes". If that were universally true, it would be impossible to play legato on a piano, but if you make that suggestion to any even half-competent pianist, you will probably get a punch on the nose. Yet it is undeniable that every note played on a piano has a very distinct attack and decay phase.

I think the idea that all acoustic instruments have a full ADSR cycle on every note probably comes from the early developers of digital sound software being most familiar with instruments like the guitar and the piano, which certainly do have strong attack and decay. Stringed and wind instruments do not necessarily have an attack or decay phase distinct from the sustain part of the curve. As a flautist, I was always at pains to stress to students that tonguing is not a special effect, but merely a device for giving a clean start to a note after a short break. Similarly, when a string player changes the direction of the bow, there will be no decay, although there might be a momentary attack period as the bow gets up to full speed. Of course one can deliberately play an accent or sforzando on a note if one wants to, but it is not an inherent part of the technique or the nature of the instrument.

2) If one is using samples of a real instrument and there is a clear attack and decay phase, then it is possible to create another sample which omits that. In fact, this is effectively what happens when a sample is looped: at a specified point we jump back to a point in the recording after the attack/decay phase. I can quite see that one might want to change the sound source for the 2nd and subsequent notes of a legato passage, but this is easily achieved. Anyway, that is a problem for the user to solve, and it is great that we now can create a legato in qtractor with a minimum of effort!

I have just managed to get v. installed.

And the legato, so far as I can see, now works perfectly! It ignores unselected notes, and doesn't worry about pitches which occur more than once.

Thank you so much for this!

The articulation option (or whatever one might call it) is less satisfactory, because currently the gap produced between successive notes is proportional to the amount of time between the NoteOn events of each pair of notes involved. I can't see that that would ever be useful. What would be much more useful would be the ability to make gaps of a consistent length, regardless of the timing of note beginnings. The gaps need to be defined by the user as a fixed amount of time, either in fractions of a second or of a beat. (The second option is probably better, because if one later changes the tempo, it doesn't seem reasonable to expect qtractor to remember all the places where this tool has been used and then to resize the gaps.) I also suggest that a "negative gap" (i.e. an overlap) should also be an option, although it would perhaps be used only rarely.

This could all perhaps be achieved by having a (gap-) length option with a default of 0.000, rather than the current percentage option with a default of 100.0%.

There is one situation which needs guarding against: clearly the NoteOff event must never occur before the same note's NoteOn. If a user specifies a gap which would produce this result on one or more notes, then I suggest that those notes should be unaltered, but all the remaining notes should have the gap applied. A pop-up warning message might be useful in such a case.

Thanks again for the legato, which I promise I shall be using extensively!

rncbc's picture

hi @DavidJS

yes, i understand that the percentage option is not that musically consistent;

meanwhile in, the percent value may be greater than 100% which might be exactly what you ask as for a "negative" gap; tough it remains inconsistent as you say.

so I thought of yet an additional parameter: what about a post-quantization like a snap-to-beat that is applied after each affected note duration ? it should apply iif the percentage value is not 100%.

this new parameter should present the usual drop-down list of snap-to-beat items: "None", "Beat", "Beat/2", etc.; when "None" is there selected (the default) then all works as is, with no gap quantization applied.

what do you think? does it make any sense?

Wow! What do I think? Well, it doesn't make sense to me --- but we all have different ways of using qtractor, and my way is probably very different from many other people's. I am basically trying to make something that sounds as much like a performance by real instrumentalists as possible, so I rarely use quantization of any sort. Perhaps your proposed quantization might be useful to somebody else.

For me personally, the most useful thing would be to be able to set a fixed time for the gaps, which would remain the same even if the tempo is altered later on. But that is not a practical idea in my opinion: it means that qtractor would have to remember which notes have had the articulation affect applied to them and which haven't, so that it knows which notes should be scaled in length to the new tempo as usual, and which have to be recalculated to preserve the same real-time gap. It seems to make things unnecessarily complicated from the programming point of view.

So for me, the best compromise would be a gap expressed as a proportion of a beat.

And yes, if I change the tempo by any great amount, I accept that it's probably going to mess up my "articulated" effect, but I also accept that it's my own fault for not sorting my tempi out before doing subtle things like messing around with articulation!


rncbc's picture

well, it's done. new legato gap quantize is now up in qtractor >=

re. tempo changes : I wouldn't worry much about that :) qtractor midi representation let's you make tempo or time-signature changes anytime and should rescale all timings accordingly...

please try it out

I have now had a chance to try out v., and the quantization seems to work as I expected. But, with respect, I don't see why this might be useful.

Suppose I have a phrase of music which consists of a semibreve (whole note) and then a number of quavers (eighth notes). I want it to sound articulated, as it would be if played by a wind or bowed string instrument when there is no slur marked in the score. I therefore need a gap of, perhaps, 1/8 of a crotchet beat between each pair of notes. This gap is 1/4 of the length of the short notes, but only 1/32 of the long one. If I set the gap to 75% then the gaps after the short notes will be just as I want them to be, but I shall get a gap lasting a whole beat after the opening note, which is not at all what I want. Quantization of the time interval doesn't address this, so far as I can see.

So I still think that specifying the gap as a proportion of a beat (not a proportion of the time-spacing of the respective notes) would be more useful. Of course, I don't always understand what other people find useful so I suppose that I may be suggesting something that nobody else would ever use.

Meanwhile in my main project, I have tried using the new system for a passage which consists entirely of quavers in the cello part. The tool is brilliant: I used it 2 or 3 times before I found the right length for the gaps to sound natural. Unfortunately, as things are, I can't easily use the system for passages which don't have notes spaced at equal time intervals.

rncbc's picture

hi David,

you might have a point, and I would really appreciate your advice on this whole mess :)

so what do you suggest? what do you think is the correct approach?
currently the percentage is applied to the filler gap; I do now reckon it's not the best, you tell me.

let's think about this for a moment: you agree that, for the 100% setting, all works as originally intended, right?

however, with this variable percentage and quantization crap we're just simply making it a little more flexible, and like, as you say, more articulated...

should we drop it altogether?

eager to know your stance

Well, firstly let me apologize for causing you a lot of problems! My original suggestion was for a legato tool, and we now have this working just as I had hoped. Thank you again for that.

The articulation idea was secondary to the legato, but to me it seems to follow naturally from it. As an alternative to making the end of note X coincide with the start of note (X+1), we can make it end just before it, the gap being specified by the user. Like the legato, this was just an idea to help weird people like me who are trying to replicate as far as possible some of the characteristics of acoustic instruments. Strings and wind instruments, when they are not playing slurred passages, naturally produce a slight gap between notes. The size of these gaps is not fixed and is under the control of the player, but it is likely to be consistent within a phrase. The length of each gap would definitely not, as a rule, vary according to the length of the preceding note.

Hence I think that the user should be specifying an actual duration for the gaps.

If you really felt it was practical, I would say "yes, let's have the user express the gap-size as 0.15 seconds or whatever", but you would then have to complicate the operation of qtractor by getting it to remember which notes have had this tool applied and then recalculate where the end of each note should come if the user alters the tempo of a passage.

That is why I suggested that the more practical step was to have the duration expressed as, say, 0.12 midi beats rather than an actual time. OK, if I apply the tool and then decide to change the tempo, the gaps will change size in actual time, but that's really not a big problem. Nobody in their right mind would start tweaking articulation etc. if (s)he was intending to change the tempo of the passage hugely. And with small changes to the tempo, we probably wouldn't notice the difference: would I notice the difference between, say, a 0.15 second gap between notes and 0,.17 seconds? I very much doubt it.

A thought comes to me: perhaps a good compromise would be to express the gap-size in seconds and accept the fact that if the tempo changes the gaps will change. I would be very happy with that, but you might get some other pain-in-the-arse like me complaining about it in the future!

I do think that the legato and the articulation can be all part of the same tool. I suggest that the selection box should contain a number representing the length of the gap, with a default of 0 representing legato.

In the interest of maximum usability, I also suggest that as well as a gap between notes we can as an alternative produce an overlap, although I think that this is less useful. It would be achieved by allowing the gap to be either positive or negative.

The only thing I don't have a strong opinion about is whether positive values should represent a gap and negative an overlap, or vice versa.

rncbc's picture

I understand it's not quite the same, but you can certainly achieve the same with the current implementation: just set the percentage to:

a. less than 100% - will make it as in your "positive gap";
b. equal to 100% - there will be no gap, nor overlap, as in a precise "pure legato" (my wording:);
c. greater than 100% - extend as of your "negative gap" (or overlap, if you prefer); for same pitch note events it's the same as b. (100% pure-legato);

for a. and b. you have the additional option to quantize the resulting duration to a snap-to-beat value (as long it's not set to "None"),



Add new comment