Ejemplo n.º 1
0
        internal void AdjustAlignments(Clytemnestra c, Trk w2, Trk w3)
        {
            Debug.Assert(this[213] is RestDef);
            this[213].MsDuration += this[212].MsDuration;
            RemoveAt(212);
            AgglomerateRests();

            AlignObjectAtIndex(25, 84, 85, c[196].MsPositionReTrk);
            AlignObjectAtIndex(84, 85, 89, c[204].MsPositionReTrk + 200);
            AlignObjectAtIndex(85, 89, 96, c[215].MsPositionReTrk);
            AlignObjectAtIndex(89, 96, 102, c[226].MsPositionReTrk);
            AlignObjectAtIndex(102, 106, 117, c[242].MsPositionReTrk);
            AlignObjectAtIndex(106, 117, 140, c[268].MsPositionReTrk);
            AlignObjectAtIndex(117, 140, 165, w3[61].MsPositionReTrk);
            AlignObjectAtIndex(140, 165, 197, w2[65].MsPositionReTrk); // was AlignObjectAtIndex(140, 163, 197, wind3[65].MsPosition);
            AlignObjectAtIndex(165, 197, 200, c[269].MsPositionReTrk - 200);
            AlignObjectAtIndex(197, 200, 206, c[277].MsPositionReTrk);
            AlignObjectAtIndex(200, 206, 211, c[283].MsPositionReTrk + 400);
            AlignObjectAtIndex(206, 211, 212, c[286].MsPositionReTrk);
            AlignObjectAtIndex(211, 212, Count - 1, c[289].MsPositionReTrk);

            // final adjustments for R2M
            AlignObjectAtIndex(11, 12, 13, c[123].MsPositionReTrk - 200);
            AlignObjectAtIndex(106, 111, 112, c[254].MsPositionReTrk - 100);
        }
Ejemplo n.º 2
0
 /// <param name="trkDef">The target trk</param>
 /// <param name="trkOptions">If non-null, this trkOptions overrrides the TrkOptions in the InputNote or InputChord</param>
 public TrkRef(Trk trkDef, TrkOptions trkOptions)
 {
     MidiChannel = trkDef.MidiChannel;
     _trkMsPosition = trkDef.MsPositionReContainer;
     _trkNumMidiObjects = trkDef.DurationsCount; // includes MidiChordDef, RestDef
     TrkOptions = trkOptions;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// The arguments are all complete to the end of Verse 3
        /// </summary>
        private void GetFuriesInterlude3ToEnd(Furies1 furies1, Furies2 furies2, Furies3 furies3, Furies4 furies4,
            Clytemnestra clytemnestra, Trk wind1, Trk wind2, Trk wind3, List<Palette> palettes,
            Dictionary<string, int> msPositions)
        {
            furies1.GetFinale(palettes, msPositions, _krystals[9]); // _krystals[9] is xk3(12.12.1)-1.krys
            furies1.AdjustAlignments(clytemnestra, wind2, wind3);
            furies1.AdjustVelocities(msPositions);

            msPositions.Add("furies2FinaleStart", furies1[47].MsPositionReTrk);
            msPositions.Add("furies2FinalePart2Start", wind1[54].MsPositionReTrk);
            msPositions.Add("finalBar", furies1[280].MsPositionReTrk);

            furies4.GetFinale(palettes, msPositions, _krystals[9]); // _krystals[9] is xk3(12.12.1)-1.krys
            furies4.AdjustAlignments(furies1, clytemnestra, wind3);
            furies4.AdjustVelocities(msPositions);

            furies2.GetFinale(palettes, msPositions, _krystals[10]); // _krystals[10] is xk4(12.12.1)-1.krys
            furies2.AdjustAlignments(furies1, furies4, clytemnestra);
            furies2.AdjustVelocities(msPositions);

            msPositions.Add("furies3FinaleStart", furies2[66].MsPositionReTrk);

            furies3.GetFinale(palettes, msPositions, _krystals[10]); // _krystals[10] is xk4(12.12.1)-1.krys
            furies3.AdjustAlignments(furies1, furies2, furies4, clytemnestra, wind1);
            furies3.AdjustVelocities(msPositions);

            AdjustPostludePans(furies1, furies2, furies3, furies4, msPositions["postlude"]);
            SetFuriesFinalePitches(furies1, furies2, furies3, furies4, msPositions);
        }
Ejemplo n.º 4
0
        internal void GetBeforeInterlude3(Clytemnestra clytemnestra, Trk wind1, Trk furies2, Palette cheepsPalette)
        {
            int[] cheepIndices = { 4, 8, 2, 6, 10, 0, 1, 3, 5, 7, 9, 11 };
            int[] transpositions = { 2, 1, 3, 0, 4, -3, 5, 10, 6, 9, 7, 8 };
            double[] velocityfactors = { 0.32, 0.31, 0.34, 0.3, 0.35, 0.37, 0.36, 0.43, 0.37, 0.42, 0.39, 0.4 };
            int[] msPositions =
            {
                furies2[8].MsPositionReTrk + 200,
                furies2[12].MsPositionReTrk + 100,
                furies2[24].MsPositionReTrk + 300,
                furies2[30].MsPositionReTrk + 400,
                furies2[40].MsPositionReTrk + 500,
                clytemnestra[122].MsPositionReTrk,
                clytemnestra[132].MsPositionReTrk + 110,
                clytemnestra[141].MsPositionReTrk + 220,
                clytemnestra[150].MsPositionReTrk + 330,
                clytemnestra[158].MsPositionReTrk + 440,
                clytemnestra[164].MsPositionReTrk + 550,
                clytemnestra[173].MsPositionReTrk,
            };
            for(int i = 0; i < cheepsPalette.Count; ++i)
            {
                MidiChordDef cheep = cheepsPalette.UniqueDurationDef(cheepIndices[i]) as MidiChordDef;
                Debug.Assert(cheep != null);
                cheep.MsPositionReTrk = msPositions[i];
                cheep.MsDuration *= 2;
                cheep.AdjustVelocities(velocityfactors[i]);
                cheep.Transpose(transpositions[i]);
                InsertInRest(cheep);
            }

            AlignObjectAtIndex(11, 12, 13, clytemnestra[123].MsPositionReTrk);
            AlignObjectAtIndex(21, 22, 23, clytemnestra[168].MsPositionReTrk);
        }
Ejemplo n.º 5
0
        private List<List<VoiceDef>> GetBars(Trk track, List<int> nChordsPerSystem)
        {
            List<Trk> consecutiveBars = new List<Trk>();
            // barlineMsPositions will contain both msPos=0 and the position of the final barline
            List<int> barlineMsPositions = new List<int>() { 0 };

            int trackIndex = 0;
            int msPositionReContainer = 0;
            foreach(int nChords in nChordsPerSystem)
            {
                Trk trk = new Trk(0, msPositionReContainer, new List<IUniqueDef>());
                for(int i = 0; i < nChords; ++i)
                {
                    trk.Add(track[trackIndex++]);
                }
                msPositionReContainer = trk.EndMsPositionReFirstIUD;
                barlineMsPositions.Add(msPositionReContainer);
                consecutiveBars.Add(trk);
            }

            List<List<VoiceDef>> bars = new List<List<VoiceDef>>();
            foreach(Trk trk in consecutiveBars)
            {
                List<VoiceDef> bar = new List<VoiceDef>() { trk };
                bars.Add(bar);
            }

            return bars;
        }
Ejemplo n.º 6
0
        internal void AdjustAlignments(Furies1 f1, Furies2 f2, Furies4 f4, Clytemnestra c, Trk wind1)
        {
            AlignObjectAtIndex(147, 150, 158, f1[56].MsPositionReTrk);
            AlignObjectAtIndex(150, 158, 170, f1[61].MsPositionReTrk);
            AlignObjectAtIndex(158, 170, 175, c[174].MsPositionReTrk);
            AlignObjectAtIndex(170, 176, 183, c[184].MsPositionReTrk);
            AlignObjectAtIndex(175, 183, 212, c[196].MsPositionReTrk);
            AlignObjectAtIndex(183, 212, 217, c[242].MsPositionReTrk);
            AlignObjectAtIndex(212, 217, 218, c[254].MsPositionReTrk);
            AlignObjectAtIndex(217, 218, 224, c[259].MsPositionReTrk);
            AlignObjectAtIndex(218, 224, 290, wind1[57].MsPositionReTrk);
            AlignObjectAtIndex(224, 290, 296, f4[49].MsPositionReTrk);
            AlignObjectAtIndex(290, 296, 318, wind1[66].MsPositionReTrk);
            AlignObjectAtIndex(296, 318, 344, f4[53].MsPositionReTrk);
            AlignObjectAtIndex(318, 344, 350, c[283].MsPositionReTrk);
            AlignObjectAtIndex(344, 350, 353, c[287].MsPositionReTrk);
            AlignObjectAtIndex(350, 353, 354, c[288].MsPositionReTrk - 200);
            AlignObjectAtIndex(353, 354, 390, f4[59].MsPositionReTrk);
            AlignObjectAtIndex(354, 390, 401, f4[69].MsPositionReTrk);

            // final adjustments for R2M
            AlignObjectAtIndex(139, 140, 141, c[119].MsPositionReTrk - 200);

            AlignObjectAtIndex(141, 142, 143, c[140].MsPositionReTrk - 100);

            AlignObjectAtIndex(143, 144, 145, c[152].MsPositionReTrk - 200);
            AlignObjectAtIndex(145, 146, 147, c[173].MsPositionReTrk - 200);
            AlignObjectAtIndex(146, 147, 152, f2[64].MsPositionReTrk);

            AlignObjectAtIndex(147, 151, 152, f1[56].MsPositionReTrk - 100);

            AlignObjectAtIndex(152, 159, 160, f1[61].MsPositionReTrk - 100);

            AlignObjectAtIndex(160, 171, 172, c[174].MsPositionReTrk - 600);
            AlignObjectAtIndex(172, 176, 177, c[184].MsPositionReTrk - 200);
            AlignObjectAtIndex(212, 217, 218, c[254].MsPositionReTrk - 200);
            AlignObjectAtIndex(275, 291, 292, f4[49].MsPositionReTrk - 200);

            // example code from furies2
            //AlignObjectAtIndex(58, 85, 100, f1[73].MsPosition);
            //AlignObjectAtIndex(85, 100, 106, c[204].MsPosition);
            //AlignObjectAtIndex(100, 106, 125, c[216].MsPosition);
            //AlignObjectAtIndex(106, 125, 129, c[255].MsPosition);
            //AlignObjectAtIndex(125, 129, 131, f1[115].MsPosition);
            //AlignObjectAtIndex(129, 131, 135, c[268].MsPosition);
            //AlignObjectAtIndex(131, 135, 141, f1[122].MsPosition);
            //AlignObjectAtIndex(135, 141, 157, f1[123].MsPosition);
            //AlignObjectAtIndex(141, 157, 164, f1[138].MsPosition);
            //AlignObjectAtIndex(157, 164, 169, f4[46].MsPosition);
            //AlignObjectAtIndex(164, 169, 214, f4[47].MsPosition);
            //AlignObjectAtIndex(169, 214, 217, c[269].MsPosition);
            //AlignObjectAtIndex(214, 217, 219, c[277].MsPosition);
            //AlignObjectAtIndex(217, 219, 229, c[278].MsPosition);
            //AlignObjectAtIndex(219, 229, 232, c[287].MsPosition);
            //AlignObjectAtIndex(229, 232, 233, c[288].MsPosition);
            //AlignObjectAtIndex(232, 233, 256, c[289].MsPosition);
            //AlignObjectAtIndex(233, 256, this.Count - 2, f1[248].MsPosition);
        }
Ejemplo n.º 7
0
 internal Clytemnestra(int midiChannel, Trk wind3)
     : base(midiChannel, new List<IUniqueDef>())
 {
     SetMomentDefsListPerVerse();
     SetUniqueDefs(wind3);
     // There are no pitchWheel commands in the score.
     // They can be created by a live performer
     SetPitchWheelDeviation(1, 60, 1);    // verse 1
     SetPitchWheelDeviation(60, 117, 2);  // verse 2
     SetPitchWheelDeviation(117, 174, 4); // verse 3
     SetPitchWheelDeviation(174, 269, 5); // verse 4
     SetPitchWheelDeviation(269, _uniqueDefs.Count, 6); // verse 5
 }
Ejemplo n.º 8
0
        /// <summary>
        /// A Block contains a list of VoiceDefs consisting of a group of Trks followed by InputVoiceDefs.
        /// This constructor creates a MainBlock consisting of the concatenation of the Blocks in the argument blockList.
        /// The initialClefs are set to the clefs in initialClefsPerChannel.
        /// initialClefsPerChannel contains the clefs for the Trks followed by the clefs for the clefs for the InputVoiceDefs.
        /// Note that initialClefsPerChannel contains a clef for each channel, regardless of whether it is going to be printed or not. 
        /// The channels for both Trks and InputVoiceDefs are in ascending order. Their order from top to bottom in the score is determined later.
        /// </summary>
        /// <param name="initialClefPerChannel">The clefs to set at the start of each Trk followed by the clefs for each InputVoiceDef</param>
        /// <param name="blockList">A list of Blocks that will be concatenated to become this MainBlock.</param>
        public MainBlock(List<string> initialClefPerChannel, List<Block> blockList)
            : base()
        {
            Debug.Assert(blockList != null && blockList.Count > 0);

            Block block1 = blockList[0];
            int nTrks = block1.Trks.Count;
            int nInputVoiceDefs = block1.InputVoiceDefs.Count;

            #region conditions
            Debug.Assert(initialClefPerChannel.Count == (nTrks + nInputVoiceDefs));
            foreach(Block block in blockList)
            {
                Debug.Assert(block.Trks.Count == nTrks);
                Debug.Assert(block.InputVoiceDefs.Count == nInputVoiceDefs);
                for(int trkIndex = 0; trkIndex < nTrks; ++trkIndex)
                {
                    // Achtung: Trk midiChannels are those defined in the algorithm's MidiChannelIndexPerOutputVoice.
                    // The output channels must be in ascending oder, **_but_do_not_need_to_be_contiguous_**.
                    // See comment at CompositionAlgorithm.MidiChannelIndexPerOutputVoice.
                    Debug.Assert(block.Trks[trkIndex].MidiChannel == block1.Trks[trkIndex].MidiChannel);
                }
                for(int ivdIndex = 0; ivdIndex < nInputVoiceDefs; ++ivdIndex)
                {
                    // Input channels are in ascending order, starting at 0, and are contiguous.
                    Debug.Assert(block.Trks[ivdIndex].MidiChannel == ivdIndex);
                }
            }
            #endregion conditions

            for(int i = 0; i < nTrks; ++i)
            {
                int channel = block1.Trks[i].MidiChannel;
                VoiceDef trk = new Trk(channel);
                trk.Add(new ClefChangeDef(initialClefPerChannel[channel], 0));
                _voiceDefs.Add(trk);
            }

            int inputVoiceIndex = Trks.Count;
            for(int i = 0; i < nInputVoiceDefs; ++i)
            {
                VoiceDef inputVoiceDef = new InputVoiceDef(i);
                inputVoiceDef.Add(new ClefChangeDef(initialClefPerChannel[inputVoiceIndex++], 0));
                _voiceDefs.Add(inputVoiceDef);
            }

            foreach(Block block in blockList)
            {
                this.Concat(block);
            }
        }
Ejemplo n.º 9
0
        private Trk GetWind1(int midiChannel, Trk wind3, Trk wind2, Clytemnestra clytemnestra)
        {
            List<IUniqueDef> clytLmdds = clytemnestra.UniqueDefs;
            int rotationMsPosition = clytLmdds[116].MsPositionReTrk + 700;

            Trk wind1 = GetRotatedWind(midiChannel, wind3, rotationMsPosition);
            wind1.Transpose(0, wind1.Count, 19);
            wind1.StepwiseGliss(0, 25, 12);
            wind1.Transpose(25, wind1.Count, 12);

            wind1.AlignObjectAtIndex(0, 15, 82, wind2[15].MsPositionReTrk);
            wind1.AlignObjectAtIndex(15, 25, 82, rotationMsPosition);
            wind1.AlignObjectAtIndex(25, 74, 82, clytLmdds[289].MsPositionReTrk);

            return wind1;
        }
Ejemplo n.º 10
0
        private Trk GetWind2(int midiChannel, Trk wind3, Clytemnestra clytemnestra)
        {
            List<IUniqueDef> clytLmdds = clytemnestra.UniqueDefs;
            int rotationMsPosition = clytLmdds[59].MsPositionReTrk + 700;

            Trk wind2 = GetRotatedWind(midiChannel, wind3, rotationMsPosition);
            wind2.Transpose(0, wind2.Count, 12);

            wind2.StepwiseGliss(0, 15, 7);
            wind2.Transpose(15, wind2.Count, 7);

            wind2.StepwiseGliss(75, wind2.Count, 12);

            wind2.AlignObjectAtIndex(0, 15, 82, rotationMsPosition);
            wind2.AlignObjectAtIndex(15, 39, 82, clytLmdds[173].MsPositionReTrk);
            wind2.AlignObjectAtIndex(39, 57, 82, clytLmdds[268].MsPositionReTrk);

            return wind2;
        }
Ejemplo n.º 11
0
        /// <summary>
        /// trks.Count must be less than or equal to midiChannelIndexPerOutputVoice.Count. (See trks parameter comment.)
        /// </summary>
        /// <param name="absSeqMsPosition">Must be greater than or equal to zero.</param>
        /// <param name="trks">Each Trk must have a constructed UniqueDefs list which is either empty, or contains any
        /// combination of RestDef or MidiChordDef. Each trk.MidiChannel must be unique and present in the
        /// midiChannelIndexPerOutputVoice list. Not all the Seq's channels need to be given an explicit Trk in the trks
        /// argument. The seq will be given empty (default) Trks for the channels that are missing.
        /// The MsPositionReContainer field in each argument trk can have any value, but the Seq is Normalized
        /// by this constructor.</param>
        /// <param name="barlineMsPositionsReSeq">Can be null or empty. All barlineMsPositions must be unique, in ascending order, and less than or equal to the final msDuration of the Seq.</param>
        /// <param name="midiChannelIndexPerOutputVoice">The Seq will contain one trk for each channel in this list.</param>
        public Seq(int absSeqMsPosition, List<Trk> trks, IReadOnlyList<int> midiChannelIndexPerOutputVoice)
        {
            #region conditions
            Debug.Assert(absSeqMsPosition >= 0);
            for(int i = 0; i < trks.Count - 1; ++i)
            {
                for(int j = i + 1; j < trks.Count; ++j)
                {
                    Debug.Assert(trks[i].MidiChannel != trks[j].MidiChannel);
                }
            }
            #endregion conditions

            _absMsPosition = absSeqMsPosition;

            foreach(int channel in midiChannelIndexPerOutputVoice)
            {
                Trk newTrk = null;
                foreach(Trk trk in trks)
                {
                    if(trk.MidiChannel == channel)
                    {
                        newTrk = trk;
                        break;
                    }
                }
                if(newTrk == null)
                {
                    newTrk = new Trk(channel);
                }
                newTrk.Container = this;
                _trks.Add(newTrk);
            }

            Normalize();

            AssertChannelConsistency(midiChannelIndexPerOutputVoice);
            AssertSeqConsistency();
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Returns a VoiceDef containing clones of the UniqueDefs in the originalVoiceDef argument,
        /// rotated so that the original first IUniqueDef is positioned close to rotationMsPosition.
        /// </summary>
        /// <param name="originalVoiceDef"></param>
        /// <returns></returns>
        private Trk GetRotatedWind(int midiChannel, Trk originalVoiceDef, int rotationMsPosition)
        {
            Trk tempWind = originalVoiceDef.Clone();
            tempWind.MidiChannel = midiChannel;

            int finalBarlineMsPosition = originalVoiceDef.EndMsPosition;
            int msDurationAfterSynch = finalBarlineMsPosition - rotationMsPosition;

            List<IUniqueDef> originalLmdds = tempWind.UniqueDefs;
            List<IUniqueDef> originalStartLmdds = new List<IUniqueDef>();
            List<IUniqueDef> newWindLmdds = new List<IUniqueDef>();
            int accumulatingMsDuration = 0;
            for(int i = 0; i < tempWind.Count; ++i)
            {
                if(accumulatingMsDuration < msDurationAfterSynch)
                {
                    originalStartLmdds.Add(originalLmdds[i]);
                    accumulatingMsDuration += originalLmdds[i].MsDuration;
                }
                else
                {
                    newWindLmdds.Add(originalLmdds[i]);
                }
            }
            newWindLmdds.AddRange(originalStartLmdds);

            int msPosition = 0;
            foreach(IUniqueDef iu in newWindLmdds)
            {
                iu.MsPositionReTrk = msPosition;
                msPosition += iu.MsDuration;
            }
            Trk newRotatedWind = new Trk(midiChannel, newWindLmdds);

            return newRotatedWind;
        }
Ejemplo n.º 13
0
 internal void GetBeforeInterlude3(Clytemnestra clytemnestra, Trk wind1, Trk furies3, List<Palette> _palettes)
 {
     GetFuries2Interlude2(clytemnestra, wind1, furies3);
     AddFuries2ChirpsForInterlude2AndVerse3(clytemnestra, wind1, _palettes[7]);
 }
Ejemplo n.º 14
0
        private void Transform(Trk section, Dictionary<string, int> msPositions, List<int> strandIndices)
        {
            List<int> strandDurations = GetStrandDurations(section, strandIndices);

            int extraTime = 750;
            int diff = extraTime / section.Count;
            for(int i = section.Count - 1; i > 0; --i)
            {
                if(strandIndices.Contains(i))
                {
                    RestDef umrd = new RestDef(section[i].MsPositionReTrk, strandDurations[strandIndices.IndexOf(i)] + extraTime);
                    extraTime -= diff;
                    section.Insert(i, umrd);
                }
            }

            section.MsPositionReSeq = msPositions["furies2FinaleStart"];

            //double factor = 10;

            //section.AdjustMsDurations(factor);

            section.CreateAccel(0, section.Count, 0.25);

            //section.RemoveBetweenMsPositions(msPositions["interlude4End"], int.MaxValue);
            section.RemoveBetweenMsPositions(msPositions["finalWindChord"], int.MaxValue);

            if(section[section.Count - 1] is RestDef)
            {
                //section[section.Count - 1].MsDuration = msPositions["interlude4End"] - section[section.Count - 1].MsPosition;
                section[section.Count - 1].MsDuration = msPositions["endOfPiece"] - section[section.Count - 1].MsPositionReTrk;
            }
        }
Ejemplo n.º 15
0
 /// <summary>
 /// voiceDef contains the MidiChordDefs defined by a krystal, and nothing else.
 /// </summary>
 /// <param name="voiceDef"></param>
 /// <param name="strandIndices"></param>
 /// <returns></returns>
 private List<int> GetStrandDurations(Trk voiceDef, List<int> strandIndices)
 {
     List<int> strandDurations = new List<int>();
     int duration;
     for(int i = 1; i < strandIndices.Count; ++i)
     {
         duration = 0;
         for(int j = strandIndices[i - 1]; j < strandIndices[i]; ++j)
         {
             duration += voiceDef[j].MsDuration;
         }
         strandDurations.Add(duration);
     }
     duration = 0;
     for(int i = strandIndices[strandIndices.Count - 1]; i < voiceDef.Count; ++i)
     {
         duration += voiceDef[i].MsDuration;
     }
     strandDurations.Add(duration);
     return strandDurations;
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Steals the ticks from furies 3, then agglommerates the remaining rests in furies3...
        /// </summary>
        private void GetFuries2Interlude2(Clytemnestra clytemnestra, Trk wind1, Trk furies3)
        {
            List<int> furies3TickIndices = new List<int>()
            {
                66,70,74,81,85,89,93,
                96,100,104,109,113,117,122,
                126,130,135,139,143,148,152
            };
            for(int i = 0; i < furies3TickIndices.Count; ++i)
            {
                int f3Index = furies3TickIndices[i];
                MidiChordDef ticksChord = furies3[f3Index] as MidiChordDef;
                Debug.Assert(ticksChord != null);
                RestDef ticksRest = new RestDef(ticksChord.MsPositionReTrk, ticksChord.MsDuration);
                furies3.Replace(f3Index, ticksRest);
                InsertInRest(ticksChord);
            }

            MidiChordDef lastTicksBeforeVerse3 = (MidiChordDef)((MidiChordDef)this[39]).Clone();
            lastTicksBeforeVerse3.MsPositionReTrk = furies3[155].MsPositionReTrk + furies3[155].MsDuration;
            lastTicksBeforeVerse3.MsDuration = clytemnestra[117].MsPositionReTrk - lastTicksBeforeVerse3.MsPositionReTrk;
            lastTicksBeforeVerse3.Transpose(10);
            InsertInRest(lastTicksBeforeVerse3);

            furies3.AgglomerateRests();
        }
Ejemplo n.º 17
0
        /// <summary>
        /// ACHTUNG: this function should be in a furies class. It is used by furies 2 and furies 4 (probably furies 3 too!)
        /// The three argument VoiceDefs are parallel. They have the same number of DurationDefs, each having the same MsPosition
        /// and MsDuration. The DurationDefs come from different palettes, so can otherwise have different parameters.
        /// This function simply creates a new VoiceDef by selecting the apropriate DurationDefs from each VoiceDef argument.
        /// </summary>
        private Trk GetFinaleSections(Trk finalePart1, Trk finalePart2, Trk postlude, int part2Index, int postludeIndex)
        {
            List<IUniqueDef> iumdds = new List<IUniqueDef>();

            for(int i = 0; i < part2Index; ++i)
            {
                iumdds.Add(finalePart1[i]);
            }
            for(int i = part2Index; i < postludeIndex; ++i)
            {
                iumdds.Add(finalePart2[i]);
            }
            for(int i = postludeIndex; i < postlude.Count; ++i)
            {
                iumdds.Add(postlude[i]);
            }

            return new Trk(this.MidiChannel, iumdds);
        }
Ejemplo n.º 18
0
        private void AddFuries2ChirpsForInterlude2AndVerse3(Clytemnestra clytemnestra, Trk wind1, Palette chirpsPalette)
        {
            int[] chirpIndices = { 4, 6, 10, 0, 1, 3, 5, 7, 9, 11 };
            int[] transpositions = { 2, 0, 4, 11, 5, 10, 6, 9, 7, 8 };
            double[] velocityfactors = { 0.32, 0.3, 0.35, 0.45, 0.36, 0.43, 0.37, 0.42, 0.39, 0.4 };
            IUniqueDef c3 = chirpsPalette.UniqueDurationDef(chirpIndices[3]);
            IUniqueDef c7 = chirpsPalette.UniqueDurationDef(chirpIndices[7]);
            int[] msPositions =
            {
                this[2].MsPositionReTrk,
                this[6].MsPositionReTrk,
                this[16].MsPositionReTrk,
                this[26].MsPositionReTrk,
                this[26].MsPositionReTrk + c3.MsDuration,
                clytemnestra[129].MsPositionReTrk,
                clytemnestra[143].MsPositionReTrk + 110,
                clytemnestra[156].MsPositionReTrk + 220,
                clytemnestra[156].MsPositionReTrk + 220 + c7.MsDuration,
                clytemnestra[168].MsPositionReTrk + 330,
            };
            for(int i = 9; i >=0 ; --i)
            {
                MidiChordDef cheep = chirpsPalette.MidiChordDef(chirpIndices[i]);
                cheep.MsPositionReTrk = msPositions[i];
                //cheep.MsDuration *= 2;
                cheep.AdjustVelocities(velocityfactors[i]);
                cheep.Transpose(transpositions[i]);
                InsertInRest(cheep);
            }

            AlignObjectAtIndex(50, 51, 52, clytemnestra[130].MsPositionReTrk);
            AlignObjectAtIndex(55, 56, 57, clytemnestra[159].MsPositionReTrk);

            AgglomerateRestOrChordAt(31);
        }
Ejemplo n.º 19
0
 private void AdjustWindPitchWheelDeviations(Trk wind)
 {
     byte versePwdValue = 3;
     double windStartPwdValue = 6, windEndPwdValue=28;
     double pwdfactor = Math.Pow(windEndPwdValue/windStartPwdValue, (double)1/5); // 5th root of windEndPwdValue/windStartPwdValue -- the last pwd should be windEndPwdValue
     MidiChordDef umcd = null;
     for(int i = 0; i < wind.Count; ++i)
     {
         if(i < 8) //prelude
         {
             umcd = wind[i] as MidiChordDef;
             if(umcd != null)
                 umcd.PitchWheelDeviation = M.MidiValue((int) windStartPwdValue);
         }
         else if(i < 15) // verse 1
         {
             umcd = wind[i] as MidiChordDef;
             if(umcd != null)
                 umcd.PitchWheelDeviation = versePwdValue;
         }
         else if(i < 20) // interlude 1
         {
             umcd = wind[i] as MidiChordDef;
             if(umcd != null)
                 umcd.PitchWheelDeviation = M.MidiValue((int)(windStartPwdValue * pwdfactor));
         }
         else if(i < 24) // verse 2
         {
             umcd = wind[i] as MidiChordDef;
             if(umcd != null)
                 umcd.PitchWheelDeviation = versePwdValue;
         }
         else if(i < 33) // interlude 2
         {
             umcd = wind[i] as MidiChordDef;
             if(umcd != null)
                 umcd.PitchWheelDeviation = M.MidiValue((int)(windStartPwdValue * (Math.Pow(pwdfactor, 2))));
         }
         else if(i < 39) // verse 3
         {
             umcd = wind[i] as MidiChordDef;
             if(umcd != null)
                 umcd.PitchWheelDeviation = versePwdValue;
         }
         else if(i < 49) // interlude 3
         {
             umcd = wind[i] as MidiChordDef;
             if(umcd != null)
                 umcd.PitchWheelDeviation = M.MidiValue((int)(windStartPwdValue * (Math.Pow(pwdfactor, 3))));
         }
         else if(i < 57) // verse 4
         {
             umcd = wind[i] as MidiChordDef;
             if(umcd != null)
                 umcd.PitchWheelDeviation = versePwdValue;
         }
         else if(i < 70) // interlude 4
         {
             umcd = wind[i] as MidiChordDef;
             if(umcd != null)
                 umcd.PitchWheelDeviation = M.MidiValue((int)(windStartPwdValue * (Math.Pow(pwdfactor, 4))));
         }
         else if(i < 74) // verse 5
         {
             umcd = wind[i] as MidiChordDef;
             if(umcd != null)
                 umcd.PitchWheelDeviation = versePwdValue;
         }
         else // postlude
         {
             umcd = wind[i] as MidiChordDef;
             if(umcd != null)
                 umcd.PitchWheelDeviation = M.MidiValue((int)(windStartPwdValue * (Math.Pow(pwdfactor, 5))));
         }
     }
 }
Ejemplo n.º 20
0
        private void Transform(Trk section, Dictionary<string, int> msPositions)
        {
            section.RemoveRange(40, section.Count - 40);

            section.MsPositionReSeq = msPositions["interlude4"];

            //double factor = 10;

            //section.AdjustMsDurations(factor);

            section.CreateAccel(0, section.Count, 0.08);

            //section.RemoveBetweenMsPositions(msPositions["interlude4End"], int.MaxValue);
            section.RemoveBetweenMsPositions(msPositions["finalWindChord"], int.MaxValue);

            if(section[section.Count - 1] is RestDef)
            {
                //section[section.Count - 1].MsDuration = msPositions["interlude4End"] - section[section.Count - 1].MsPosition;
                section[section.Count - 1].MsDuration = msPositions["endOfPiece"] - section[section.Count - 1].MsPositionReTrk;
            }
        }
Ejemplo n.º 21
0
        private void GetSnores(int firstRestMsDuration, Clytemnestra clytemnestra, Trk wind1, Palette snoresPalette)
        {
            List<IUniqueDef> snores = new List<IUniqueDef>();
            int msPosition = 0;

            IUniqueDef firstRest = new RestDef(msPosition, firstRestMsDuration);
            snores.Add(firstRest);
            msPosition += firstRestMsDuration;

            #region prelude + verse1
            int[] transpositions1 = { 0, 0, 0, 0, 0, 1, 0 };
            for(int i = 0; i < 7; ++i)
            {
                IUniqueDef snore = snoresPalette.UniqueDurationDef(i);
                snore.MsPositionReTrk = msPosition;
                msPosition += snore.MsDuration;
                MidiChordDef iumdd = snore as MidiChordDef;
                if(iumdd != null)
                {
                    iumdd.Transpose(transpositions1[i]);
                    iumdd.PitchWheelDeviation = 3;
                }
                snores.Add(snore);

                RestDef rest = new RestDef(msPosition, 2500);
                msPosition += rest.MsDuration;
                snores.Add(rest);
            }
            #endregion

            double factor;
            double msDuration;
            double restDuration;
            int[] transpositions2 = { 1, 1, 2, 2, 3, 3, 4, 4, 5, 5 };
            double[] factors = { 0.93, 0.865, 0.804, 0.748, 0.696, 0.647, 0.602, 0.56, 0.52, 0.484 };
            for(int i = 0; i < 10; ++i)
            {
                IUniqueDef snore = snoresPalette.UniqueDurationDef(i / 2);
                snore.MsPositionReTrk = msPosition;
                factor = factors[i];
                msDuration = snore.MsDuration * factor;
                snore.MsDuration = (int)msDuration;
                msPosition += snore.MsDuration;
                MidiChordDef iumdd = snore as MidiChordDef;
                if(iumdd != null)
                {
                    iumdd.Transpose(transpositions2[i]);
                    iumdd.PitchWheelDeviation = 20;
                }
                //iumdd.MidiVelocity = (byte)((double)snore.MidiVelocity * factor * factor);
                snores.Add(snore);

                restDuration = 2500 / factor;
                RestDef rest = new RestDef(msPosition, (int)restDuration);
                msPosition += rest.MsDuration;
                snores.Add(rest);
            }

            snores[snores.Count - 1].MsDuration = clytemnestra.EndMsPosition - snores[snores.Count - 1].MsPositionReTrk;

            this._uniqueDefs = snores;

            AdjustVelocitiesHairpin(13, Count, 0.25);

            #region alignments before Interlude3
            AlignObjectAtIndex(7, 8, 9, clytemnestra[3].MsPositionReTrk);
            AlignObjectAtIndex(8, 9, 10, clytemnestra[7].MsPositionReTrk);
            AlignObjectAtIndex(9, 10, 11, clytemnestra[16].MsPositionReTrk);
            AlignObjectAtIndex(10, 11, 12, clytemnestra[24].MsPositionReTrk);
            AlignObjectAtIndex(11, 12, 13, clytemnestra[39].MsPositionReTrk);
            AlignObjectAtIndex(12, 13, 14, clytemnestra[42].MsPositionReTrk);
            AlignObjectAtIndex(14, 34, Count, wind1[38].MsPositionReTrk); // rest at start of Interlude3
            #endregion

            RemoveScorePitchWheelCommands(0, 13); // pitchwheeldeviation is 20 for R2M
        }
Ejemplo n.º 22
0
 internal void GetBeforeInterlude3(int firstRestMsDuration, Clytemnestra clytemnestra, Trk wind1, List<Palette> palettes)
 {
     GetSnores(firstRestMsDuration, clytemnestra, wind1, palettes[1]);
     AddGrowlsToInterlude2AndVerse3(clytemnestra, palettes[3]);
 }
Ejemplo n.º 23
0
        /// <summary>
        /// This function simply converts its argument to a Trk having the given midiChannel.
        /// </summary>
        private Trk GrpListToTrk(List<Grp> grpList, int midiChannel)
        {
            Trk trk = new Trk(midiChannel, 0, new List<IUniqueDef>());
            foreach(Grp grp in grpList)
            {
                trk.AddRange(grp);
            }

            return trk;
        }
Ejemplo n.º 24
0
 private void AdjustWindVelocities(Trk wind1, Trk wind2, Trk wind3)
 {
     int beginInterlude2DimIndex = 25; // start of Interlude2
     int beginVerse3DimIndex = 31; // non-inclusive
     int beginVerse5CrescIndex = 70;
     int beginPostludeIndex = 74;
     wind1.AdjustVelocitiesHairpin(beginInterlude2DimIndex, beginVerse3DimIndex, 0.5);
     wind2.AdjustVelocitiesHairpin(beginInterlude2DimIndex, beginVerse3DimIndex, 0.5);
     wind3.AdjustVelocitiesHairpin(beginInterlude2DimIndex, beginVerse3DimIndex, 0.5);
     wind1.AdjustVelocitiesHairpin(beginVerse5CrescIndex, beginPostludeIndex, 2);
     wind2.AdjustVelocitiesHairpin(beginVerse5CrescIndex, beginPostludeIndex, 2);
     wind3.AdjustVelocitiesHairpin(beginVerse5CrescIndex, beginPostludeIndex, 2);
     wind1.AdjustVelocitiesHairpin(beginPostludeIndex, wind1.Count, 2.3);
     wind2.AdjustVelocitiesHairpin(beginPostludeIndex, wind2.Count, 2.3);
     wind3.AdjustVelocitiesHairpin(beginPostludeIndex, wind3.Count, 2.3);
 }
Ejemplo n.º 25
0
        private Trk GetTrack(byte[] trackChordNumbers, byte[] trackRootPitches)
        {
            Trk track = new Trk(0, 0, new List<IUniqueDef>());
            List<List<byte>> chordIntervals = GetChordIntervals();
            List<byte> chordVelocities = GetChordVelocities();
            List<int> chordDurations = GetChordMsDurations();

            int nChords = trackChordNumbers.GetLength(0);
            int chordMsPosition = 0;
            for(int i = 0; i < nChords; ++i)
            {
                byte chordNumber = trackChordNumbers[i];
                byte pitchNumber = trackRootPitches[i];

                IUniqueDef midiChordDef = GetMidiChordDef(chordIntervals[chordNumber - 1], chordVelocities[chordNumber - 1], chordDurations[chordNumber - 1], pitchNumber, chordMsPosition);
                chordMsPosition += midiChordDef.MsDuration;

                track.UniqueDefs.Add(midiChordDef);
            }

            return track;
        }
Ejemplo n.º 26
0
        internal void AdjustAlignments(Furies1 furies1, Clytemnestra clytemnestra, Trk wind3)
        {
            AlignObjectAtIndex(42, Count-1, Count, furies1[280].MsPositionReTrk);

            AlignObjectAtIndex(42, 43, 45, furies1[126].MsPositionReTrk);
            AlignObjectAtIndex(43, 45, 49, furies1[138].MsPositionReTrk);
            AlignObjectAtIndex(45, 49, 59, furies1[165].MsPositionReTrk);
            AlignObjectAtIndex(49, 59, 69, furies1[212].MsPositionReTrk);

            AlignObjectAtIndex(59, 69, Count-1, furies1[248].MsPositionReTrk);
        }
Ejemplo n.º 27
0
 /// <summary>
 /// The returned barlineMsPositions contain both the position of bar 1 (0ms) and the position of the final barline.
 /// </summary>
 private List<int> GetBarlineMsPositions(Trk fury1, Trk fury2, Trk fury3, Trk fury4, Clytemnestra clytemnestra, Trk wind1, Trk wind2, Trk wind3)
 {
     Trk f1 = fury1;
     Trk f2 = fury2;
     Trk f3 = fury3;
     Trk f4 = fury4;
     Clytemnestra c = clytemnestra;
     Trk w1 = wind1;
     Trk w2 = wind2;
     Trk w3 = wind3;
     List<int> barlineMsPositions = new List<int>()
     {
         #region msPositions
         #region intro
         0,
         w3[1].MsPositionReTrk,
         w3[3].MsPositionReTrk,
         w3[5].MsPositionReTrk,
         #endregion
         #region verse 1
         c[1].MsPositionReTrk,
         c[3].MsPositionReTrk,
         c[8].MsPositionReTrk,
         c[12].MsPositionReTrk,
         c[15].MsPositionReTrk,
         c[18].MsPositionReTrk,
         c[22].MsPositionReTrk,
         c[27].MsPositionReTrk,
         c[34].MsPositionReTrk,
         c[38].MsPositionReTrk,
         c[41].MsPositionReTrk,
         c[47].MsPositionReTrk,
         c[49].MsPositionReTrk,
         c[50].MsPositionReTrk,
         c[54].MsPositionReTrk,
         c[58].MsPositionReTrk,
         #endregion
         #region interlude after verse 1
         w2[15].MsPositionReTrk,
         w2[16].MsPositionReTrk,
         w2[18].MsPositionReTrk,
         #endregion
         #region verse 2
         c[60].MsPositionReTrk,
         c[62].MsPositionReTrk,
         c[67].MsPositionReTrk,
         c[71].MsPositionReTrk,
         c[73].MsPositionReTrk,
         c[77].MsPositionReTrk,
         c[81].MsPositionReTrk,
         c[86].MsPositionReTrk,
         c[88].MsPositionReTrk,
         c[92].MsPositionReTrk,
         c[94].MsPositionReTrk,
         c[97].MsPositionReTrk,
         c[100].MsPositionReTrk,
         c[104].MsPositionReTrk,
         c[107].MsPositionReTrk,
         c[111].MsPositionReTrk,
         c[115].MsPositionReTrk,
         #endregion
         #region interlude after verse 2
         w1[25].MsPositionReTrk,
         w1[26].MsPositionReTrk,
         w1[28].MsPositionReTrk,
         w1[30].MsPositionReTrk,
         #endregion
         #region verse 3
         c[117].MsPositionReTrk,
         c[119].MsPositionReTrk,
         c[124].MsPositionReTrk,
         c[126].MsPositionReTrk,
         c[128].MsPositionReTrk,
         c[131].MsPositionReTrk,
         c[135].MsPositionReTrk,
         c[139].MsPositionReTrk,
         c[141].MsPositionReTrk,
         c[146].MsPositionReTrk,
         c[148].MsPositionReTrk,
         c[152].MsPositionReTrk,
         c[159].MsPositionReTrk,
         c[164].MsPositionReTrk,
         c[168].MsPositionReTrk,
         c[172].MsPositionReTrk,
         #endregion
         #region interlude after verse 3
         w1[38].MsPositionReTrk,
         w3[40].MsPositionReTrk,
         w3[42].MsPositionReTrk,
         w3[44].MsPositionReTrk,
         w3[45].MsPositionReTrk,
         w3[47].MsPositionReTrk,
         #endregion
         #region verse 4, Oft have ye...
         c[174].MsPositionReTrk,
         c[177].MsPositionReTrk,
         c[183].MsPositionReTrk,
         c[185].MsPositionReTrk,
         c[192].MsPositionReTrk,
         c[196].MsPositionReTrk,
         c[204].MsPositionReTrk,
         c[206].MsPositionReTrk,
         c[214].MsPositionReTrk,
         c[219].MsPositionReTrk,
         c[221].MsPositionReTrk,
         c[225].MsPositionReTrk,
         c[227].MsPositionReTrk,
         c[229].MsPositionReTrk,
         c[233].MsPositionReTrk,
         c[236].MsPositionReTrk,
         c[242].MsPositionReTrk,
         c[252].MsPositionReTrk,
         c[257].MsPositionReTrk,
         c[259].MsPositionReTrk,
         c[263].MsPositionReTrk,
         c[267].MsPositionReTrk,
         c[268].MsPositionReTrk, // new bar 89
         #endregion
         #region interlude after verse 4
         w1[57].MsPositionReTrk,
         w3[59].MsPositionReTrk,
         f4[45].MsPositionReTrk, // was w3[61].MsPosition,
         w3[63].MsPositionReTrk,
         w2[65].MsPositionReTrk, // was w3[65].MsPosition,
         w1[66].MsPositionReTrk, // w3[67].MsPosition,
         w1[68].MsPositionReTrk,
         #endregion
         #region verse 5
         c[269].MsPositionReTrk,
         c[270].MsPositionReTrk,
         c[272].MsPositionReTrk,
         c[276].MsPositionReTrk,
         c[279].MsPositionReTrk,
         c[283].MsPositionReTrk,
         c[288].MsPositionReTrk,
         #endregion
         #region postlude
         c[289].MsPositionReTrk,
         f1[248].MsPositionReTrk,
         f1[280].MsPositionReTrk, // new bar 105
         #endregion
         // final barline
         w3.EndMsPosition
         #endregion
     };
     Debug.Assert(barlineMsPositions.Count == NumberOfBars + 1); // includes bar 1 (mPos=0) and the final barline.
     return barlineMsPositions;
 }
Ejemplo n.º 28
0
 private void AdjustFinalWindChordPosition(Trk wind1, Trk wind2, Trk wind3)
 {
     wind1.AlignObjectAtIndex(71, 81, 82, wind1[81].MsPositionReTrk - (wind1[81].MsDuration / 2));
     wind2.AlignObjectAtIndex(71, 81, 82, wind2[81].MsPositionReTrk - (wind2[81].MsDuration / 2));
     wind3.AlignObjectAtIndex(71, 81, 82, wind3[81].MsPositionReTrk - (wind3[81].MsDuration / 2));
 }
Ejemplo n.º 29
0
        private List<Trk> GetTrks(int upperChannel, List<int> upperTrackPitches, int lowerChannel, List<int> lowerTrackPitches, List<List<int>> durations)
        {
            List<IUniqueDef> t1MidiChordDefs = GetMidiChordDefs(upperTrackPitches, durations[0]);
            Trk trk1 = new Trk((byte)upperChannel, 0, t1MidiChordDefs);

            List<IUniqueDef> t6MidiChordDefs = GetMidiChordDefs(lowerTrackPitches, durations[1]);
            Trk trk6 = new Trk((byte)lowerChannel, 0, t6MidiChordDefs);

            List<Trk> trks = new List<Trk>();
            trks.Add(trk1);
            trks.Add(trk6);

            return trks;
        }
Ejemplo n.º 30
0
        public Trk NewTrk(int midiChannel, int msPositionReContainer, List<int> sequence)
        {
            List<IUniqueDef> iuds = new List<IUniqueDef>();
            int msPositionReFirstIUD = 0;
            foreach(int value in sequence)
            {
                Debug.Assert((value > 0 && value <= this.Count), "Illegal argument: value out of range in sequence");

                IUniqueDef iumdd = this.UniqueDurationDef(value - 1);
                iumdd.MsPositionReFirstUD = msPositionReFirstIUD;
                msPositionReFirstIUD += iumdd.MsDuration;
                iuds.Add(iumdd);
            }
            Trk trkDef = new Trk(midiChannel, msPositionReContainer, iuds);
            return trkDef;
        }