Hudební skladba - vstupy a výstupy - MIFI

Music Interchange File (MIF/MIFI)

Návrh formátu

Výměnný formát, tzv. "music interchange file" (MIF/MIFI), je nově definovaný formát XML souboru, který umožňuje definovat nejen existující (fixní) hudbu, ale také hudbu, která má být komponována.

Soubor (XML) je generován ze třídy MusicalBundle (list objektů typu MusicBlock).

    public XElement GetXElement {
        get {
            XElement xbundle = new XElement(
                        "MIF",
                        new XAttribute("FileName", this.FileName));

            XElement xcopyright = new XElement(
                "Software",
                new XAttribute("Name", MusicalSettings.ApplicationName),
                new XAttribute("Www", MusicalSettings.ApplicationWeb));
            xbundle.Add(xcopyright);

            var xheading = this.FileHeading.GetXElement;
            xbundle.Add(xheading);

            //// Blocks
            XElement xblocks = new XElement("Blocks");
            foreach (MusicalBlock block in this.Blocks.Where(block => block != null)) {
                var xblock = block.GetXElement;
                xblocks.Add(xblock);
            }

            xbundle.Add(xblocks);
            return xbundle;
        }
    }
    

Příklad

Základní struktura souboru

    <?xml version="1.0" encoding="utf-8" ?>
    <MIF FileName="skakal_pes_Middle_Animato_">
        <Software Name="" Www="..." />
        <Heading WorkTitle="skakal_pes_Middle_Animato_" />
        <Blocks>
	<Block Number="1" FileName="skakal_pes" Name="Middle (Animato)">     
		... header
		... body
		... strip
	</Block>                
	....
        </Blocks>
    </MIF>


Záhlaví hudebního bloku (header)

    <Header Name="Middle (Animato)" Number="1" FileName="skakal_pes"
            Origin="2020-03-14T04:05:13.4260853+01:00" Changed="2020-03-14T04:05:13.4260853+01:00"
            Division="240" Tempo="120" NumberOfBars="16" NumberOfLines="3" 
            NumberOfMelodicLines="1" NumberOfRhythmicLines="0">
        <System HarmonicOrder="12" RhythmicOrder="240" />
        <Metric Beat="4" Base="2" />
    </Header>


Tělo hudebního bloku (body)

Jednotlivé elementy pro linie taktů zde není potřeba zapisovat, rekonstruují se podle záznamů v bloku "strip".

    <Body>
	    <Bar Number="1" Tempo="100">
        	<Harmony Length="2">
		        <Structure Shortcut="g" Tones="g" Code="7" Start="0" Length="60" />
	        	<Structure Shortcut="eg" Tones="eg" Code="4,7" Start="60" Length="180" />
		    </Harmony>
	    </Bar>
    </Body>


Pás melodií hudebního bloku (strip)

<Strip HasLines="true">
	<Lines>
		<Line LineIndex="0" LineType="Melodic" Channel="0" Purpose="Fixed">
        		<StatusList>
		        	<Status Bar="1" Octave="OneLine" BandType="MiddleTones" LineType="Melodic" 
                               MelodicFunction="HarmonicMotion" MelodicShape="Scales" Loudness="Mf" LocalPurpose="Fixed" 
                               Rhythm="1,23*0,2,5*0,1,23*0,2,5*0,1,47*0,2,11*0,1,23*0,2,5*0,1,23*0,2,5*0,1,47*0,2,11*0" 
                               Melody="2*1,0,2*1,0" MelodicDegree="2" MelodicOrder="6" Staff="0" Voice="0">
	        			<Instrument Genus="Melodical" Name="BrightAcousticPiano" Number="1" />
	                    	</Status>
        	        </StatusList>
	        	<Tones>
		        	<Tone Bar="1" Start="0" Length="24" Note="g1" Pitch="67" Loudness="Mf" Instrument="1" />
			        <Tone Bar="1" Start="30" Length="24" Note="g1" Pitch="67" Loudness="Mf" />
			        <Tone Bar="1" Start="60" Length="48" Note="e1" Pitch="64" Loudness="Mf" />
			        <Tone Bar="1" Start="120" Length="24" Note="g1" Pitch="67" Loudness="Mf" />
		        	<Tone Bar="1" Start="150" Length="24" Note="g1" Pitch="67" Loudness="Mf" />
			        <Tone Bar="1" Start="180" Length="48" Note="e1" Pitch="64" Loudness="Mf" />
        	        </Tones>
		</Line>
		<Line LineIndex="1" LineType="Melodic" Channel="1" Purpose="Composed">
		        <StatusList>
			        <Status Bar="1" Octave="TwoLine" BandType="HighTones" LineType="Melodic" 
                               MelodicFunction="HarmonicMotion" MelodicShape="Scales" Loudness="MeanLoudness" LocalPurpose="Composed" 
                               Rhythm="1,59*0,1,179*0" Melody="" Staff="0" Voice="0">
				        <Instrument Genus="Melodical" Name="StringEnsemble1" Number="48" />
				</Status>		
	                </StatusList>
        		<Tones>
			        <Tone Bar="1" Start="0" Length="60" Note="g2" Pitch="79" Loudness="MeanLoudness" Instrument="48" />
			        <Tone Bar="1" Start="60" Length="180" Note="e2" Pitch="76" Loudness="MeanLoudness" />
	                </Tones>
		</Line>
	        <Line LineIndex="2" LineType="Melodic" Channel="2" Purpose="Composed">
        		<StatusList>
		        	<Status Bar="1" Octave="Small" BandType="BassTones" LineType="Melodic" MelodicFunction="HarmonicMotion" 
                               MelodicShape="Scales" Loudness="MeanLoudness" LocalPurpose="Composed" 
                               Rhythm="1,59*0,1,179*0" Melody="" Staff="0" Voice="0">
			       		<Instrument Genus="Melodical" Name="StringEnsemble1" Number="48" />
	                    	</Status>
        	        </StatusList>
		        <Tones>
			        <Tone Bar="1" Start="0" Length="60" Note="g0" Pitch="55" Loudness="MeanLoudness" Instrument="48" />
			        <Tone Bar="1" Start="60" Length="180" Note="g0" Pitch="55" Loudness="MeanLoudness" />
			</Tones>
		</Line>
        </Lines>
      </Strip>


