Whether this question really belongs here or in some other part of StackExchange, I do not know. If the general public or the admins would like to see it moved elsewhere, I'd of course be happy to comply.

My question concerns manually editing a midi file (generated by a piece of notation software) in such a way that the playback mimics a live human performance more closely than without editing. I realize that this is a horribly inefficient way of doing things, and that playing the piece myself on my midi keyboard would be much easier. But supposing that one really wanted to do it the difficult way, by editing the numerical values of all the midi parameters of all the notes one by one, what would be the smartest way to go about it? To get started: I don't find the results of the various randomization/humanization algorithms very convincing, not on their own at any rate.

Any tips or tricks will be warmly appreciated.

Many thanks for your comments or answers!

  • 2
    It depends greatly on the instrument and playing style you're trying to reproduce. For example, when trying to humanize drums, you have to create a left-right hand alternation on fills, but single kick pedal work has a different feel based on heel position, etc. Basically, if you know how to play the instrument, you know a lot about how to humanize it. If you don't, then you've got a huge uphill journey ahead of you. – Todd Wilcox Oct 17 '15 at 5:02
  • 1
    Well worded question. IMO the problem with all those “humanisation algorithms” is that their premise is completely flawed: human performance is not just an inaccurate rendering of the exactly quantised timing and intonation that a midi sequencer would normally output. I like to view it the other way around: a fixed time raster and a fixed 12-edo pitch grid are just inaccurate approximations of how a good human performance works. – leftaroundabout Oct 17 '15 at 13:38

I'm not sure this actually answers the question itself, but may provide some perspective as to what is involved in humanisation.

The 'trouble' with humanisation, is often the sum of the individual humans making up the final groove - even if it was all actually the same human - in itself varies over time.

The inaccuracies contribute to the eventual feel of the entire piece, though the push-pull between accuracy & 'groove' can change over the piece itself, getting tighter as the performance progresses.

The perfect illustrative example, to my mind, is Stevie Wonder's 'Superstition'

Bear in mind that the instrumentation is just drums, syn-bass, 2 clavinet tracks [all played by Stevie] & 2 brass tracks.
The drums were laid down first, as was his usual working method. I don't know in what order the others were recorded, but you can be pretty certain the brass was last.

