fbpx
Skip to main content

MIDI Forum

Note On and Note Of...
 
Notifications
Clear all

Note On and Note Off with delta 0

9 Posts
3 Users
0 Reactions
4,324 Views
Carlos
Posts: 86
Estimable Member
Topic starter
 

Hello, I have found in a file that they send a note off after a note on with a delta of 0 (for the same channel and same note). Is this useful for instruments? Because I have seen that percussion is useful.
Is 2 notes in a row intentional? I have noticed that this causes a sustain.

Thanks

 
Posted : 10/02/2023 6:15 pm
Clemens Ladisch
Posts: 323
Reputable Member
 

The resulting sound depends on the synthesizer. Was this file written for a specific one?

What exactly do you mean with "2 notes in a row"? Some synthesizers have certain instruments that use this to enable legato, even without controller 68.

 
Posted : 11/02/2023 1:20 am
Carlos
Posts: 86
Estimable Member
Topic starter
 

[quotePost id=17588]What exactly do you mean with "2 notes in a row"?[/quotePost]

Two Notes On with delta time of 0, sorry for my english, (google translator) :p
[code type=markup]Exaple 1
delta 0 - Note On id=57 velocity=64
delta 0 - Note On id=57 velocity=64 ->sustained? (at least timidity)
delta 480 - Note Off id=57 velocity=0

Exaple 2
delta 0 - Note On id=57 velocity=64 ->useless?
delta 0 - Note Off id=57 velocity=0 ->useless?
delta 0 - Note On id=57 velocity=64
delta 480 - Note Off id=57 velocity=0[/code]

I don't know what they were made for, they're just midi files I downloaded from the internet, I'm programming a midi player and I wanted to see if I could get rid of some unnecessary events.

 
Posted : 11/02/2023 8:27 am
Clemens Ladisch
Posts: 323
Reputable Member
 

What happens with two identical note-ons is not defined by the MIDI specification. (The SMF specification requires that every note-on has a note-off; example 1 would be invalid.)

A note with a length of zero might or might not result in a useful sound.

If your player does not know better, the only choice is to pass the events through. (The files are likely to be erroneous, but there is no reliable way to improve them.)

 
Posted : 12/02/2023 2:32 am
Carlos
Posts: 86
Estimable Member
Topic starter
 

Thank you

 
Posted : 12/02/2023 8:50 am
Geoff
Posts: 1040
Noble Member
 

Just to add to this.

Delta=0 within a midi file (i.e. NOT at the start) would mean that no time has elapsed since the previous event. BUT, the previous event MIGHT be relevant, so you should show it to validate the data overall.

I would expect in Example 1 that the two Note On events, both at the same delta time, would in effect be one Note On, but this would depend on the instrument playing the sound which COULD cause the second ON to modify the first ON. But this is unlikely. Then, the Note OFF 480 ticks later SHOULD turn OFF the note that is ON but then it MIGHT turn OFF One of the Notes and leave the other ON. On the basis of the Midi spec it should NOT do this, but a specific device MIGHT do this.

Midi events like this should be avoided as this could cause problems. It is CERTAINLY confusing, both for us humans, and maybe for certain midi devices.

Regarding Example 2. the ON immed followed by the OFF Might or might NOT make any sound at all, depending on the midi device receiving the data, and depending on the envelope of the sound being used. The later on, then delta time then OFF would appear perfectly normal.

Many systems that enable the playing of data from a midi file would have an option to display the data as an Event List, such a display would often include the option to modify and/or delete specific events. This would allow you to remove such events if they are not needed, and then save the changed midi file.

I would be interested to see this midi file. Could you attach it (you need to 'zip' it first). Or at least give the name of the file, and the site you got it from. It would be interesting to see what other oddities there are in the file. The file you downloaded could well be a badly edited/modified version of a previously OK file?

Geoff

 
Posted : 12/02/2023 1:59 pm
Carlos
Posts: 86
Estimable Member
Topic starter
 

So far I only ignore them for display on the screen, but I send them to the tuner anyway.

Here I upload 5 midi files

1.- 3 note example 2, in addition, have the percussion notes with length 0
2.- 11 note example 2
3.- 14 note example 1
4.- 1 note example 1 and 28 note example 2
5.- 1 note example 1 and 1 note example 2

 
Posted : 13/02/2023 11:24 am
Geoff
Posts: 1040
Noble Member
 

Hello Carlos,

I've got the files. They're fairly large, containing a lot of data. Multiple tracks/channels.

The files may be intended for a Karaoke machine. I don't know how much they may have been edited to optimise them for such, but maybe a fair bit.

I've fully tried 1 only so far, file 1.

I tried it through my VST setup (SynthFont player, using the 'Timbres of Heaven' virtual synth sounds). Sounded perfectly fine. If there were some technical midi oddities, I didn't spot them.

If you're working on a midi file for Karaoke, as opposed to normal music playback, what would you be focusing on? ARE there aspects that you would handle differently? The music I'd guess needs to be familiar, and clear enough so that people can sing along to it, and not be worried that it's going to do something strange. Also, I'd assume that people are going to be concentrating on singing along, and NOT worrying about any (barely audible) imperfections on the backing music.

I'd say - don't worry about it. Unless there's something there that DOES interfere with anyone singing along, leave it along.

Geoff

 
Posted : 13/02/2023 1:09 pm
Geoff
Posts: 1040
Noble Member
 

I played file 2 as well, also sounds OK. But, I noticed there seemed to be much more percussion.

So I checked File 1 again, and yes, there was only occasional percussion heard. I checked the Event List, and saw that there was a LOT more percussion in the data, but most was showing a very short duration. Some 0 (zero) even, but most were less than 5 ticks, and the software was giving a warning for 'Less than 5'. So, if the duration of the note is so small, then the envelope of the sound never gets chance to take effect, and nothing is heard, but maybe some instruments that have a VERY sharp attack might just be heard.

But even percussion does not always have a totally vertical attack, i.e. zero volume to maximum volume within a tick or two.

Of course, this is not a 'problem' as suck, it's merely as if the percussion has been muted. Maybe that's what you want. If there's too much it might confuse those singing along?

Geoff

 
Posted : 13/02/2023 1:54 pm
Share: