Skip to main content

MIDI Forum

Removing very short...
 
Notifications
Clear all

Removing very short notes

5 Posts
3 Users
2 Reactions
33 Views
Jason
Posts: 452
Honorable Member
Topic starter
 

The SNES MIDI Remaster Project is the gift that just keeps on giving. 

The current soundtrack I am working on, all of the percussion had tons of very short phantom notes. I've already manually deleted them all (I think) in Sekaiju.

This issue is bound to crop up again, so I am looking for a way to automatically remove all super short notes. I actually may need to for some of the instrumental stuff for this soundtrack also, I just haven't had a chance to check yet.

Anything that runs on Windows would work. I regularly use Anvil Studio, Sekaiju, and Cakewalk, though I try to do anything with Cakewalk all in one go, because it tends to mess other things up when used in too many spots during the project process. 

 
Posted : 15/04/2025 12:22 pm
Bavi_H
Posts: 274
Reputable Member
 

Cakewalk - Select By Filter

In Cakewalk, you can use a process like this to remove short notes.

1. Select All. (Go to the Edit menu, the Select sub-menu, and choose the command "All".)

2. Go to the Edit menu, the Select sub-menu, and choose the command "By Filter".

3. In the Event Filter dialog box, to make sure you create the correct type of filter, do the following:

...1. Click the All button to check everything and change all the ranges to the maximum. This will reset any ranges left over from the last time this dialog box was used.

...2. Click the None button to uncheck everything. The ranges will still be the maximum, but everything is unchecked now.

...3. Check the Note box and change the Duration Max number to some small number of ticks that will get all the small notes you want to remove.

...4. Optional: If you only want to remove notes on Channel 10, you can change the Channel Min and Max numbers to 10.

...5. Optional: You can save the desired filter settings for future use by entering a name in the drop down box at the top and clicking the Save button (the disk icon). (You can re-load the saved filter settings in the future by selecting the corresponding name from the drop down box.)

...6. Click OK. Cakewalk will select the notes that have a duration in the range you specified.

4. Go to the Edit menu and choose the Delete command.

Cakewalk - Deglitch

Here's another process you can use in Cakewalk.

1. Select All. (Go to the Edit menu, the Select sub-menu, and choose the command "All".)

2. Go to the Process menu and choose the command "Deglitch".

3. Check the box for "Duration", enter a numeric value to remove "Notes shorter than" and select either "Ticks" or "Milliseconds". (In other words, enter the minimum value you want to keep, everything shorter than the value you enter it will be removed.) Then click OK.

Errata note: It looks like the tick amounts in the Deglitch dialog box are always based on a resolution of 960 ticks per quarter note, even if the MIDI file is using another resolution.

Sekaiju - Get short notes to zero ticks

If the notes you want to remove are 0 ticks in duration, all you have to do is open the file in Sekaiju and re-save it. When you save, Sekaiju will ask if you want to delete notes that have a duration below zero. (It really means notes that have a duration less than or equal to zero.) Click Yes.

If the notes you want to remove are 1 tick in duration, you can try the following process in Sekaiju:

1. Change the ticks per quarter note resolution to half of its current value. (Go to the File menu and choose the Property command. In the Resolution box, type in a "Ticks / Quarter Note" amount that is half of its current value. Click OK.) When Sekaiju changes the resolution, any note that was 1 tick in duration will get changed to 0 ticks in duration.

2. Optional: Change the ticks per quarter note resolution back to its original value. (The 0 tick notes will remain 0 ticks. The other notes will be restored to the original duration if the original duration was an even number of ticks, or restored to 1 tick less than the original duration if the original duration was an odd number of ticks.)

3. Save the file. Sekaiju will ask if you want to delete notes that have a duration below zero. (It really means notes that are less than or equal to zero.) Click Yes.

If the notes you want to remove are more than 1 tick in duration, you can try modifying the process to change the resolution to a small enough value so the short notes get changed to 0 ticks and can be deleted when saving. However, you will also be decreasing the resolution of every other event's timing and duration, so you will probably want test if the needed resolution change causes any unacceptable changes in everything else that is kept.

Alternative - Make the short percussion notes longer

Be aware that MIDI synthesizers usually do not care about the duration of most* percussion notes, that is, percussion sounds will play for their entire sample length no matter what the duration of the MIDI note is. A program that generates MIDI files may generate percussion notes with very short identical durations because it is assuming the playback synthesizer will not care about the MIDI note duration.

You might decide you want to keep the short percussion notes, but make them longer so they're easier to see and work with. If you lengthen the short percussion notes, especially before doing various editing processes, it might help prevent problems with short notes you can't see very well getting unintentionally copied or moved and causing your MIDI file to end up with various unwanted short percussion notes strewn about.

In Cakewalk, you can Select All, then go to the Process menu and select the command "Find/Change". This will show the Filter dialog box two times. The first time is for selecting the events you want to find, the second time is for specifying how the found events should be changed. You can use this to, for example, find all notes that have a duration range from 0 to 1 ticks, then change them to a duration range from 0 to some larger number ticks, such as an eighth note or sixteenth note.

If the short notes are not all the same duration, you might use two passes. On the first pass, find all the notes with a duration range from 0 to x ticks (the range of small notes you want to modify) and change them a duration range from 1 to 1 ticks. Then on the second pass, find all notes with a duration range from 1 to 1 ticks and change them to a duration range from y to y ticks, where y is some larger number of ticks.