Taken as a whole, it has got to rate amongst one of the best groove tracks of all time (I'm sure that bit of opinion would be allowable on SE ;-) yet if you actually analyse what each instrument is doing, it's all a bit of a mess.

For the entire first verse, nothing seems particularly in sync - yes, it's a great riff, but the clavis wander in & out from each other, the drums push & pull a bit, yet not at the same time as the clavis. By the time the brass comes in, they sound like they agreed that "the last one to finish buys the beers", so they're trying to get to the end as quickly as possible.

The brass continues in that vein for the length of the track - but in actual fact, that apparent rushing really ties the groove together & drives it very hard.

The second verse does pretty much the same as the first, yet a little tighter - also your ear starts to get more forgiving to the individual components as your 'heart' really begins to grasp that what is actually happening is really something a bit special.

By the time you've got through the middle 8, you are fully hooked, & even though the clavis are tightening to the drums, the drums themselves are still a bit wandery on occasion, some of the fills leave a bit to be desired... & the brass is still in that race to the finish...

... but by then you no longer care!
The track wins, your analytical brain loses & you are caught up in the moment.

  • 1
    Thrilling description. Reminds me of a string quartet recording I heard once on the radio. In any other performance, their intonation would have made me squirm, but they made everything so exciting, I didn't care! – aparente001 Oct 18 '15 at 1:45

If you want the best reward for least effort, I would start with the tempo track. Figure out how the music should be "phrased" at the level of individual beats in the bar, or even subdivisions of beats. Often the same rhythmic feel or groove will apply to many similar phrases, once you have found it. Changing the tempo by around 5% on individual beats often doesn't hit you between the ears, but it does break the inhuman accuracy.

Sometimes, "stretching" one note to twice its nominal length still sounds like it's being played "in time". Other times, a tiny change sticks out like a sore thumb. Human perception doesn't match up with scientific measuring instruments!

To my ears at least, you have a repeated rhythm like 3 quarter-notes followed by 2 eighths, the rhythm only sounds "in time" when the eighth notes are in a slightly faster tempo than the quarters. Your ears and your style of music may differ, of course, and you won't necessarily want it to sound "exactly in time".

Adding randomized computer-generated "humanization" (done by nudging the start and end of notes relative to the beats) on top of that sort of rhythmic tweaking seems to work better than adding it to a mathematically precise rhythm.

I suspect human players unconsciously work this way, as well. I once heard a choral conductor remark that if you took 30 good singers who had never worked together to form a choir, you started off with 30 different ideas about what was "in time," and you just had to wait till they had listened to each other for long enough to arrive at some sort of compromise between themselves. Only after they reached that point could you start directing the performance, instead of just beating time.


Chief issue with simple programmed and then "humanized"/randomized parts isn't the nature of the variations per se but the fact that the parts don't build their variance off of each other, nor do do previous errors affect downstream timing. Still better than a straight beat but you have to stick to very small amounts or it gets very noticable.

Have you tried applying a common swing/groove in tandem with the randomizer? Using just a few slightly tweaked versions of the same groove, and adjusting both how much it rubs off on each part (both timing and velocity) together with the amount of random variance should get you quite far. For the specific question "editing the numerical values of all the midi parameters of all the notes one by one, what would be the smartest way to go about it?" this is definitely the answer, since it lets you edit the timing of your parts without tweaking every single note individually.

There are some very cool options for taking things further though, by far the best tool I'm aware of is James Holden's "Group Humanizer" set of Max for Live devices. It's based off of a paper, Synchronization in human musical rhythms and mutually interacting complex systems, that basically gives the same answers you've gotten but with lots of science.

We showed that rhythmic synchronization between individuals (both musicians and laypeople) exhibits long-term memory of the partner’s interbeat intervals up to several minutes for which an explanation is suggested in a physiologically motivated stochastic model for MICS. The MICS model suggests that scale-free coupling of the two subjects emerges mainly through the adaptation to deviations between their beats.

Basically the device lets one part be the master, and up to 10 slaves follow. It's made for live use but can obviously be used for this kind of stuff in any number of different ways. Quote from Holden:

Now using the model proposed in Holger Hennig’s research I’ve developed a set of Max for Live devices which are able to inject a realistic timing into multiple computer generated parts, as if they were being played by musicians performing together. It can even listen to input from a real musician (for example, the jazz drummer who plays together with me in my live shows) and respond to his or her timing errors in a natural manner.

Here is an article discussing of the topic, links to the device and a video showing it in action. A somewhat questionable piece of music in my opinion but definitely shows what an incredible tool this is. You can even set it to push and pull Ableton's master tempo with the drift.

For people not keen on Ableton I guess the patches could be adapted for standalone Max/MSP use, don't know if that has been done though.


Add imperfection, variance. Think of which dynamics are being implemented too perfectly and mess with them. The two most important are time and amplitude, but you can also mess with timbre and any other stuff your system can handle.

Start with the time. Set some notes to start a little earlier or a little later than they should. Judge by ear. For a more tight feeling you can leave the beats unchanged and mess with the upbeats and other notes that don't fall in a beat. Do the same with the length of the notes.

You can extract the timing of one performance and apply it to another one using tools like Ableton Live, so you can try that too.

Now play with the volume of each note. All the notes having the same velocity doesn't sound human, so give them some randomization within a range (depending on the dynamic you are going for).

And so on. Same applies for any dynamic you can put your hands on. Variance, some randomness but within a range (perhaps the range is the skill of our emulated performer). For example, when doing this on percussions applying variance to the timber is very effective because they'll sound different depending where you hit the percussion, and not even the most skilled percussionist in the world hits the exact same spot every time.

I realize that this is a horribly inefficient way of doing things, and that playing the piece myself on my midi keyboard would be much easier. But supposing that one really wanted to do it the difficult way, by editing the numerical values of all the midi parameters of all the notes one by one, what would be the smartest way to go about it? To get started: I don't find the results of the various randomization/humanization algorithms very convincing, not on their own at any rate.

Those algorithms are implementing the variance I'm referring to. They do what I suggested, but automatically. Maybe you are not tuning them and/or understanding them correctly. Maybe you are expecting too much from them, the mechanics and acoustics involved in a human musical performance are very complex, and it's still (at least to my knowledge) not possible to 100% accurately emulate a human player.

  • Many thanks for your quick yet thorough reply! To be clear, my aim is not to emulate a human player with 100% accuracy (which is, as you say, impossible), but rather to make my piece a bit more life-like. – Kim Fierens Oct 17 '15 at 1:16
  • 1
    @KimFierens I carved this answer with that in mind. The 100% part was to dive more into the subject, not to imply that you are looking for a perfect emulation. – user1079425 Oct 17 '15 at 1:32
  • Nor did I imply that you were implying it. :-) Two little follow-up questions, if you don't object: do you have any general advice (liable to many exceptions of course) as to how one should distribute dynamics within a phrase? Same with (change of) tempo. My piece is lyrical and romantic, by the way, so I need lots of expression. – Kim Fierens Oct 17 '15 at 2:22
  • 1
    It depends. Different approaches give different results. You can distribute everything randomly, or you can design very specific values for every note individually as if you were designing the performance (which you are). Also, you are not changing tempo, you are changing the position of the notes in time. It's an important distinction. – user1079425 Oct 17 '15 at 2:43
  • One tiny trick is that if there is a note you want to have emphasis, in addition to upping the volume a bit, you can lengthen it slightly. – aparente001 Oct 18 '15 at 1:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.