FR to help avoid race conditions

Since several people are confused about the examples in my original post, let’s try a more practical example with only one voice for which turning on IRV won’t help:

Playback

To eliminate one variable, let’s assume that Humanize the start positions of notes is set to zero percent. By default, every note under the slur except the last has a played duration equal to 105% of its written duration. Without special logic to detect overlapping notes with the same pitch, any MIDI application playing back this example would end the fourth note after only five percent of its written duration. Presumably with situations like this in mind, Dorico includes this logic and shortens the third note so it ends just before the fourth note begins.

Now let’s delete the slur and set the played duration of default notes to 100% of their written durations. Now the notes don’t overlap but the third note ends at the same time as the fourth note begins, causing a race condition.

Can you give an example of a problem caused by this situation?

I mentioned the setting for triggering the expressions for the next note early, as I suspect it was to ameliorate this sort of thing. I could be wrong, of course.

Screenshot

If you follow the link I gave in the third post of this topic, you will find an example of a problem caused by this situation.

The setting you mentioned determines how many ticks before a note begins a keyswitch will occur, typically to cause a change of playing technique such as going from arco to pizzicato.

mmmm i would say you can’t play the same note both at the same time with a single intrument. so in musical notation it means you use at least two instruments to get this overlap. i don’t know Dorico but is it possible to program two different intruments (or group of instruments) on the same stave ? because this what means your example

I can’t reproduce the problem in that thread. I’m not using Noteperformer, so could it be dependent on the Ex Map or VST?

When two notes have the same pitch and the first note ends at the same time as the second one begins, there is always a chance (albeit a very slight chance) that the MIDI note on event for the second note will be processed before the MIDI note off event for the first note, causing the second note to be clipped so short as to be practically inaudible.

Try using the HSO Trumpet in Bb at the stated tempo of q=92. The problem is not dependent as much on the expression map or VST as it is on the tempo.

Could you attach a short project in which this occurs? I believe the way that the overlap detection in Dorico works is intended to prevent this from happening, so it’s possible that there is a bug in the logic somewhere.

If you follow the link I gave in the third post of this topic, you will find a short project in which the problem occurs.

Here is another example of race conditions causing clipped notes, using the HSO Oboe to play the melody. In working with my virtual choir, I set Humanize the start positions of notes in Playback Options>Timing to zero percent. I also set the played durations of default notes to 100% of their written durations so that they will be as long as possible without overlapping. Then I enter the notes, setting the playback end offsets of notes at the ends of phrases and at punctuation within phrases to create the pauses that would occur in a performance by a real choir.

Hymn.dorico (704.1 KB)

Forgive my ignorance please, but what the heck is meant by the words ‘race condition’? I’ve never encountered the term before.

1 Like

According to Wikipedia:

A race condition or race hazard is the condition of an electronics, software, or other system where the system’s substantive behavior is dependent on the sequence or timing of other uncontrollable events. It becomes a bug when one or more of the possible behaviors is undesirable.

Yes, I read that definition in Wikipedia too, before I posted. But I’m having a hard time getting my head around how that definition applies to the situation in your original post. Perhaps you could explain what YOU mean by it?

1 Like

Speaking as a lay-idiot…The original question arose here where there were unexplained playback effects. @johnkprice kindly provided a technical answer and has since delved more deeply into it. His conclusion appears to expose a possible problem with how Dorico converts its internal representation of notes to midi and can lead to incorrect playback.

Yes, more English, less computer jargon. In John’s original example, I had difficulty deducing exactly what he wanted to happen of the various alternates he showed.

When two notes have the same pitch and the first note ends at the same time as the second one begins, there will be two MIDI events that are supposed to happen at the same time: a note off event for the first note, and a note on event for the second note. It becomes a race to see which of these events will be processed first. If the note off event is processed first, there is no problem. But if the note on event is processed first, then the second note starts and immediately ends along with the first note because they have the same pitch.

In the first post of this topic, I wrote:

I thought that made it clear that I liked what Dorico was doing and wanted it to do the same thing in a different but similar situation.

Thanks for this, I can reproduce the problem here. I suspect Dorico is not considering that this problem can occur if the notes are set to play back at exactly 100% of the notated duration - if it is either 99% or 101% then the problem doesn’t occur. I’ll log it for one of the developers to look at.

1 Like

Thank you very much! :slightly_smiling_face:

I would like to belatedly thank the Dorico team for adding the feature in Dorico 4.1 that if I set the played duration of default notes to 100% of their written duration, an option appears which allows me to shorten every note which is followed by an abutting note of the same pitch by one tick. While this doesn’t eliminate every race condition I have encountered, it does help me when using Dorico as the host application for my virtual choir.