Detaily

Atributy záhlaví bloku - soustava a metrum

    <xs:sequence>
        <xs:element name="System">
            <xs:complexType>
                <xs:attribute name="HarmonicOrder" type="xs:unsignedByte" use="required" />
                <xs:attribute name="RhythmicOrder" type="xs:unsignedByte" use="required" />
            </xs:complexType>
        </xs:element>

        <xs:element name="Metric">
            <xs:complexType>
                <xs:attribute name="Beat" type="xs:unsignedByte" use="required" />
                <xs:attribute name="Base" type="xs:unsignedByte" use="required" />
            </xs:complexType>
        </xs:element>
    </xs:sequence>


Ostatní atributy záhlaví bloku

	<xs:attribute name="Name" type="xs:string" use="required" />
	<xs:attribute name="Number" type="xs:unsignedByte" use="required" />
	<xs:attribute name="FileName" type="xs:string" use="required" />
	<xs:attribute name="Origin" type="xs:dateTime" use="required" />
	<xs:attribute name="Changed" type="xs:dateTime" use="required" />
	<xs:attribute name="Division" type="xs:unsignedByte" use="required" />
	<xs:attribute name="Tempo" type="xs:unsignedByte" use="required" />
	<xs:attribute name="NumberOfBars" type="xs:unsignedByte" use="required" />
	<xs:attribute name="NumberOfLines" type="xs:unsignedByte" use="required" />
	<xs:attribute name="NumberOfMelodicLines" type="xs:unsignedByte" use="required" />
	<xs:attribute name="NumberOfRhythmicLines" type="xs:unsignedByte" use="required" />


Atributy taktu

	<xs:attribute name="Number" type="xs:unsignedByte" use="required" />
	<xs:attribute name="Tempo" type="xs:unsignedByte" use="required" />


Atributy jednotlivých akordů v rámci harmonie taktu

	<xs:attribute name="Shortcut" type="xs:string" use="required" />
	<xs:attribute name="Tones" type="xs:string" use="required" />
	<xs:attribute name="Code" type="xs:string" use="required" />
	<xs:attribute name="Start" type="xs:unsignedByte" use="required" />
	<xs:attribute name="Length" type="xs:unsignedByte" use="required" />


Základní atributy linie

	<xs:attribute name="LineIndex" type="xs:unsignedByte" use="required" />
	<xs:attribute name="LineType" type="xs:string" use="required" />
	<xs:attribute name="Channel" type="xs:unsignedByte" use="required" />
	<xs:attribute name="Purpose" type="xs:string" use="required" />


Stavové atributy linie - element určující nástroj

    <xs:element name="Instrument">
            <xs:complexType>
                <xs:attribute name="Genus" type="xs:string" use="required" />
                <xs:attribute name="Name" type="xs:string" use="required" />
                <xs:attribute name="Number" type="xs:unsignedByte" use="required" />
            </xs:complexType>
        </xs:element>
    </xs:sequence>


Ostatní stavové atributy linie

	<xs:attribute name="Bar" type="xs:unsignedByte" use="required" />
	<xs:attribute name="Octave" type="xs:string" use="optional" />
	<xs:attribute name="BandType" type="xs:string" use="optional" />
	<xs:attribute name="LineType" type="xs:string" use="optional" />
	<xs:attribute name="MelodicFunction" type="xs:string" use="optional" />
	<xs:attribute name="MelodicShape" type="xs:string" use="optional" />
	<xs:attribute name="Loudness" type="xs:string" use="optional" />
	<xs:attribute name="LocalPurpose" type="xs:string" use="optional" />
	<xs:attribute name="Rhythm" type="xs:string" use="required" />
	<xs:attribute name="Melody" type="xs:string" use="required" />
	<xs:attribute name="MelodicDegree" type="xs:unsignedByte" use="optional" />
	<xs:attribute name="MelodicOrder" type="xs:unsignedByte" use="optional" />
	<xs:attribute name="Staff" type="xs:unsignedByte" use="optional" />
	<xs:attribute name="Voice" type="xs:unsignedByte" use="optional" />


Atributy tónů linie

	<xs:attribute name="Bar" type="xs:unsignedByte" use="required" />
	<xs:attribute name="Start" type="xs:unsignedByte" use="required" />
	<xs:attribute name="Length" type="xs:unsignedByte" use="required" />
	<xs:attribute name="Note" type="xs:string" use="required" />
	<xs:attribute name="Pitch" type="xs:unsignedByte" use="required" />
	<xs:attribute name="Loudness" type="xs:string" use="required" />
	<xs:attribute name="Instrument" type="xs:unsignedByte" use="optional" />