Beispiel #1
0
        internal void GetBeforeInterlude3(Clytemnestra clytemnestra, TrkDef wind1, TrkDef 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].MsPosition + 200,
                furies2[12].MsPosition + 100,
                furies2[24].MsPosition + 300,
                furies2[30].MsPosition + 400,
                furies2[40].MsPosition + 500,
                clytemnestra[122].MsPosition,
                clytemnestra[132].MsPosition + 110,
                clytemnestra[141].MsPosition + 220,
                clytemnestra[150].MsPosition + 330,
                clytemnestra[158].MsPosition + 440,
                clytemnestra[164].MsPosition + 550,
                clytemnestra[173].MsPosition,
            };
            for (int i = 0; i < cheepsPalette.Count; ++i)
            {
                MidiChordDef cheep = cheepsPalette.UniqueDurationDef(cheepIndices[i]) as MidiChordDef;
                Debug.Assert(cheep != null);
                cheep.MsPosition  = msPositions[i];
                cheep.MsDuration *= 2;
                cheep.AdjustVelocities(velocityfactors[i]);
                cheep.Transpose(transpositions[i]);
                InsertInRest(cheep);
            }

            AlignObjectAtIndex(11, 12, 13, clytemnestra[123].MsPosition);
            AlignObjectAtIndex(21, 22, 23, clytemnestra[168].MsPosition);
        }
Beispiel #2
0
        private TrkDef GetFlutter1(Palette palette)
        {
            List <IUniqueDef> flutter1 = new List <IUniqueDef>();
            int msPosition             = 0;

            for (int i = 0; i < 7; ++i)
            {
                int[]      contour = K.Contour(7, 11, 7);
                IUniqueDef flutter = palette.UniqueDurationDef(contour[i] - 1);
                flutter.MsPosition = msPosition;
                msPosition        += flutter.MsDuration;
                flutter1.Add(flutter);

                if (i != 3 && i != 5)
                {
                    RestDef rest = new RestDef(msPosition, flutter.MsDuration);
                    msPosition += rest.MsDuration;
                    flutter1.Add(rest);
                }
            }

            TrkDef furies3FlutterSequence1 = new TrkDef(this.MidiChannel, flutter1);

            return(furies3FlutterSequence1);
        }
Beispiel #3
0
        private TrkDef GetF1FinalePart2(Palette f1FinalePalette2, Krystal krystal, List <int> strandIndices, Dictionary <string, int> msPositions)
        {
            TrkDef f1FinalePart2 = f1FinalePalette2.NewTrkDef(this.MidiChannel, krystal);

            List <int> f1eStrandDurations = GetStrandDurations(f1FinalePart2, strandIndices);

            int extraTime = 500;
            int diff      = extraTime / f1FinalePart2.Count;

            for (int i = f1FinalePart2.Count - 1; i > 0; --i)
            {
                if (strandIndices.Contains(i))
                {
                    RestDef umrd = new RestDef(f1FinalePart2[i].MsPosition, f1eStrandDurations[strandIndices.IndexOf(i)] + extraTime);
                    extraTime -= diff;
                    f1FinalePart2.Insert(i, umrd);
                }
            }

            f1FinalePart2.StartMsPosition = msPositions["verse4EsCaped"];
            f1FinalePart2.RemoveBetweenMsPositions(msPositions["verse5Calls"], int.MaxValue);

            if (f1FinalePart2[f1FinalePart2.Count - 1] is RestDef)
            {
                f1FinalePart2[f1FinalePart2.Count - 1].MsDuration = msPositions["postlude"] - f1FinalePart2[f1FinalePart2.Count - 1].MsPosition;
            }

            return(f1FinalePart2);
        }
Beispiel #4
0
 private TrkDef GetWind3(byte midiChannel, Palette palette, Krystal krystal)
 {
     TrkDef wind3 = palette.NewTrkDef(midiChannel, krystal);
     wind3.Transpose(0, wind3.Count, -13);
     wind3.StepwiseGliss(74, wind3.Count, 19);
     return wind3;
 }
Beispiel #5
0
        private TrkDef GetF1FinalePart1(Palette palette, Krystal krystal, List <int> strandIndices, Dictionary <string, int> msPositions)
        {
            TrkDef f1FinalePart1 = palette.NewTrkDef(0, krystal);

            List <int> f1eStrandDurations = GetStrandDurations(f1FinalePart1, strandIndices);

            int extraTime = 1000;
            int diff      = extraTime / f1FinalePart1.Count;

            for (int i = f1FinalePart1.Count - 1; i > 0; --i)
            {
                if (strandIndices.Contains(i))
                {
                    RestDef umrd = new RestDef(f1FinalePart1[i].MsPosition, f1eStrandDurations[strandIndices.IndexOf(i)] + extraTime);
                    extraTime -= diff;
                    f1FinalePart1.Insert(i, umrd);
                }
            }

            f1FinalePart1.StartMsPosition = msPositions["interlude3Bar2"];

            f1FinalePart1.RemoveBetweenMsPositions(msPositions["verse4EsCaped"], int.MaxValue);

            if (f1FinalePart1[f1FinalePart1.Count - 1] is RestDef)
            {
                f1FinalePart1[f1FinalePart1.Count - 1].MsDuration = msPositions["verse4EsCaped"] - f1FinalePart1[f1FinalePart1.Count - 1].MsPosition;
            }

            return(f1FinalePart1);
        }
        /// <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, TrkDef wind1, TrkDef wind2, TrkDef 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].MsPosition);
            msPositions.Add("furies2FinalePart2Start", wind1[54].MsPosition);
            msPositions.Add("finalBar", furies1[280].MsPosition);

            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].MsPosition);

            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);
        }
Beispiel #7
0
        private List <VoiceDef> WriteLowerStaff(int staffNumber, List <VoiceDef> topStaffBars)
        {
            List <VoiceDef>    consecutiveBars  = new List <VoiceDef>();
            Krystal            krystal          = _krystals[staffNumber - 1];
            Palette            palette          = _palettes[staffNumber - 1];
            List <List <int> > strandValuesList = krystal.GetValues(krystal.Level);

            Debug.Assert(topStaffBars.Count == strandValuesList.Count);

            for (int barIndex = 0; barIndex < strandValuesList.Count; barIndex++)
            {
                VoiceDef topStaffVoice     = topStaffBars[barIndex];
                VoiceDef newVoice          = new TrkDef((byte)(staffNumber - 1), new List <IUniqueDef>());
                int      currentMsPosition = topStaffVoice.UniqueDefs[0].MsPosition;

                List <int> lowerStaffValueSequence = strandValuesList[barIndex];
                List <int> lowerStaffMsDurations   = LowerStaffMsDurations(topStaffVoice, lowerStaffValueSequence.Count);
                for (int valueIndex = 0; valueIndex < lowerStaffValueSequence.Count; valueIndex++)
                {
                    int        value   = lowerStaffValueSequence[valueIndex];
                    IUniqueDef noteDef = palette.UniqueDurationDef(value - 1);
                    noteDef.MsDuration = lowerStaffMsDurations[valueIndex];
                    noteDef.MsPosition = currentMsPosition;
                    currentMsPosition += noteDef.MsDuration;
                    newVoice.UniqueDefs.Add(noteDef);
                }

                consecutiveBars.Add(newVoice);
            }
            return(consecutiveBars);
        }
