|
Post by mms on Oct 11, 2017 11:55:35 GMT
Hello,
My understanding is that there is no limit as to how many tracks are allowed in a MIDI file (although I've seen documentation that says only 16 tracks per file).
I know there are only 16 MIDI channels, with channel 10 being reserved for drums.
Therfore only 15 distinct instruments can be used in any given file?
Thanks.
|
|
|
Post by Henry on Oct 12, 2017 0:51:49 GMT
Hi,
A standard MIDI file (SMF, carrying the .mid extension) can actually contain up to 17 tracks. One is reserved for key-, time-, tempo- and other meta-events, that are read by the playback software. This leaves us with 16 tracks gong to our instruments, one for each MIDI channel.
Channel 10 is usually assumed to be the drum part under the GM, GS and XG specifications. You can however use this channel for normal instrument voices too, if drums aren't needed. That is; unless the tone generator is somehow "locked" to allow only drum sounds to be played on this channel (mostly older instruments).
The track limitation of SMF files dates back to ca. 1990, when synthesizers were rarely capable of playing back more than a couple of channels at once (bigger setups were typically daisy-chained using the MIDI thru sockets). While this may seem archaic today, it makes sense, given how MIDI fundamentally works.
A modern sequencer can handle way more than 16 MIDI tracks, of course. Modern tone generators can often respond on more than 16 channels simultaneously too. Since a MIDI port is limited to 16 channels, however, this requires the use of multiple MIDI ports. Sequencers therefore use proprietary formats different from SMF, to save their data. Port assignments (as well as audio tracks, mixer setups, plugin states, automation, etc.) are then included in a single project file.
Most sequencers can also export to the SMF format, but with the limitations already mentioned.
Best regards,
- H -
|
|
|
Post by JohnG on Oct 12, 2017 10:11:23 GMT
Actually you're right MMS, you can have as many MIDI tracks as the software (DAW, virtual instrument(s)) or the hardware (file player, keyboard, etc.) will allow. However, most hardware, e.g. Yamaha PSR or Tyros, etc. will allow for just 16 or 17 tracks. I have a Yamaha MU1000 which, within it has, in effect, four playback 'engines'. This gives it the capability of accepting 4 x 16 channels of MIDI, or 64 tracks. These are typically sent via USB these days. The limit here is the polyphony of the MU1000 which is, as far as I remember, 128. The old XGworks version 3 software allows up to 100 tracks, as I recall, thus supporting the 64 tracks needed for the MU1000 or 2000 with some to spare. We may decide to record each drum or cymbal to a separate track but have all the tracks pointing to the MIDI standard channel 10. The question then is, if you send that MIDI file with more than 16 tracks to e.g. a PSR S670, will it be able to handle it? So the limit is not so much what can MIDI support, but what can the hardware and software you use support. I regularly create full orchestral files with 40 tracks or so, with various combinations of instruments sent to separate VST sample players. e.g. strings to the first sample player, woodwind to the second, brass to the third, percussion and piano or organ or harpsichord to another.
|
|
|
Post by mms on Oct 12, 2017 12:31:29 GMT
Thank you both for your answers.
I (for now at least) am only using the Microsoft GS Wavetable Synth that comes with Windows. I assume this is 16 channels only.
So to exceed the 16 instrument limitation, I can safely use the same channel for multiple instances of the same instrument. I mean I could assign Eb, D, C, Bb, and A Clarinets all to the same channel? (therefore 5 instruments playing, but only one channel used)
When I say safely, I mean, say if 2 clarinets (on the same channel) started sounding the same pitched note at the same time, but one was to sound for a quarter note duration, and the other was to sound for a double whole note duration, they both would not turn off when the first NoteOff Event for the quarter note was received?
I (with my GS Wavetable Synth) could never have more than 16 distinct instruments playing at any given time?
I know these questions may sound trivial, but I really just don't know.
And John, I see what you mean. If a midi file was created on (for) a system that could support more than 16 tracks, that doesn't mean that another system would necessarily be able to handle it.
|
|
|
Post by Henry on Oct 12, 2017 18:40:51 GMT
Hi,
You can easily send the data from several sequencer tracks onto a single channel. These tracks will then share the same voice, like you said, and this allows the simulation of a larger orchestra. You can visualize this as 16 groups of instruments, rather than 16 individual instruments.
The drawback of this technique is that any real-time controllers or settings applied to one channel (such as volume, panning, vibrato, pitch bend, etc.) will apply to all notes in that group. Also, two or more simultaneous notes of the same pitch may in some cases be interpreted as a series of single notes (i.e. NoteOff and re-triggering the same note). This depends on the actual tone generator used, but there's really no easy way for a synthesizer to tell these notes apart, once they arrive on the same channel.
The Microsoft GS Wavetable is a 16-channel software synthesizer, capable of 64-note polyphony. This means you'll have 16 distinct instrument voices, each having 4 notes to play with on average. I'm not too familiar with how the GS Wavetable distributes the "note load" (e.g. what happens if a channel uses more than 4 notes, or what notes are left out when you start exceeding the 64-note total polyphony), but I'm sure this must be documented somewhere.
John's statement is true when looking at the workflow within a typical sequencer/DAW software suite, but it doesn't apply to the MIDI file format itself. The SMF ( .mid) file is indeed limited to 16 instrument tracks over a single, undefined MIDI port. When you save/export a sequencer project as a SMF MIDI file, sequencer tracks sharing the same channel (as in your example) are merged, resulting in a 16-track file. Most sequencers therefore use additional file formats, such as XGworks' .xws or Cakewalk's .cwp files, in order to handle more complex projects.
What sequencer are you using, by the way, MMS?
Best regards,
- H -
|
|
|
Post by JohnG on Oct 13, 2017 9:19:10 GMT
Still not true, I'm afraid, Henry.
Try splitting the percussion track into individual instruments, each cymbal, snare, tom, etc., on a different track. You might end up with half a dozen tracks, or more. Each track can be assigned to MIDI channel 10.
Additionally split the piano part into bass and treble clef assignments, in the way that most piano music is scored. Or, indeed, for a three part invention, into three separate tracks. They can all be pointed, e.g. to track one.
Assuming all the other tracks each point to an individual channel, we now may have 23 tracks pointing to 16 channels on one port. All perfectly legal according to the SMF specification.
As long as each track has the appropriate MTrk header and has the appropriate delta timing information within it, there is no limit of tracks imposed by the MIDI specification. If you believe that I'm incorrect, Henry, can you point me to that part of the SMF specification where this limit is defined please? I'm confident I'm correct, but I have been known to be mistaken. I have just re-read the file spec. and I can't find any limit.
However, and it's a big HOWEVER, limits are often imposed by sequencing hardware built into keyboards/MIDI file players. These limits MAY require all the percussion (or piano) information to be on one track. But it's not a MIDI limitation, it's one imposed by the hardware manufacturer. So, if using the sequencer built into my Casio PF560, I'm limited to a single control track/channel and 16 further track/channels. In this case track and channel are synonymous, so I cannot split them up in any way. Casio's limit, not a MIDI specification limitation. Software sequencers will automatically combine all the e.g. drum tracks in the correct order on a single channel for transmission across each MIDI port.
---------------
Coming back to your original question MMS,
No, 16 instruments AT ANY ONE TIME, i.e. one instrument per channel. It is possible to re-assign the drum track to be a normal melodic instrument channel. Just as on many PSR and Tyros machines track 11 (AFAIK) can be assigned as a second percussion channel. You would need to check whether and how that is implemented in any playback hardware or software. E.g. when using the sample player ARIA, for Garritan instruments, all 16 channels are allowed to have melodic instruments assigned to them, by default. To use XGworks to send the MIDI data to the sample player I need to undo the normal assignment of channel 10 to percussion.
It is not unusual, in a band or an orchestra, for one player to swap instruments during the playing of a piece of music. E.g. a saxophone player may start with an alto sax, swap to tenor sax in the chorus, then revert to the alto. This can be done within a MIDI file by issuing a "Program Change" (plus Bank Select messages if needed) at the appropriate moment, on one channel. Alternatively you could change from piano to organ, oboe to cor Anglais, bassoon to contra-bassoon, etc. It is usually necessary to allow several "ticks" to elapse for the hardware to implement the requested instrument change before sending any "Note On" messages, etc.
To summarise, all of this will depend what hardware or software you are using to create or edit your MIDI file. There are few limitations imposed by the MIDI specification, but many by the limitations of the hardware used or by the imagination of the software developers.
Regards, JohnG.
|
|
|
Post by JohnG on Oct 13, 2017 9:56:01 GMT
Aha, I've just seen where the confusion may be occurring. It may be over the use in the specification of the words "tracks" and "chunks". It also occurs due to using the word "track" as one thing when used in the context of sequencers, and another thing when referring to a "standard MIDI file" (SMF), although both are very similar. In a software sequencer "Track View" may look like this: Note how the sequencer track number is the first column labelled "Trk". The MIDI channel that the track is assigned to comes next. Note how channel 1 is duplicated and channel 10 is repeated several times in the example I've created. If I save this as a Type 0 MIDI file then all the sequencer tracks will be written to just one MIDI file (smf) track (MTrk). If I save it as a MIDI type 1 file, then the track structure in the smf will mimic the structure in the sequencer. The MIDI spec contains the following: "MIDI Files contain two types of chunks: header chunks and track chunks. A header chunk provides a minimal amount of information pertaining to the entire MIDI file. A track chunk contains a sequential stream of MIDI data which may contain information for up to 16 MIDI channels. The concepts of multiple tracks, multiple MIDI outputs, patterns, sequences, and songs may all be implemented using several track chunks. A MIDI file always starts with a header chunk, and is followed by one or more track chunks. MThd <length of header data> <header data> MTrk <length of track data> <track data> MTrk <length of track data> <track data> ..." Notice, "may contain information for up to 16 MIDI channels" not "does contain", and "up to". So one could have a track with all the "backing track info., say channels 9 to 16. Then one track for right hand pointing to channel 1. Then one track for left hand pointing to channe1 1. This allows multiple tracks each one just pointing to one channel, all pointing to the same port.
|
|
|
Post by mms on Oct 14, 2017 14:29:19 GMT
Thanks again for trying to clear this up for me.
Henry I am not using a sequencer to create my MIDI files; I am using software I've written to create these files. To this point, I have just tested with 2 tracks (Piano LH and Piano RH) each set to a different channel; things work good. Wanting to take this further, I found the interpretation discrepancy of how many tracks were allowed in a MIDI file, and also of how to deal with more than 16 instruments in a MIDI file, as I've read people routinely do. I've searched for GS Wavetable documentation, but could find nothing.
John You do not experience any note conflict issues as Henry describes in your MIDI files with more than 40 tracks?
My conclusions from answers given in this post: 1. Unlimited number of tracks 2. 16 distinct instrument limit 3. I could have say 3 Grand Pianos playing simultaneously (using 6 different tracks) all assigned to same channel
Have I interpreted all correct? Possible NoteOn/NoteOff conflicts with same pitched notes in item 3.?
|
|
|
Post by JohnG on Oct 14, 2017 16:05:22 GMT
Hi MMS, Yes, 16 instruments simultaneously, but you can change instruments by issuing a program change (with bank select(s)) to any channel as the song plays. Well, as long as one stays within the capabilities of the hardware/software. The main thing, when sequencing, is not to quantise heavily. If many notes or percussion hits are triggered all exactly on the same tick then inevitably, as they have to be streamed sequentially, there will be conflict or, more accurately, delay. If the notes are played with a human feel, then the problems diminish. One can use the piano roll to drag notes early or late. Experimentation being the key. Most sequencers impose a limit of some sort. A hundred sequencer tracks seems not unreasonable. 16 instruments at any one time, per MIDI port. Modern sequencer programs tend to support multiple MIDI ports. If they're all assigned to one channel it's just one grand piano. Then you'd probably get note on/off conflicts. If you want 3 different sounding pianos you'd want to spread them across 3 channels possibly using 6 tracks in total. One program change command then per pair of tracks. In the image above one would put the program changes and other start up commands in the first measure and start the music in measure 2.
|
|