Clef of MIDI file
1. Open attached MSCZ (produced in 1.3).
2. 'Export…'.
3. Choose 'MIDI'.
4. 'Save'.
5. Open MIDI file.
Desired result: The clef is 8vb.
Actual result: The clef is normal.
Note: The produced MIDI is also attached.
Discussion: I'm not sure if it is linked to MuseScore's default Electric Bass entry, but should anything happen?
Using MuseScore 2.0 Nightly Build (b0f01b4) - Mac 10.7.5.
Attachment | Size |
---|---|
Clef of MIDI file.mscz | 1.37 KB |
Clef of MIDI file.mid | 117 bytes |
Desired result.png | 15.37 KB |
Actual result.png | 15.19 KB |
Comments
I believe there is no link between the MIDI file import and MuseScore instruments.xml file (the file where the default clef for each instrument is saved). MIDI import only use G clef or F clef according to the pitch range for a staff or a measure. It also used a simple long instrument name, no transposition, doesn't deal with the instrument ambitus etc... All the info available in instruments.xml (no need to create on forum post for each)
The MIDI file doesn't really contains a reference to any instrument. As discussed previously, the instrument is not really stored in the MIDI file. I believe we get the instrument name from the name of the MIDI track if any, and if not we use the default MIDI name for the program.
So to sum it up, how would you propose to get which clef should be used? The info is only in instruments.xml. The only way to link an entry in instruments.xml and the MIDI file is via the program number (and instruments.xml can have several instruments with a given program number) or via the trackname (and there is only a few instruments in instruments.xml with the standard MIDI name).
In the particular example, there is no MIDI trackname. The program number is 33. MuseScore has an hard coded list of instrument names and in the list, number 33 is "Fingered Bass". In instruments.xml, there is no instrument named 'Fingered bass", there is only one instrument with program number 33, the Electric Bass. So it would work for this particular example but if we take program number 24, there are 16 instruments in instruments.xml... we could take the first one, or the last one, but will it be better than choosing between G and F clef?
So question is. Is it worth the effort to do this link between instruments.xml and the program number of the MIDI track, knowing that it will not really work?
A related topic is transposition. If an instrument name (MIDI track) starts with "Bb" (e.g. "Bb trumpet") it might be nice to setup the staff transposition on import. Maybe a regular expression along the lines of
/^([A-G]b?) /
In other words if the instrument name starts with a capital letter [A-G], optionally followed by a "b" (flat sign), followed by a space, then adopt that transposition.
Sometimes the transposition appears at the end of the instrument name (e.g. "Trumpet in Bb") so we'd also need to check for that
/ ([A-G]b?)$/
In reply to A related topic is by David Bolton
It is not only Xb instruments that are transposing
In reply to It is not only Xb instruments by Jojo-Schmitz
Jojo-Schmitz: That is correct. On IRC they were already talking about instruments' typical transpositions (e.g. Alto Sax is always going to be Eb transposition). I thought I'd mentioned the above cases where the transposition is unambiguously identified in the instrument/track name (since this might need to override the default transposition). Trumpet in particular can have a variety of transposition keys.
I have a doubt about automatically linking MIDI instruments to Instruments.xml.
What if the sound was intended to be played from a keyboard, rather than the native instrument?
In reply to I have a doubt about by chen lung
Then you could just print the score at concert pitch. Or make the transposition change manually. No different than the case of someone wanting to create a score from scratch. What if you intend a part to be played by a keyboard with an alto saxophone latch rather than an actual alto saxophone? You need to set that up manually.
Should be fixed in https://github.com/musescore/MuseScore/pull/1585
Close, if it's OK.