Beispiel #8
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, TrkDef wind1, TrkDef wind2, TrkDef 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].MsPosition);
            msPositions.Add("furies2FinalePart2Start", wind1[54].MsPosition);
            msPositions.Add("finalBar", furies1[280].MsPosition);

            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].MsPosition);

            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);
        }
Beispiel #9
0
        internal void GetBeforeInterlude3(Clytemnestra clytemnestra, TrkDef wind1, TrkDef 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].MsPosition + 200,
                furies2[12].MsPosition + 100,
                furies2[24].MsPosition + 300,
                furies2[30].MsPosition + 400,
                furies2[40].MsPosition + 500,
                clytemnestra[122].MsPosition,
                clytemnestra[132].MsPosition + 110,
                clytemnestra[141].MsPosition + 220,
                clytemnestra[150].MsPosition + 330,
                clytemnestra[158].MsPosition + 440,
                clytemnestra[164].MsPosition + 550,
                clytemnestra[173].MsPosition,
            };
            for(int i = 0; i < cheepsPalette.Count; ++i)
            {
                MidiChordDef cheep = cheepsPalette.UniqueDurationDef(cheepIndices[i]) as MidiChordDef;
                Debug.Assert(cheep != null);
                cheep.MsPosition = msPositions[i];
                cheep.MsDuration *= 2;
                cheep.AdjustVelocities(velocityfactors[i]);
                cheep.Transpose(transpositions[i]);
                InsertInRest(cheep);
            }

            AlignObjectAtIndex(11, 12, 13, clytemnestra[123].MsPosition);
            AlignObjectAtIndex(21, 22, 23, clytemnestra[168].MsPosition);
        }
Beispiel #10
0
        internal void AdjustAlignments(Clytemnestra c, TrkDef w2, TrkDef w3)
        {
            Debug.Assert(this[213] is RestDef);
            this[213].MsDuration += this[212].MsDuration;
            RemoveAt(212);
            AgglomerateRests();

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

            // final adjustments for R2M
            AlignObjectAtIndex(11, 12, 13, c[123].MsPosition - 200);
            AlignObjectAtIndex(106, 111, 112, c[254].MsPosition - 100);
        }
Beispiel #11
0
        /// <summary>
        /// Steals the ticks from furies 3, then agglommerates the remaining rests in furies3...
        /// </summary>
        private void GetFuries2Interlude2(Clytemnestra clytemnestra, TrkDef wind1, TrkDef 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.MsPosition, ticksChord.MsDuration);
                furies3.Replace(f3Index, ticksRest);
                InsertInRest(ticksChord);
            }

            MidiChordDef lastTicksBeforeVerse3 = (MidiChordDef)((MidiChordDef)this[39]).DeepClone();

            lastTicksBeforeVerse3.MsPosition = furies3[155].MsPosition + furies3[155].MsDuration;
            lastTicksBeforeVerse3.MsDuration = clytemnestra[117].MsPosition - lastTicksBeforeVerse3.MsPosition;
            lastTicksBeforeVerse3.Transpose(10);
            InsertInRest(lastTicksBeforeVerse3);

            furies3.AgglomerateRests();
        }
Beispiel #12
0
        private void Transform(TrkDef 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].MsPosition, strandDurations[strandIndices.IndexOf(i)] + extraTime);
                    extraTime -= diff;
                    section.Insert(i, umrd);
                }
            }

            section.StartMsPosition = 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].MsPosition;
            }
        }
Beispiel #13
0
        internal void GetChirpsInInterlude2AndVerse3(TrkDef furies1, TrkDef furies2, Clytemnestra clytemnestra, TrkDef wind1, Palette chirpsPalette)
        {
            int[] chirpIndices   = { 4, 8, 2, 6, 10, 0 };
            int[] transpositions = { 2, 1, 3, 0, 4, 5 };
            //double[] velocityfactors = { 0.3, 0.31, 0.32, 0.34, 0.35, 0.36, 0.37, 0.39, 0.4, 0.42, 0.43, 0.45 };
            double[] velocityfactors = { 0.32, 0.34, 0.36, 0.38, 0.40, 0.42 };
            int[]    msPositions     =
            {
                this[112].MsPosition + 200,
                this[129].MsPosition + 500,
                clytemnestra[118].MsPosition,
                clytemnestra[138].MsPosition + 250,
                clytemnestra[151].MsPosition,
                furies2[57].MsPosition
            };
            for (int i = 5; i >= 0; --i)
            {
                MidiChordDef cheep = chirpsPalette.MidiChordDef(chirpIndices[i]);
                cheep.MsPosition = msPositions[i];
                cheep.AdjustVelocities(velocityfactors[i]);
                cheep.Transpose(transpositions[i]);
                InsertInRest(cheep);
            }

            AlignObjectAtIndex(25, 30, 31, clytemnestra[65].MsPosition);
            AlignObjectAtIndex(140, 141, 142, clytemnestra[119].MsPosition);
            AlignObjectAtIndex(142, 143, 144, clytemnestra[140].MsPosition);
            AlignObjectAtIndex(144, 145, 146, clytemnestra[152].MsPosition);
            AlignObjectAtIndex(146, 147, 148, furies1[23].MsPosition);

            AgglomerateRestOrChordAt(114);
        }
Beispiel #14
0
 /// <param name="trkDef">The target trk</param>
 /// <param name="inputControls">If non-null, this inputControls overrrides the InputControls in the InputNote or InputChord</param>
 public TrkOn(TrkDef trkDef, InputControls inputControls)
 {
     _trkMidiChannel = trkDef.MidiChannel;
     _trkMsPosition = trkDef.StartMsPosition;
     _trkNumMidiObjects = trkDef.DurationsCount; // includes MidiChordDef, RestDef
     _inputControls = inputControls;
 }
Beispiel #15
0
        internal void AdjustAlignments(Clytemnestra c, TrkDef w2, TrkDef w3)
        {
            Debug.Assert(this[213] is RestDef);
            this[213].MsDuration += this[212].MsDuration;
            RemoveAt(212);
            AgglomerateRests();

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

            // final adjustments for R2M
            AlignObjectAtIndex(11, 12, 13, c[123].MsPosition - 200);
            AlignObjectAtIndex(106, 111, 112, c[254].MsPosition - 100);
        }