In Sekaiju, there's not a way to select notes based on their duration. But you could select all notes in a percussion track and set them to the same duration, such as an eighth note or sixteenth note, something small but visible. Select everything on the percussion track. Go to the Edit menu and choose the command "Modify Event's Duration". Choose "Absolute Ticks" and type in a number of ticks that will be large enough to be visible.

Percussion note duration that matters

* Be aware there are sometimes a few precussion notes where the duration does matter. For example:

In the General MIDI System Level 1 Developer Guidelines, it describes that long whistle (72) and long guiro (74) should respond to Note Off messages (see PDF page 19, printed page 15).

In the General MIDI 2 specification, it describes the orchestra set "applause" note (88) and most of the notes of the sfx set (notes 47 to 84) are required to respond to Note Off messages (see PDF page 8, printed page 4).

In the manual for my Yamaha PSR-225, the drum kit list at the back of the manual indicates the following percussion notes "stop sounding the instant they are released": brush swirl (26); brush swirl with attack, or in some kits, reverse cymbal (28); snare roll (29); samba whistle high (71); samba whistle low (72); guiro long (74).

If you look at manuals for Roland Sound Canvas devices such as the SC-55, SC-55mkII, or the SC-88 Pro, the drum kit lists do not have a similar note that some percussion notes behave differently with Note Off messages. However, if you look at the "MIDI Implementation" section, in the section describing a Note Off message, it mentions there is a (system exclusive) parameter for drum parts called "Rx. NOTE OFF" that controls if (each specific note number in) a drum part will ignore or respond to a Note Off message. In the "Parameter Address Map", there's a section for "Drum Setup Parameter" that shows "Rx. NOTE OFF" is at parameter address "41 m7 rr", where m indicates a drum map number and rr indicates a drum note number. The manuals don't indicate what the default values are, so I don't know if the default is all percussion notes ignore Note Off, all percussion notes respond to Note Off, or something similar to the GM1 guidelines where only a few notes respond to Note Off. I might want to find a Roland SC-55 emulator and try sending System Exclusive data requests to get it to reply with the default settings for every percussion note.

 
Posted : 16/04/2025 3:49 am
Jason reacted
Bavi_H
Posts: 274
Reputable Member
 

Since there's no way to edit or delete your messages here, here's a slight update to my previous post. I realized the process for making short notes longer in Cakewalk doesn't need two alternatives nor two passes. Imagine the previous post is updated with the following:

Alternative - Make the short percussion notes longer

[...]

In Cakewalk, you can Select All, then go to the Process menu and select the command "Find/Change". This will show the Filter dialog box two times. The first time is for selecting the events you want to find, the second time is for specifying how the found events should be changed. You can use this to, for example, find all the notes with a duration range from 0 to x ticks (the range of small notes you want to modify) and change them a duration range from y to y ticks, where y is some larger number of ticks, such as an eighth note or sixteenth note.

In Sekaiju, [...]

 
Posted : 16/04/2025 4:28 am
Jason
Posts: 452
Honorable Member
Topic starter
 

It's always going to be Cakewalk for stuff like this 😮‍💨 I wish it wasn't so glitchy.

 

I like the Sekaiju idea, but my files are already fairly low resolution so I don't think it would work without causing issues. By default, I believe most/all of my files are 240 TPQN.

 

I'll have to do mental math to compensate for Cakewalk's nonsense if/when I decide to do it.

All of my software synths respond to note off for everything on all channels 👍

 

For a slightly more detailed breakdown of the problem:

Each instrument in the original SNES spc music file is an audio sample with a specific hex address. spc2midi allows you to assign GM instruments for each address, as well as enable or disable its playback and dynamics.

In order for me to get usable percussion, I have to export each percussion address as grand piano individually, with all other addresses disabled. It is migrated over to an actual percussion channel later on in Anvil Studio.

With this particular soundtrack, the transition from one percussion to the next is carrying over randomly as off-note glitches.  So say I have a cymbal and a snare rapidly alternating.  In the exported snare file, there are tiny bits of cymbal left over. Similarly, in the cymbal file, there are tiny bits of snare left over. But those tiny bits play back as the sounds they are not. Then when I further process the files and add in pitch bend and such, you start hearing all sorts of weird audio glitches, because those extra bits just shouldn't be there. 

 

I was able to manually remove them in Sekaiju this time around by simply highlighting all of the tiny notes and deleting them, since they don't match the note number of the real notes. This soundtrack does very little pitch manipulation on the percussion. Other soundtracks I've done have percussion playing all sorts of different notes, so the glitches would most likely be all mixed in and impossible to just highlight and delete in a few seconds. 

I still may have to do something for non- percussion in this particular soundtrack, as I've noticed a few weird pitches here and there on normal instruments.  If so I can try stuff when I get a little further along. 

 
Posted : 16/04/2025 8:13 am
Jason
Posts: 452
Honorable Member
Topic starter
 

Good news for now at least.  I ran a few tests, and the deglitch option in Cakewalk shows the length value of the shortest note in my files.  If I set the removal value to 1 higher than that, it seems to be clearing out all of the errant mini-notes.  It says the shortest value is 4.  So I do 5, good to go.  Seems to be the same whether it's in ms or ticks.  Then the next shortest note after that was 52 in one file, and 112 in another, so I think it'll work fine for my needs.

Sadly, I still have to clear the percussion glitches manually, because I need to do a lot of stuff prior to bringing it in to Cakewalk.  But on the plus side, I was examining one of the merged files last night, and there are also glitches in normal instrument tracks, so it will clear those up for me.

 
Posted : 19/04/2025 11:48 am
Bavi_H reacted
Share: