I have a midi file that ends with some notes that need time for the reverb and chorus to trail off. I had to edit the file with Cakewalk, and when I save it after cutting off some of the excessive silence I inadvertently created the file with (had about 10 seconds of silence, only wanted 2) it makes the end of the song happen exactly a the end of the last note off, so the resulting sound is an abrupt cut.
I tried adding silence to the end in Cakewalk, but no matter what I do or what options I change, it has no effect.
I tried manually adding 2 seconds to the end of track events for the four longest tracks in Sekaiju, same thing with no effect.
How can I successfully add 2 seconds of silence to the end of the file? Are there other events that I need to modify as well? Or another editor that can just tack them on super easy?
Adding that reopening the "extended" file in Sekaiju still maintains the track ends where I put them, but every playback software I have tested cuts it at the end of the last note off regardless.
Try to add some non-sounding MIDI message after 2 seconds of silence, like an extra Note-Off, or an RPM or a SysEx.
Like Sema said, the workaround I suggest is to put some non-sounding channel event at the position you want to be the end. Something like a Pitch Bend with the center value.
_____
Previous tests from my 2019 post Re: How to determine the length of a Standard Midi File:
I noticed the same thing in some MIDI players I use: playback ends after the last note (or other non-meta MIDI event). Although I feel it's technically correct to play until the End of Track event is reached in all tracks, there are some MIDI players that end playback after the last non-meta MIDI event is completed.
Plays until End of Track is reached in all tracks: Sekaiju, VLC Media Player.
Plays until last non-meta MIDI event is completed: Windows Media Player, Notation Player, Cakewalk by BandLab.
Updated tests:
Plays to last End of Track:
Sekaiju 7.8
MIDITrail 1.4.0 (64bit)
VLC Media Player 3.0.16
Plays to last channel event (tested with a Pitch Bend event):
Windows Media Player 12.0.9600.19482
Notation Player 4.0.3
Cakewalk 2022.06 (Build 034, 64 Bit)
vanBasco's Karaoke Player 2.53
MAMPlayer 2006-08-19
Plays to end of last note:
Synthesia 10.9.5903
MuseScore 3.6.2.548021803 Revision 3224f34
Hmm, interesting. Okay, I'll give that a shot. I checked the unedited version (attached), and each track has a CC 123, 127, 121 before the end (All Notes Off, Poly mode On, Reset All Controllers). Cakewalk removes these.
Bavi, can you test those same softwares and see where they end this file? It "should" end around 1:49.
I have added 3 "silence" tests to the test set at https://github.com/jazz-soft/test-midi-files
Those are 5 seconds of silence that end with all-notes-off / text metaevent / end of track.
Microsoft Media Player seems to understand only the one with all-notes-off, and stops two others immediately.
Please let me know how other software understands those files.
(UPDATE: Added information about Synthesia, I forgot to test it in my original post.)
[quotePost id=18228]I checked the unedited version (attached), and each track has a CC 123, 127, 121 before the end (All Notes Off, Poly mode On, Reset All Controllers). Cakewalk removes these.
Bavi, can you test those same softwares and see where they end this file? It "should" end around 1:49.
[Attachment: Axelay-Intro repair mod (test 13).mid in a zip file]
[/quotePost]All of the software I mentioned in my last post except for Synthesia and MuseScore says the end of your MIDI file is about 1 minute 49 seconds, about 1 minute 50 seconds, or exactly 1 minute 49.920 seconds. Synthesia says the end of the file is 1 minute 39.8 seconds. MuseScore says the end of the file is 52 seconds (original file) or 1 minute 38 seconds (Format 0 file), see the notes below.
Cakewalk notes: I remembered that I have put special settings in my Cakewalk TTSSEQ.INI file that change how Cakewalk processes some events. However, I tested by renaming the TTSSEQ.INI file to disable it, and Cakewalk behaved the same way -- it doesn't remove the Control Change events at the end. Maybe you have a newer version of Cakewalk and it behaves a little differently? Or maybe there is some other setting that is different in our Cakewalks causing it to behave differently.
MuseScore notes: I am still using MuseScore 3, I haven't yet updated to MuseScore 4.
After its MIDI file import process, MuseScore appears to play until the end of the measure where the last note ends.
MuseScore appears to recognize that the notes in your MIDI file aren't very well aligned to quarter notes and measures. It looks like MuseScore decided to ignore the quarter-note-based durations specified in your MIDI file and instead it reassigns the seconds-based durations into quarter notes and measures on its own. For example, your original MIDI file uses a tempo of 62.5 quarter notes per minute and a unspecified default time signature of 4/4. However after MuseScore imports your MIDI file, it shows up with a tempo of 183 quarter notes per minute and a time signature of 3/4, and somewhat sounds the same.
MuseScore sill has some issues importing your MIDI file that I don't fully understand. I think MuseScore tries to fit notes into typical sheet music note values, and sometimes this incorrectly changes the durations in your MIDI file.
When I import your unmodified MIDI file, MuseScore says the duration of the file is 52 seconds. If I instead use Sekaiju to convert your file to Format 0, then import that into MuseScore, then MuseScore says the duration of the file is 1 minute 38 seconds, which is about where the end of the last notes are in your original MIDI file.
[quotePost id=18229]I have added 3 "silence" tests to the test set at https://github.com/jazz-soft/test-midi-files [...] Please let me know how other software understands those files.[/quotePost]
The various MIDI file software I have says the end of each file is at...
test-silence-all-notes-off.mid | test-silence-end-of-track.mid | test-silence-text-metaevent.mid | |
Cakewalk 2022.06 (Build 034, 64 Bit) | 6 seconds (note A) | 0 seconds | plays 0 seconds, but shows "Thank you!" marker at 6 seconds (note A) |
MAMPlayer 2006-08-19 | 5 seconds | crashes (note B) | crashes (note B) |
MIDITrail 1.4.0 (64bit) | 5 seconds | 5 seconds | 5 seconds |
MuseScore 3.6.2.548021803 Revision 3224f34 | shows blank page (note C) | shows blank page (note C) | shows blank page (note C) |
Notation Player 4.0.3 | 5 seconds (3 full measures of rest, takes about 6 seconds to play, but time display doesn't specifically advance to 6 seconds) (note D) | shows error message and doesn't open file (note B) | shows error message and doesn't open file (note B) |
Sekaiju 7.8 | 5 seconds | 5 seconds | 5 seconds |
Synthesia 10.9.5903 | shows error message and doesn't open file (note C) | shows error message and doesn't open file (note C) | shows error message and doesn't open file (note C) |
vanBasco's Karaoke Player 2.53 | 5 seconds | 0 seconds | 5 seconds (turns on lyrics display mode and shows "Thank you!" as lyrics) |
VLC Media Player 3.0.16 | 5 seconds | 5 seconds | 5 seconds |
Windows Media Player 12.0.9600.19482 | 5 seconds | 0 seconds | plays 0 seconds, but shows duration as 5 seconds in playlist after playback was attempted. |
Note A: Cakewalk incorrectly uses a default tempo of 100 quarter notes per minute when there is no tempo specified in the MIDI file, instead of using the correct default of 120 quarter notes per minute that is specified in the Standard MIDI Files specification. So in these test MIDI files, the items that are 10 quarter notes from the beginning of the file show up at 6 seconds in Cakewalk instead of at 5 seconds.
Note B: Some MIDI player software, such as MAMPlayer and Notation Player, will not process the MIDI file correctly if there are no messages in the MIDI file that are sent to a MIDI device (in other words, if the MIDI file only contains meta events).
Note C: Some MIDI player software, such as MuseScore or Synthesia, will not process the MIDI file correctly if there are no notes in the MIDI file.
Note D: Software that is focused on music notation may end the file at the end of the measure where the last note ends or where the last MIDI message is located. For example, for test-silence-all-notes-off.mid file, Notation Player shows three full 4/4 measures of rest that takes about 6 seconds to play, but the time display only shows minutes and seconds with no decimal places, and never actually advances to 6 seconds. (Also, in my previous post testing Jason's MIDI file, I also noticed MuseScore ends the playback at the end of the measure where the last note ends.)
Thanks a lot Bavi_H!
So adding all-notes-off in the end of the file seems to be a bullet-proof solution.
Teamwork! Thanks, I'll be adding "All Notes Off" to this particular song.
[quotePost id=18231]Cakewalk notes: I remembered that I have put special settings in my Cakewalk TTSSEQ.INI file that change how Cakewalk processes some events. However, I tested by renaming the TTSSEQ.INI file to disable it, and Cakewalk behaved the same way -- it doesn't remove the Control Change events at the end. Maybe you have a newer version of Cakewalk and it behaves a little differently? Or maybe there is some other setting that is different in our Cakewalks causing it to behave differently.
[/quotePost]
I just thought about this and it might be a result of how I am editing the file. I open it, select all tracks, and split the file at the end point that I want. Then I delete the parts of the tracks to the right of the split point, so it must also lose those CC commands, and just puts the new "End Of Track" at the end of the split point. Makes sense now that I think about it.
Just for the heck of it, I loaded it with Musescore 3 to have a listen. Woof.
I tried manually setting it to 62.5 tpqn and 4/4, and it's a disaster. Some parts play too fast, some too slow, not much just right. I also changed my default shortest note to 1/1024, which seemed to not help anything. :p
I tested multiple variation with my file in Winamp.
Ends after the last note off:
- 123 All notes off
- 127 Poly Mode On127
- 121 Reset All Controllers
Ends at the end (with events at same tick as end of track)
- Poly Mode On 127 AND All notes Off
- Reset All Controllers AND All notes Off
- 120 All sound off AND All notes Off
- Poly Mode On AND Reset All Controllers
So it appears with Winamp, there needs to be at least two non-playing events for it to register the extended end, but it does not appear to be very specific as to which two..
Haha, I wish I had made a note of which song it was so I can see exactly what I ended up adding in, as the current soundtrack I am working on has multiple songs that need this. 😀
Try to add some non-sounding MIDI message after 2 seconds of silenc
After 2 seconds of silence, I'll inject a non-sounding MIDI message. This could be something like a control change message (CC) with a parameter set to zero, which wouldn't produce any audible effect but would still be a valid MIDI event. Would you like help with the code to implement this in a specific programming language or software environment?