Beispiel #16
0
        /// <summary>
        /// Sets Clytamnestra's _uniqueMidiDurationDefs for the whole piece including rests.
        /// Barline positions are set later.
        /// </summary>
        private void SetUniqueMidiDurationDefs(TrkDef wind3)
        {
            Debug.Assert(_momentDefsListPerVerse.Count == 5);

            List <int> verseMsPositions = new List <int>();

            verseMsPositions.Add(wind3[8].MsPosition);
            verseMsPositions.Add(wind3[20].MsPosition);
            verseMsPositions.Add(wind3[33].MsPosition);
            verseMsPositions.Add(wind3[49].MsPosition);
            verseMsPositions.Add(wind3[70].MsPosition);

            int        currentVerseMsPosition = 0;
            int        currentEndMsPosition   = 0;
            IUniqueDef interludeRestDef       = null;

            for (int verseIndex = 0; verseIndex < 5; ++verseIndex)
            {
                currentVerseMsPosition = verseMsPositions[verseIndex];

                interludeRestDef = new RestDef(currentEndMsPosition, currentVerseMsPosition - currentEndMsPosition);

                _uniqueDefs.Add(interludeRestDef);

                List <MomentDef> momentDefs = _momentDefsListPerVerse[verseIndex];

                for (int momentDefIndex = 0; momentDefIndex < momentDefs.Count; ++momentDefIndex)
                {
                    MomentDef momentDef = momentDefs[momentDefIndex];
                    momentDef.MsPosition += currentVerseMsPosition;

                    int        restWidth = momentDef.MsWidth - momentDef.MaximumMsDuration;
                    IUniqueDef lmrd      = null;
                    if (restWidth > 0)
                    {
                        momentDef.MsWidth -= restWidth;
                        lmrd = new RestDef(momentDef.MsPosition + momentDef.MsWidth, restWidth);
                        Debug.Assert(lmrd.MsDuration > 0);
                    }

                    MidiChordDef mcd  = momentDef.MidiChordDefs[0];
                    IUniqueDef   lmcd = mcd.DeepClone();
                    lmcd.MsPosition = momentDef.MsPosition;
                    lmcd.MsDuration = momentDef.MsWidth;
                    Debug.Assert(lmcd.MsDuration > 0);

                    _uniqueDefs.Add(lmcd);

                    if (lmrd != null)
                    {
                        _uniqueDefs.Add(lmrd);
                    }
                    currentEndMsPosition = _uniqueDefs[_uniqueDefs.Count - 1].MsPosition +
                                           _uniqueDefs[_uniqueDefs.Count - 1].MsDuration;
                }
            }
            interludeRestDef = new RestDef(currentEndMsPosition, wind3.EndMsPosition - currentEndMsPosition);
            _uniqueDefs.Add(interludeRestDef);
        }
Beispiel #17
0
        internal void GetFinale(List <Palette> palettes, Dictionary <string, int> msPositions, Krystal krystal)
        {
            TrkDef furies3Finale = GetF3Finale(palettes, krystal, msPositions);

            InsertInRest(furies3Finale);

            AdjustPitchWheelDeviations(msPositions["interlude4"], msPositions["endOfPiece"], 5, 28);
        }
Beispiel #18
0
        internal void AdjustAlignments(Furies1 f1, Furies2 f2, Furies4 f4, Clytemnestra c, TrkDef wind1)
        {
            AlignObjectAtIndex(147, 150, 158, f1[56].MsPosition);
            AlignObjectAtIndex(150, 158, 170, f1[61].MsPosition);
            AlignObjectAtIndex(158, 170, 175, c[174].MsPosition);
            AlignObjectAtIndex(170, 176, 183, c[184].MsPosition);
            AlignObjectAtIndex(175, 183, 212, c[196].MsPosition);
            AlignObjectAtIndex(183, 212, 217, c[242].MsPosition);
            AlignObjectAtIndex(212, 217, 218, c[254].MsPosition);
            AlignObjectAtIndex(217, 218, 224, c[259].MsPosition);
            AlignObjectAtIndex(218, 224, 290, wind1[57].MsPosition);
            AlignObjectAtIndex(224, 290, 296, f4[49].MsPosition);
            AlignObjectAtIndex(290, 296, 318, wind1[66].MsPosition);
            AlignObjectAtIndex(296, 318, 344, f4[53].MsPosition);
            AlignObjectAtIndex(318, 344, 350, c[283].MsPosition);
            AlignObjectAtIndex(344, 350, 353, c[287].MsPosition);
            AlignObjectAtIndex(350, 353, 354, c[288].MsPosition - 200);
            AlignObjectAtIndex(353, 354, 390, f4[59].MsPosition);
            AlignObjectAtIndex(354, 390, 401, f4[69].MsPosition);

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

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

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

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

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

            AlignObjectAtIndex(160, 171, 172, c[174].MsPosition - 600);
            AlignObjectAtIndex(172, 176, 177, c[184].MsPosition - 200);
            AlignObjectAtIndex(212, 217, 218, c[254].MsPosition - 200);
            AlignObjectAtIndex(275, 291, 292, f4[49].MsPosition - 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);
        }
Beispiel #19
0
        private TrkDef GetNextFlutterSequence(TrkDef existingFlutter, double factor, int transposition)
        {
            TrkDef nextFlutter = existingFlutter.DeepClone();

            nextFlutter.AdjustVelocities(factor);
            nextFlutter.AdjustMsDurations(factor);
            nextFlutter.AdjustRestMsDurations(factor);
            nextFlutter.Transpose(transposition);
            return(nextFlutter);
        }
Beispiel #20
0
        internal void AdjustAlignments(Furies1 furies1, Clytemnestra clytemnestra, TrkDef wind3)
        {
            AlignObjectAtIndex(42, Count - 1, Count, furies1[280].MsPosition);

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

            AlignObjectAtIndex(59, 69, Count - 1, furies1[248].MsPosition);
        }
Beispiel #21
0
        /// <summary>
        /// Could be a protected function in a furies class
        /// </summary>
        private void Cleanup(TrkDef finale, int endOfPieceMsPosition)
        {
            if (finale[finale.Count - 1] is RestDef)
            {
                finale.RemoveAt(finale.Count - 1);
            }

            if (finale[finale.Count - 1].MsPosition + finale[finale.Count - 1].MsDuration > endOfPieceMsPosition)
            {
                finale.RemoveAt(finale.Count - 1);
            }
        }
