|
Post by mms on May 9, 2021 13:27:19 GMT
Hello,
I'm having a problem with MIDI files created by my sequencer that end with a rest.
In the attached image, my MIDI file shows as one second in Windows Media Player. I would like it's duration to be four seconds (4 quarter notes @ 60 bpm = 4 seconds)
The problem is, the file plays for one second then ends. My sequencer's playback indicator is supposed to jump to the first note, then to each of the three rests respectively.
How would each of your 3 sequencers show duration for this?
[edit] For the life of me, I can't figure out how to attach an image, and I've done it here before. (The image is supposed to show a Clef, a 4/4 Time Signature, a Quarter Note, and three quarter Rests)
|
|
|
Post by JohnG on May 10, 2021 12:04:14 GMT
Hi MMS, Well, according to one of my sequencers, what you're doing is correct. 1. Sekaiju just plays the one note. 2. Anvil Studio plays to the end of the measure. 3. XGworks plays four full measures. So ... I'm guessing, each program has code that defines how long it will go on playing after the last note. Strictly speaking, in notation view, you should display the quarter note, then one quarter note rest, followed by one half note rest for that measure. See below. Left to right, Staff view; PRV; List view; master track. Any help? JohnG. P.S. About the images, sorry, I'd temporarily turned attachments off because we have a limited amount of space to store them. All my imagess are hosted on a site called Postimages (postimg.cc).
|
|
|
Post by mms on May 10, 2021 13:26:46 GMT
Thanks for the help.
Would you be able to send me the MIDI files created by each of your three sequencers, so that I can examine them?
The file created by Anvil Studio as you describe, seems to do as I would like, but I would like to see what the others do as well.
|
|
|
Post by JohnG on May 10, 2021 14:49:02 GMT
No problem!
It was the same file, created in XGworks and saved as a type 1 SMF. It just has tempo 60 bpm and time sig. 4/4. Then a single note on, middle C, velocity 72, length a quarter note. Then a note on, velocity zero, middle C.
The three programs played the same file differently which, to me, signals that it's a programming decision how long it plays after the last note. Not so?
|
|
|
Post by mms on May 10, 2021 16:09:50 GMT
From what you describe, perhaps.
But I guess to be sure, if say, 4 more measures were added to the file you created, each with a whole note rest, it would be interesting to see if:
- Sekaiju still plays one 1 second note (1 second midi length file) - Anvil Studio plays/creates 20 second file (sounding one 1 second note , followed by 19 seconds of silence) - XGworks still plays 4 full measures (16 second midi length file), or now 8 full measures (32 second midi length file)
I'm thinking ahead, and say I have a conductor's score with a large number of instruments and 50 measures, and one of those instruments plays notes in measure 1 only, and the remaining 49 measures are whole measure rests, if I muted all instruments, except the one having notes in the first measure only, I would still want the song to play the full 50 measures, and the playback indicator jumping to each of the 49 whole measure rests as time elapsed.
|
|
|
Post by JohnG on May 10, 2021 18:06:21 GMT
But rests have no MIDI value and therefore create no data within an SMF. They are merely indicators on a score that the stave, for that instrument is empty. Certainly, between notes, they have a value as a delta time, but not if there are no following notes. Here is a completely empty file being created in Staff View. All the staves are empty and just show a full note rest, but there's no data in the file apart from the default bpm=120 and 4/4 time. I'll try creating a score many measures long, I'm sure I have one, and insert just one note on an extra track, then mute the rest and see what happens. JohnG.
|
|
|
Post by mms on May 10, 2021 20:36:58 GMT
OK thanks.
Would you be able to send me the one measure MIDI file you created in Post #2 to review?
All three of your sequencers play the same SMF file differently, and I would like to see which events are issued and where and how. I then can compare to my SMF for same.
Somehow Anvil Studio knows that there are three additional quarter rests in the first measure, and accounts for them, so I am thinking in some manner they are accounted for in the SMF.
|
|
|
Post by JohnG on May 11, 2021 8:33:01 GMT
Yes, I'll send you my file "OneNote.mid" expect delivery shortly.
As for Anvil, no, I don't think it "knows", the author has just decided in his coding that he will play any SMF to the end of the last measure containing 'events'. This could be the master track, e.g. lots of markers or tempo changes (or any other event) or any other track, e.g. one with just lyrics in it or, of course, one with notes. The decision, in my opinion, is down to the author of the code as to how far to continue playing. I.e. it's down to the design of the 'play engine'.
But it is only an opinion, I'm not an author of any sequencing code, although I spent many years programming mainframes in assembler and machine code from 1967 on, and worked on segments of a mainframe operating system way back in the past. (Distant memories!)
JohnG.
|
|
|
Post by mms on May 11, 2021 12:22:01 GMT
Thank you for the file. You are correct, there is absolutely nothing in the file other the Note On/Off for middle C Maybe I am wrong in the way I view this, but if I open a file in "Score View" and see for example, four 60-bpm 4/4 measures all with whole rests, I would expect to hear a MIDI file of 16 second duration, albeit all silence. I came up with two ways last night to achieve this (a kludge perhaps) but it works. method 1 - Add a Note Off event (note 0, velocity 0) as very last event of music track @ delta time corresponding to end of sequence and method 2 - Add an arbitrary Tempo Change at very end of master track @ delta time corresponding to end of sequence This morning I got to thinking about method 2, and remember reading somewhere that every SMF should end with a MIDI Reset command, so the sequencer is always left in a standard state (should also be done at beginning of file in case it was not left in standard state). I could always add a Reset as last event in master track, never even having to "watch" for sequences that end with "rests". Do you have a comment on this? Is the Reset even valid with a SMF? Yes I remember you telling me about your programming career. You were the one who explained the concept of "Two's Complement" to me a long time ago, when I needed it for this project (how to properly write out key signatures)
|
|
|
Post by JohnG on May 11, 2021 13:57:58 GMT
Yes, a GM reset at the start of a file is always a good idea, followed by GS or XG reset as required. At the end is debatable. I, for one, think it's a good idea, but unecessary if there's one at the start. I've heard others argue that, i.e. if you insert a series of RPNs changeing pitch bend range to an octave and want to keep that (useful for guitar slides) then the reset messes things up, and so on. My response is those kind of changes should be at the start of every SMF that needs them. But ... in your case, I think I'd insert something that effectively does nothing, e.g. a marker or text event in the master track. See here. File deleted. I've added an empty 'text' meta event to the master track. See what that does. JohnG.
|
|
|
Post by mms on May 11, 2021 19:04:01 GMT
Strange...
My parser will not open the file, and Windows Media Player will not play the file either.
OneNote.MID is fine however.
|
|
|
Post by JohnG on May 12, 2021 8:41:32 GMT
Interesting! It looks like we found another area within XGworks v4 which doesn't work correctly. I've now tried opening the new file in Anvil and Sekaiju and like you find, neither of them like it. SO ... I've opened the original OneNote in Sekaiju, this time, and added a text line in the master track. This time both programs seem to like it so I've attached it here. OneNotePlus.MID (77 B) The text is at the start of measure 5. Perhaps it'll work this time. JohnG.
|
|
|
Post by mms on May 12, 2021 13:23:15 GMT
OK thanks.
This one works perfect, and from that I was able to replicate in my program. Now when I play my 1 note + 3 rest sequence, the file plays the full measure (and playback indicator follows).
I tried taking the same approach with a GM Reset command, but it fails in my program, and Windows Media Player reports the file corrupt. In the master track, I added a delta time and the byte string F0 7E 7F 09 01 F7
Could I ask that you replace the text event in OneNotePlus with a GMReset so I can review that file? I apologize for asking for so much... you can always just say NO.
|
|
|
Post by JohnG on May 12, 2021 15:06:07 GMT
Hi again MMS, Okay, text meta data removed and GM reset put in, in channel 1. You can't have it in the master track. OneNoteReset.MID (78 B) See what that does. BTW it should have played to the end of measure four, as should this one. Say "No"? That's a novel approach for a MIDI tutor! JohnG.
|
|
|
Post by mms on May 12, 2021 16:03:49 GMT
Thank you! I see my problem!! The byte string is F0 05 7E 7F 09 01 F7 05 being the number of bytes from 7E to F7 I presume. Where is this stuff even documented? I have the document Standard MIDI-File Format Spec. 1.1 (18 pages) and I can't even find the documentation for the string 7E 7F 09 01 F7
Now I'm not even sure where I found this in the first place? Anyways, it works (one 1 second note followed by 15 seconds of silence) and now the same in my program. I think I like this solution the best, as I don't have to do anything special (ie looking for tracks that end with "rests" and writing a marker event or anything special) Just always add a GM Reset event at end of sequence, as this seems to be good SMF practice. If I had made some controller setting change during the sequence, the synth would be reset to a default state for the next user, especially if the next user's file doesn't have a reset event at the beginning of his/her SMF.
|
|