Beispiel #22
0
 internal Clytemnestra(byte midiChannel, TrkDef wind3)
     : base(midiChannel, new List<IUniqueDef>())
 {
     SetMomentDefsListPerVerse();
     SetUniqueMidiDurationDefs(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
 }
Beispiel #23
0
 internal Clytemnestra(byte midiChannel, TrkDef wind3)
     : base(midiChannel, new List <IUniqueDef>())
 {
     SetMomentDefsListPerVerse();
     SetUniqueMidiDurationDefs(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
 }
Beispiel #24
0
 /// <summary>
 /// This function should be called for all scores when the bars are complete.
 /// </summary>
 /// <param name="firstBar"></param>
 /// <param name="masterVolumes">A list with one value per TrkDef</param>
 protected void SetOutputVoiceChannelsAndMasterVolumes(List <VoiceDef> firstBar)
 {
     Debug.Assert(MasterVolumePerOutputVoice.Count == MidiChannelIndexPerOutputVoice.Count);
     for (int i = 0; i < MasterVolumePerOutputVoice.Count; ++i)
     {
         TrkDef oVoice = firstBar[i] as TrkDef;
         Debug.Assert(oVoice != null);
         Debug.Assert(MasterVolumePerOutputVoice[i] != 0);
         Debug.Assert(MasterVolumePerOutputVoice[i] >= 0 && MasterVolumePerOutputVoice[i] < 128);
         Debug.Assert(MidiChannelIndexPerOutputVoice[i] >= 0 && MidiChannelIndexPerOutputVoice[i] < 16);
         oVoice.MidiChannel  = (byte)MidiChannelIndexPerOutputVoice[i];
         oVoice.MasterVolume = (byte)MasterVolumePerOutputVoice[i];
     }
 }
Beispiel #25
0
        private void CreateEmptyOutputStaves(List <List <VoiceDef> > barDefsInOneSystem, int numberOfVisibleInputStaves)
        {
            int         nVisibleOutputStaves        = _pageFormat.VisibleOutputVoiceIndicesPerStaff.Count;
            List <byte> invisibleOutputVoiceIndices = new List <byte>();

            if (numberOfVisibleInputStaves > 0)
            {
                invisibleOutputVoiceIndices = InvisibleOutputVoiceIndices(_pageFormat.VisibleOutputVoiceIndicesPerStaff, barDefsInOneSystem[0]);
            }

            for (int i = 0; i < Systems.Count; i++)
            {
                SvgSystem       system = Systems[i];
                List <VoiceDef> barDef = barDefsInOneSystem[i];

                #region create invisible staves
                if (invisibleOutputVoiceIndices.Count > 0)
                {
                    foreach (byte invisibleOutputVoiceIndex in invisibleOutputVoiceIndices)
                    {
                        TrkDef invisibleTrkDef = barDef[invisibleOutputVoiceIndex] as TrkDef;
                        InvisibleOutputStaff invisibleOutputStaff = new InvisibleOutputStaff(system);
                        OutputVoice          outputVoice          = new OutputVoice(invisibleOutputStaff, invisibleTrkDef.MidiChannel, invisibleTrkDef.MasterVolume);
                        outputVoice.VoiceDef = invisibleTrkDef;
                        invisibleOutputStaff.Voices.Add(outputVoice);
                        system.Staves.Add(invisibleOutputStaff);
                    }
                }
                #endregion create invisible staves

                for (int printedStaffIndex = 0; printedStaffIndex < nVisibleOutputStaves; printedStaffIndex++)
                {
                    string      staffname   = StaffName(i, printedStaffIndex);
                    OutputStaff outputStaff = new OutputStaff(system, staffname, _pageFormat.StafflinesPerStaff[printedStaffIndex], _pageFormat.Gap, _pageFormat.StafflineStemStrokeWidth);

                    List <byte> outputVoiceIndices = _pageFormat.VisibleOutputVoiceIndicesPerStaff[printedStaffIndex];
                    for (int ovIndex = 0; ovIndex < outputVoiceIndices.Count; ++ovIndex)
                    {
                        TrkDef trkDef = barDef[outputVoiceIndices[ovIndex]] as TrkDef;
                        Debug.Assert(trkDef != null);
                        OutputVoice outputVoice = new OutputVoice(outputStaff, trkDef.MidiChannel, trkDef.MasterVolume);
                        outputVoice.VoiceDef = trkDef;
                        outputStaff.Voices.Add(outputVoice);
                    }
                    SetStemDirections(outputStaff);
                    system.Staves.Add(outputStaff);
                }
            }
        }
Beispiel #26
0
        List <VoiceDef> CreateBar1()
        {
            List <VoiceDef> bar = new List <VoiceDef>();

            byte channel = 0;

            foreach (Palette palette in _palettes)
            {
                TrkDef voice = new TrkDef(channel, new List <IUniqueDef>());
                bar.Add(voice);
                WriteVoiceMidiDurationDefs1(voice, palette);
                channel++;
            }
            return(bar);
        }
Beispiel #27
0
        private void WriteVoiceMidiDurationDefs1(TrkDef trkDef, Palette palette)
        {
            int msPosition            = 0;
            int bar1ChordMsSeparation = 1500;

            for (int i = 0; i < palette.Count; ++i)
            {
                IUniqueDef durationDef = palette.UniqueDurationDef(i);
                durationDef.MsPosition = msPosition;
                RestDef restDef = new RestDef(msPosition + durationDef.MsDuration, bar1ChordMsSeparation - durationDef.MsDuration);
                msPosition += bar1ChordMsSeparation;
                trkDef.UniqueDefs.Add(durationDef);
                trkDef.UniqueDefs.Add(restDef);
            }
        }
Beispiel #28
0
        private List <VoiceDef> WriteTopStaff()
        {
            List <VoiceDef>    consecutiveBars        = new List <VoiceDef>();
            List <List <int> > dcValuesPerTopStaffBar = _krystals[0].GetValues(_krystals[0].Level);
            int msPosition = 0;

            for (int barIndex = 0; barIndex < dcValuesPerTopStaffBar.Count; barIndex++)
            {
                VoiceDef   voice    = new TrkDef(0, new List <IUniqueDef>());
                List <int> sequence = dcValuesPerTopStaffBar[barIndex];
                WriteDurationSymbolsForStrandInTopStaff(voice, barIndex, sequence, ref msPosition);
                consecutiveBars.Add(voice);
            }
            return(consecutiveBars);
        }
Beispiel #29
0
		private TrkDef GetWind1(byte midiChannel, TrkDef wind3, TrkDef wind2, Clytemnestra clytemnestra)
        {
            List<IUniqueDef> clytLmdds = clytemnestra.UniqueDefs;
            int rotationMsPosition = clytLmdds[116].MsPosition + 700;

			TrkDef 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].MsPosition);
            wind1.AlignObjectAtIndex(15, 25, 82, rotationMsPosition);
            wind1.AlignObjectAtIndex(25, 74, 82, clytLmdds[289].MsPosition);

            return wind1;
        }
        /// <summary>
        /// Writes the first rest (if any) and the VoiceDef to the voice.
        /// Returns the endMsPos of the VoiceDef.
        /// </summary>
        private int WriteVoiceMidiDurationDefsInBar2(VoiceDef voice, TrkDef trkDef, int msPosition, int bar2StartMsPos)
        {
            if (msPosition > bar2StartMsPos)
            {
                RestDef rest1Def = new RestDef(bar2StartMsPos, msPosition - bar2StartMsPos);
                voice.UniqueDefs.Add(rest1Def);
            }

            trkDef.StartMsPosition = msPosition;
            foreach (IUniqueDef iu in trkDef)
            {
                voice.UniqueDefs.Add(iu);
            }

            return(trkDef.EndMsPosition);
        }
Beispiel #31
0
        private TrkDef GetWind1(byte midiChannel, TrkDef wind3, TrkDef wind2, Clytemnestra clytemnestra)
        {
            List<IUniqueDef> clytLmdds = clytemnestra.UniqueDefs;
            int rotationMsPosition = clytLmdds[116].MsPosition + 700;

            TrkDef 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].MsPosition);
            wind1.AlignObjectAtIndex(15, 25, 82, rotationMsPosition);
            wind1.AlignObjectAtIndex(25, 74, 82, clytLmdds[289].MsPosition);

            return wind1;
        }
Beispiel #32
0
        private void AdjustWindVelocities(TrkDef wind1, TrkDef wind2, TrkDef 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);
        }
Beispiel #33
0
        public TrkDef NewTrkDef(byte midiChannel, List <int> sequence)
        {
            List <IUniqueDef> iuds = new List <IUniqueDef>();
            int msPosition         = 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.MsPosition = msPosition;
                msPosition      += iumdd.MsDuration;
                iuds.Add(iumdd);
            }
            TrkDef trkDef = new TrkDef(midiChannel, iuds);

            return(trkDef);
        }
Beispiel #34
0
        internal void GetFinale(List <Palette> palettes, Dictionary <string, int> msPositions, Krystal krystal)
        {
            TrkDef furies2Finale = GetF2Finale(palettes, krystal, msPositions);

            if (furies2Finale[furies2Finale.Count - 1] is RestDef)
            {
                furies2Finale.RemoveAt(furies2Finale.Count - 1);
            }

            if (furies2Finale[furies2Finale.Count - 1].MsPosition + furies2Finale[furies2Finale.Count - 1].MsDuration > msPositions["endOfPiece"])
            {
                furies2Finale.RemoveAt(furies2Finale.Count - 1);
            }

            InsertInRest(furies2Finale);

            AdjustPitchWheelDeviations(msPositions["interlude3"], msPositions["endOfPiece"], 5, 28);
        }
Beispiel #35
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 TrkDef GetFinaleSections(TrkDef finalePart1, TrkDef finalePart2, TrkDef 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 TrkDef(this.MidiChannel, iumdds));
        }
Beispiel #36
0
		private TrkDef GetWind2(byte midiChannel, TrkDef wind3, Clytemnestra clytemnestra)
        {
            List<IUniqueDef> clytLmdds = clytemnestra.UniqueDefs;
            int rotationMsPosition = clytLmdds[59].MsPosition + 700;

            TrkDef 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].MsPosition);
            wind2.AlignObjectAtIndex(39, 57, 82, clytLmdds[268].MsPosition);

            return wind2;
        }
Beispiel #37
0
 /// <summary>
 /// See CompositionAlgorithm.DoAlgorithm()
 /// </summary>
 public override List<List<VoiceDef>> DoAlgorithm(List<Krystal> krystals, List<Palette> palettes)
 {
     VoiceDef voice = new TrkDef(0, new List<IUniqueDef>());
     int msPosition = 0;
     for(int i = 0; i < palettes[0].Count; ++i)
     {
         IUniqueDef iumdd = palettes[0].UniqueDurationDef(i);
         iumdd.MsPosition = msPosition;
         msPosition += iumdd.MsDuration;
         voice.UniqueDefs.Add(iumdd);
     }
     List<List<VoiceDef>> voicesPerSystem = new List<List<VoiceDef>>();
     List<VoiceDef> systemVoices = new List<VoiceDef>();
     systemVoices.Add(voice);
     voicesPerSystem.Add(systemVoices);
     SetOutputVoiceChannelsAndMasterVolumes(voicesPerSystem[0]);
     Debug.Assert(voicesPerSystem.Count == NumberOfBars);
     return voicesPerSystem;
 }
Beispiel #38
0
        private TrkDef GetWind2(byte midiChannel, TrkDef wind3, Clytemnestra clytemnestra)
        {
            List<IUniqueDef> clytLmdds = clytemnestra.UniqueDefs;
            int rotationMsPosition = clytLmdds[59].MsPosition + 700;

            TrkDef 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].MsPosition);
            wind2.AlignObjectAtIndex(39, 57, 82, clytLmdds[268].MsPosition);

            return wind2;
        }
Beispiel #39
0
        private TrkDef GetF2Finale(List <Palette> palettes, Krystal krystal, Dictionary <string, int> msPositions)
        {
            Palette f2FinalePalette1  = palettes[11];
            Palette f2FinalePalette2  = palettes[15];
            Palette f2PostludePalette = palettes[19];

            List <int> strandIndices = GetStrandIndices(krystal);

            TrkDef finalePart1 = f2FinalePalette1.NewTrkDef(this.MidiChannel, krystal);

            Transform(finalePart1, msPositions, strandIndices);
            TrkDef finalePart2 = f2FinalePalette2.NewTrkDef(this.MidiChannel, krystal);

            Transform(finalePart2, msPositions, strandIndices);
            TrkDef postlude = f2PostludePalette.NewTrkDef(this.MidiChannel, krystal);

            Transform(postlude, msPositions, strandIndices);

            TrkDef finale = GetFinaleSections(finalePart1, finalePart2, postlude, 71, 175);

            return(finale);

            #region old
            //List<int> strandIndices = new List<int>();
            //int index = 0;
            //for(int i = 0; i < krystal.Strands.Count; ++i)
            //{
            //    strandIndices.Add(index);
            //    index += krystal.Strands[i].Values.Count;
            //}

            //VoiceDef f2IFinalePart1 = GetF2FinalePart1(f2FinalePalette1, krystal, strandIndices, msPositions);
            //VoiceDef f2FinalePart2 = GetF2FinalePart2(f2FinalePalette2, krystal, strandIndices, msPositions);
            //VoiceDef f2Postlude = GetF2Postlude(f2PostludePalette, krystal, strandIndices, msPositions);

            //VoiceDef furies2Finale = f2IFinalePart1;

            //furies2Finale.AddRange(f2FinalePart2);
            //furies2Finale.AddRange(f2Postlude);
            //furies2Finale.AgglomerateRests();
            #endregion
        }
Beispiel #40
0
        /// <summary>
        /// Returns a VoiceDef containing clones of the UniqueMidiDurationDefs in the originalVoiceDef argument,
        /// rotated so that the original first IUniqueMidiDurationDef is positioned close to rotationMsPosition.
        /// </summary>
        /// <param name="originalVoiceDef"></param>
        /// <returns></returns>
        private TrkDef GetRotatedWind(byte midiChannel, TrkDef originalVoiceDef, int rotationMsPosition)
        {
            TrkDef tempWind = originalVoiceDef.DeepClone();
            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.MsPosition = msPosition;
                msPosition += iu.MsDuration;
            }
            TrkDef newRotatedWind = new TrkDef(midiChannel, newWindLmdds);

            return newRotatedWind;
        }
Beispiel #41
0
        /// <summary>
        /// Returns two bars. The first is the beginning of the argument bar up to absoluteSplitPos,
        /// The second is the end of the argument bar beginning at absoluteSplitPos.
        /// The final UniqueMidiDurationDef in each voice.UniqueMidiDurationDefs list is converted
        /// to a FinalLMDDInVoice object containing an MsDurationToBarline property.
        /// If a chord or rest overlaps a barline, a LocalizedCautionaryChordDef object is created at the
        /// start of the voice.UniqueMidiDurationDefs in the second bar. A LocalizedCautionaryChordDef
        /// object is a kind of chord which is used while justifying systems, but is not displayed and
        /// does not affect performance.
        /// ClefChangeDefs are placed at the end of the first bar, not at the start of the second bar.
        /// </summary>
        protected List<List<VoiceDef>> SplitBar(List<VoiceDef> originalBar, int absoluteSplitPos)
        {
            List<List<VoiceDef>> twoBars = new List<List<VoiceDef>>();
            List<VoiceDef> firstBar = new List<VoiceDef>();
            List<VoiceDef> secondBar = new List<VoiceDef>();
            twoBars.Add(firstBar);
            twoBars.Add(secondBar);
            int originalBarStartPos = originalBar[0].UniqueDefs[0].MsPosition;
            int originalBarEndPos =
                originalBar[0].UniqueDefs[originalBar[0].UniqueDefs.Count - 1].MsPosition +
                originalBar[0].UniqueDefs[originalBar[0].UniqueDefs.Count - 1].MsDuration;

            VoiceDef firstBarVoice;
            VoiceDef secondBarVoice;
            foreach(VoiceDef voice in originalBar)
            {
                TrkDef outputVoice = voice as TrkDef;
                if(outputVoice != null)
                {
                    firstBarVoice = new TrkDef(outputVoice.MidiChannel,new List<IUniqueDef>());
                    firstBar.Add(firstBarVoice);
                    secondBarVoice = new TrkDef(outputVoice.MidiChannel, new List<IUniqueDef>());
                    secondBar.Add(secondBarVoice);
                }
                else
                {
                    firstBarVoice = new InputVoiceDef();
                    firstBar.Add(firstBarVoice);
                    secondBarVoice = new InputVoiceDef();
                    secondBar.Add(secondBarVoice);
                }
                foreach(IUniqueDef iUnique in voice.UniqueDefs)
                {
                    int udMsDuration = iUnique.MsDuration;
                    IUniqueSplittableChordDef uniqueChordDef = iUnique as IUniqueSplittableChordDef;
                    if(uniqueChordDef != null)
                    {
                        udMsDuration = (uniqueChordDef.MsDurationToNextBarline == null) ? iUnique.MsDuration : (int)uniqueChordDef.MsDurationToNextBarline;
                    }

                    int udEndPos = iUnique.MsPosition + udMsDuration;

                    if(iUnique.MsPosition >= absoluteSplitPos)
                    {
                        if(iUnique.MsPosition == absoluteSplitPos && iUnique is ClefChangeDef)
                        {
                            firstBarVoice.UniqueDefs.Add(iUnique);
                        }
                        else
                        {
                            Debug.Assert(udEndPos <= originalBarEndPos);
                            secondBarVoice.UniqueDefs.Add(iUnique);
                        }
                    }
                    else if(udEndPos > absoluteSplitPos)
                    {
                        int durationAfterBarline = udEndPos - absoluteSplitPos;
                        if(iUnique is RestDef)
                        {
                            // This is a rest. Split it.
                            RestDef firstRestHalf = new RestDef(iUnique.MsPosition, absoluteSplitPos - iUnique.MsPosition);
                            firstBarVoice.UniqueDefs.Add(firstRestHalf);

                            RestDef secondRestHalf = new RestDef(absoluteSplitPos, durationAfterBarline);
                            secondBarVoice.UniqueDefs.Add(secondRestHalf);
                        }
                        else if(iUnique is CautionaryChordDef)
                        {
                            // This is a cautionary chord. Set the position of the following barline, and
                            // Add an LocalizedCautionaryChordDef at the beginning of the following bar.
                            iUnique.MsDuration = absoluteSplitPos - iUnique.MsPosition;
                            firstBarVoice.UniqueDefs.Add(iUnique);

                            CautionaryChordDef secondLmdd = new CautionaryChordDef((IUniqueChordDef)iUnique, absoluteSplitPos, durationAfterBarline);
                            secondBarVoice.UniqueDefs.Add(secondLmdd);
                        }
                        else
                        {
                            // This is a MidiChordDef or a InputChordDef.
                            // Set the position of the following barline, and add a CautionaryChordDef at the beginning
                            // of the following bar.
                            if(uniqueChordDef != null)
                            {
                                uniqueChordDef.MsDurationToNextBarline = absoluteSplitPos - iUnique.MsPosition;
                            }

                            firstBarVoice.UniqueDefs.Add((IUniqueDef)uniqueChordDef);

                            CautionaryChordDef secondLmdd = new CautionaryChordDef((IUniqueChordDef)uniqueChordDef,
                                absoluteSplitPos, durationAfterBarline);
                            secondBarVoice.UniqueDefs.Add(secondLmdd);
                        }
                    }
                    else
                    {
                        Debug.Assert(udEndPos <= absoluteSplitPos && iUnique.MsPosition >= originalBarStartPos);
                        firstBarVoice.UniqueDefs.Add(iUnique);
                    }
                }
            }
            return twoBars;
        }
        List<VoiceDef> CreateBar1()
        {
            List<VoiceDef> bar = new List<VoiceDef>();

            byte channel = 0;
            foreach(Palette palette in _palettes)
            {
                TrkDef trkDef = new TrkDef(channel, new List<IUniqueDef>());
                bar.Add(trkDef);
                WriteVoiceMidiDurationDefs1(trkDef, palette);
                ++channel;
            }

            InputVoiceDef inputVoiceDef = new InputVoiceDef();
            VoiceDef bottomOutputVoice = bar[0];

            foreach(IUniqueDef iud in bottomOutputVoice.UniqueDefs)
            {
                MidiChordDef mcd = iud as MidiChordDef;
                RestDef rd = iud as RestDef;
                if(mcd != null)
                {
                    List<IUniqueDef> iuds = new List<IUniqueDef>() { (IUniqueDef)mcd };

                    // Note that the msPosition of the trkDef is trkDef.StartMsPosition (= iuds[0].msPosition),
                    // which may be greater than the InputChordDef's msPosition
                    TrkDef trkDef = new TrkDef(bottomOutputVoice.MidiChannel, iuds);

                    // If non-null, arg2 overrides the inputControls attached to the InputNote or InputChord.
                    TrkOn trkRef = new TrkOn(trkDef, null);
                    List<TrkOn> trkRefs = new List<TrkOn>() { trkRef };
                    TrkOns trkOns = new TrkOns(trkRefs, null);

                    byte displayPitch = (byte)(mcd.NotatedMidiPitches[0] + 36);
                    Pressure pressure = new Pressure(0, null);
                    Pressures pressures = new Pressures(new List<Pressure>() {pressure}, null);
                    TrkOff trkOff = new TrkOff(trkRef.TrkMidiChannel, mcd.MsPosition, null);
                    List<TrkOff> noteOffTrkOffs = new List<TrkOff>() { trkOff };
                    TrkOffs trkOffs = new TrkOffs(noteOffTrkOffs, null);

                    InputNoteDef inputNoteDef = new InputNoteDef(displayPitch,
                                                                    trkOns, null,
                                                                    pressures,
                                                                    null, trkOffs,
                                                                    null);

                    List<InputNoteDef> inputNoteDefs = new List<InputNoteDef>() { inputNoteDef };

                    // The InputChordDef's msPosition must be <= the msPosition of any of the contained trkRefs
                    InputChordDef icd = new InputChordDef(mcd.MsPosition, mcd.MsDuration, inputNoteDefs);

                    inputVoiceDef.UniqueDefs.Add(icd);
                }
                else if(rd != null)
                {
                    RestDef newRest = new RestDef(rd.MsPosition, rd.MsDuration);
                    inputVoiceDef.UniqueDefs.Add(newRest);
                }
            }

            #region set cascading inputControls on the first InputChordDef  (for testing)
            InputChordDef inputChordDef1 = inputVoiceDef.UniqueDefs[0] as InputChordDef; // no need to check for null here.

            InputControls chordInputControls = new InputControls();

            chordInputControls.VelocityOption = VelocityOption.overridden;
            chordInputControls.MinimumVelocity = 19;
            inputChordDef1.InputControls = chordInputControls;

            InputControls noteInputControls = new InputControls();
            noteInputControls.VelocityOption = VelocityOption.scaled;
            noteInputControls.MinimumVelocity = 20;
            inputChordDef1.InputNoteDefs[0].InputControls = noteInputControls;

            #endregion

            bar.Add(inputVoiceDef);

            return bar;
        }
        /// <summary>
        /// Writes the first rest (if any) and the VoiceDef to the voice.
        /// Returns the endMsPos of the VoiceDef. 
        /// </summary>
        private int WriteVoiceMidiDurationDefsInBar2(VoiceDef voice, TrkDef trkDef, int msPosition, int bar2StartMsPos)
        {
            if(msPosition > bar2StartMsPos)
            {
                RestDef rest1Def = new RestDef(bar2StartMsPos, msPosition - bar2StartMsPos);
                voice.UniqueDefs.Add(rest1Def);
            }

            trkDef.StartMsPosition = msPosition;
            foreach(IUniqueDef iu in trkDef)
            {
                voice.UniqueDefs.Add(iu);
            }

            return trkDef.EndMsPosition;
        }
Beispiel #44
0
        private void Transform(TrkDef 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].MsPosition, strandDurations[strandIndices.IndexOf(i)] + extraTime);
                    extraTime -= diff;
                    section.Insert(i, umrd);
                }
            }

            section.StartMsPosition = 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].MsPosition;
            }
        }
Beispiel #45
0
        /// <summary>
        /// Sets Clytamnestra's _uniqueMidiDurationDefs for the whole piece including rests.
        /// Barline positions are set later.
        /// </summary>
        private void SetUniqueMidiDurationDefs(TrkDef wind3)
        {
            Debug.Assert(_momentDefsListPerVerse.Count == 5);

            List<int> verseMsPositions = new List<int>();
            verseMsPositions.Add(wind3[8].MsPosition);
            verseMsPositions.Add(wind3[20].MsPosition);
            verseMsPositions.Add(wind3[33].MsPosition);
            verseMsPositions.Add(wind3[49].MsPosition);
            verseMsPositions.Add(wind3[70].MsPosition);

            int currentVerseMsPosition = 0;
            int currentEndMsPosition = 0;
            IUniqueDef interludeRestDef = null;

            for(int verseIndex = 0; verseIndex < 5; ++verseIndex)
            {
                currentVerseMsPosition = verseMsPositions[verseIndex];

                interludeRestDef = new RestDef(currentEndMsPosition, currentVerseMsPosition - currentEndMsPosition);

                _uniqueDefs.Add(interludeRestDef);

                List<MomentDef> momentDefs = _momentDefsListPerVerse[verseIndex];

                for(int momentDefIndex = 0; momentDefIndex < momentDefs.Count; ++momentDefIndex)
                {
                    MomentDef momentDef = momentDefs[momentDefIndex];
                    momentDef.MsPosition += currentVerseMsPosition;

                    int restWidth = momentDef.MsWidth - momentDef.MaximumMsDuration;
                    IUniqueDef lmrd = null;
                    if(restWidth > 0)
                    {
                        momentDef.MsWidth -= restWidth;
                        lmrd = new RestDef(momentDef.MsPosition + momentDef.MsWidth, restWidth);
                        Debug.Assert(lmrd.MsDuration > 0);
                    }

                    MidiChordDef mcd = momentDef.MidiChordDefs[0];
                    IUniqueDef lmcd = mcd.DeepClone();
                    lmcd.MsPosition = momentDef.MsPosition;
                    lmcd.MsDuration = momentDef.MsWidth;
                    Debug.Assert(lmcd.MsDuration > 0);

                    _uniqueDefs.Add(lmcd);

                    if(lmrd != null)
                    {
                        _uniqueDefs.Add(lmrd);
                    }
                    currentEndMsPosition = _uniqueDefs[_uniqueDefs.Count - 1].MsPosition +
                        _uniqueDefs[_uniqueDefs.Count - 1].MsDuration;
                }
            }
            interludeRestDef = new RestDef(currentEndMsPosition, wind3.EndMsPosition - currentEndMsPosition);
            _uniqueDefs.Add(interludeRestDef);
        }
Beispiel #46
0
 private void AdjustWindVelocities(TrkDef wind1, TrkDef wind2, TrkDef 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);
 }
Beispiel #47
0
        public TrkDef NewTrkDef(byte midiChannel, List<int> sequence)
        {
            List<IUniqueDef> iuds = new List<IUniqueDef>();
            int msPosition = 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.MsPosition = msPosition;
                msPosition += iumdd.MsDuration;
                iuds.Add(iumdd);
            }
            TrkDef trkDef = new TrkDef(midiChannel, iuds);
            return trkDef;
        }
Beispiel #48
0
        private void GetSnores(int firstRestMsDuration, Clytemnestra clytemnestra, TrkDef 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.MsPosition = 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.MsPosition = 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].MsPosition;

            this._uniqueDefs = snores;

            AdjustVelocitiesHairpin(13, Count, 0.25);

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

            RemoveScorePitchWheelCommands(0, 13); // pitchwheeldeviation is 20 for R2M
        }
Beispiel #49
0
        /// <summary>
        /// Steals the ticks from furies 3, then agglommerates the remaining rests in furies3...
        /// </summary>
        private void GetFuries2Interlude2(Clytemnestra clytemnestra, TrkDef wind1, TrkDef 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.MsPosition, ticksChord.MsDuration);
                furies3.Replace(f3Index, ticksRest);
                InsertInRest(ticksChord);
            }

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

            furies3.AgglomerateRests();
        }
Beispiel #50
0
 private void AdjustFinalWindChordPosition(TrkDef wind1, TrkDef wind2, TrkDef wind3)
 {
     wind1.AlignObjectAtIndex(71, 81, 82, wind1[81].MsPosition - (wind1[81].MsDuration / 2));
     wind2.AlignObjectAtIndex(71, 81, 82, wind2[81].MsPosition - (wind2[81].MsDuration / 2));
     wind3.AlignObjectAtIndex(71, 81, 82, wind3[81].MsPosition - (wind3[81].MsDuration / 2));
 }
Beispiel #51
0
 private void AdjustWindPitchWheelDeviations(TrkDef 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))));
         }
     }
 }
Beispiel #52
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 TrkDef GetFinaleSections(TrkDef finalePart1, TrkDef finalePart2, TrkDef 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 TrkDef(this.MidiChannel, iumdds);
        }
Beispiel #53
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(TrkDef fury1, TrkDef fury2, TrkDef fury3, TrkDef fury4, Clytemnestra clytemnestra, TrkDef wind1, TrkDef wind2, TrkDef wind3)
 {
     TrkDef f1 = fury1;
     TrkDef f2 = fury2;
     TrkDef f3 = fury3;
     TrkDef f4 = fury4;
     Clytemnestra c = clytemnestra;
     TrkDef w1 = wind1;
     TrkDef w2 = wind2;
     TrkDef w3 = wind3;
     List<int> barlineMsPositions = new List<int>()
     {
         #region msPositions
         #region intro
         0,
         w3[1].MsPosition,
         w3[3].MsPosition,
         w3[5].MsPosition,
         #endregion
         #region verse 1
         c[1].MsPosition,
         c[3].MsPosition,
         c[8].MsPosition,
         c[12].MsPosition,
         c[15].MsPosition,
         c[18].MsPosition,
         c[22].MsPosition,
         c[27].MsPosition,
         c[34].MsPosition,
         c[38].MsPosition,
         c[41].MsPosition,
         c[47].MsPosition,
         c[49].MsPosition,
         c[50].MsPosition,
         c[54].MsPosition,
         c[58].MsPosition,
         #endregion
         #region interlude after verse 1
         w2[15].MsPosition,
         w2[16].MsPosition,
         w2[18].MsPosition,
         #endregion
         #region verse 2
         c[60].MsPosition,
         c[62].MsPosition,
         c[67].MsPosition,
         c[71].MsPosition,
         c[73].MsPosition,
         c[77].MsPosition,
         c[81].MsPosition,
         c[86].MsPosition,
         c[88].MsPosition,
         c[92].MsPosition,
         c[94].MsPosition,
         c[97].MsPosition,
         c[100].MsPosition,
         c[104].MsPosition,
         c[107].MsPosition,
         c[111].MsPosition,
         c[115].MsPosition,
         #endregion
         #region interlude after verse 2
         w1[25].MsPosition,
         w1[26].MsPosition,
         w1[28].MsPosition,
         w1[30].MsPosition,
         #endregion
         #region verse 3
         c[117].MsPosition,
         c[119].MsPosition,
         c[124].MsPosition,
         c[126].MsPosition,
         c[128].MsPosition,
         c[131].MsPosition,
         c[135].MsPosition,
         c[139].MsPosition,
         c[141].MsPosition,
         c[146].MsPosition,
         c[148].MsPosition,
         c[152].MsPosition,
         c[159].MsPosition,
         c[164].MsPosition,
         c[168].MsPosition,
         c[172].MsPosition,
         #endregion
         #region interlude after verse 3
         w1[38].MsPosition,
         w3[40].MsPosition,
         w3[42].MsPosition,
         w3[44].MsPosition,
         w3[45].MsPosition,
         w3[47].MsPosition,
         #endregion
         #region verse 4, Oft have ye...
         c[174].MsPosition,
         c[177].MsPosition,
         c[183].MsPosition,
         c[185].MsPosition,
         c[192].MsPosition,
         c[196].MsPosition,
         c[204].MsPosition,
         c[206].MsPosition,
         c[214].MsPosition,
         c[219].MsPosition,
         c[221].MsPosition,
         c[225].MsPosition,
         c[227].MsPosition,
         c[229].MsPosition,
         c[233].MsPosition,
         c[236].MsPosition,
         c[242].MsPosition,
         c[252].MsPosition,
         c[257].MsPosition,
         c[259].MsPosition,
         c[263].MsPosition,
         c[267].MsPosition,
         c[268].MsPosition, // new bar 89
         #endregion
         #region interlude after verse 4
         w1[57].MsPosition,
         w3[59].MsPosition,
         f4[45].MsPosition, // was w3[61].MsPosition,
         w3[63].MsPosition,
         w2[65].MsPosition, // was w3[65].MsPosition,
         w1[66].MsPosition, // w3[67].MsPosition,
         w1[68].MsPosition,
         #endregion
         #region verse 5
         c[269].MsPosition,
         c[270].MsPosition,
         c[272].MsPosition,
         c[276].MsPosition,
         c[279].MsPosition,
         c[283].MsPosition,
         c[288].MsPosition,
         #endregion
         #region postlude
         c[289].MsPosition,
         f1[248].MsPosition,
         f1[280].MsPosition, // 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;
 }
Beispiel #54
0
 internal void GetBeforeInterlude3(Clytemnestra clytemnestra, TrkDef wind1, TrkDef furies3, List<Palette> _palettes)
 {
     GetFuries2Interlude2(clytemnestra, wind1, furies3);
     AddFuries2ChirpsForInterlude2AndVerse3(clytemnestra, wind1, _palettes[7]);
 }
        List<VoiceDef> CreateBar1()
        {
            List<VoiceDef> bar = new List<VoiceDef>();

            byte channel = 0;
            foreach(Palette palette in _palettes)
            {
                TrkDef voice = new TrkDef(channel, new List<IUniqueDef>());
                bar.Add(voice);
                WriteVoiceMidiDurationDefs1(voice, palette);
                channel++;
            }
            return bar;
        }
        private void WriteVoiceMidiDurationDefs1(TrkDef trkDef, Palette palette)
        {
            int bar1ChordMsSeparation = 1500;
            int msPosition = 0;

            for(int i = 0; i < palette.Count;++i)
            {
                IUniqueDef noteDef = palette.UniqueDurationDef(i);
                noteDef.MsPosition = msPosition;
                RestDef restDef = new RestDef(msPosition + noteDef.MsDuration, bar1ChordMsSeparation - noteDef.MsDuration);
                msPosition += bar1ChordMsSeparation;
                trkDef.UniqueDefs.Add(noteDef);
                trkDef.UniqueDefs.Add(restDef);
            }
        }
Beispiel #57
0
        private void AddFuries2ChirpsForInterlude2AndVerse3(Clytemnestra clytemnestra, TrkDef 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].MsPosition,
                this[6].MsPosition,
                this[16].MsPosition,
                this[26].MsPosition,
                this[26].MsPosition + c3.MsDuration,
                clytemnestra[129].MsPosition,
                clytemnestra[143].MsPosition + 110,
                clytemnestra[156].MsPosition + 220,
                clytemnestra[156].MsPosition + 220 + c7.MsDuration,
                clytemnestra[168].MsPosition + 330,
            };
            for(int i = 9; i >=0 ; --i)
            {
                MidiChordDef cheep = chirpsPalette.MidiChordDef(chirpIndices[i]);
                cheep.MsPosition = msPositions[i];
                //cheep.MsDuration *= 2;
                cheep.AdjustVelocities(velocityfactors[i]);
                cheep.Transpose(transpositions[i]);
                InsertInRest(cheep);
            }

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

            AgglomerateRestOrChordAt(31);
        }
Beispiel #58
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(TrkDef 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;
 }
Beispiel #59
0
        private void Transform(TrkDef section, Dictionary<string, int> msPositions)
        {
            section.RemoveRange(40, section.Count - 40);

            section.StartMsPosition = 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].MsPosition;
            }
        }
Beispiel #60
0
        internal void AdjustAlignments(Furies1 furies1, Clytemnestra clytemnestra, TrkDef wind3)
        {
            AlignObjectAtIndex(42, Count-1, Count, furies1[280].MsPosition);

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

            AlignObjectAtIndex(59, 69, Count-1, furies1[248].MsPosition);
        }