Example #1
0
        /// <summary>
        /// Creates a list of TenorPaletteGrps, each of which has the same relativePitchHierarchyIndex.
        /// </summary>
        private List<Grp> GetTenorPaletteGrpList(int relativePitchHierarchyIndex)
        {
            const int gamutBasePitch = 0;
            List<Grp> grps = new List<Grp>();

            for(int i = 0, domain = 12; domain >= 1; --domain, ++i) // domain is both Gamut.PitchesPerOctave and nChords per Grp
            {
                Gamut gamut = new Gamut(relativePitchHierarchyIndex, gamutBasePitch, domain);

                TenorPaletteGrp tpg = new TenorPaletteGrp(gamut);

                #region begin test code 1 Shear and permute
                tpg.Shear(0, -1 * (gamut.NPitchesPerOctave));
                tpg.SetVelocitiesForGamut();

                if(domain % 2 != 0)
                {
                    tpg.Permute(1, 7);
                }
                #endregion end test code 1

                #region begin test code 2 transpose chords to the same absolute root pitch
                //for(int iudIndex = 0; iudIndex < tpg.Count; ++iudIndex)
                //{
                //    tpg.TransposeChordDownToAbsolutePitch(iudIndex, 0);
                //}
                #endregion end test code 2

                #region begin test code 3, adjust velocities
                //if(domain % 2 != 0)
                //{
                //    tpg.AdjustVelocities(0.5);
                //}
                #endregion

                #region begin test code 4, adjust velocities
                //if(domain % 2 != 0 && tpg.Count > 1)
                //{
                //    tpg.AdjustVelocitiesHairpin(0, tpg.Count - 1, 0.5, 1.0);
                //}
                #endregion

                #region begin test code 5, related Grps
                //if(domain % 2 != 0 && tpg.Count > 1)
                //{
                //    TenorPaletteGrp previousTpg = (TenorPaletteGrp)grps[i - 1];
                //    //tpg = previousTpg.RelatedPitchHierarchyGrp(previousTpg.Gamut.RelativePitchHierarchyIndex + 11);
                //    //tpg = previousTpg.RelatedBasePitchGrp(11);
                //    tpg = previousTpg.RelatedDomainGrp(6);
                //}
                #endregion

                #region begin test code 6, timeWarp
                //if(domain % 2 != 0 && tpg.Count > 1)
                //{
                //    tpg.TimeWarp(new Envelope(new List<int>() { 4, 7, 2 }, 7, 7, tpg.Count), 20);
                //}
                #endregion

                #region begin test code 7, SetPitchWheelSliders
                //Envelope env = new Envelope(new List<int>() { 0,8 }, 8, 127, tpg.Count);
                //tpg.SetPitchWheelSliders(env);
                #endregion

                #region begin test code 8, SetPanGliss
                //if(tpg.Count > 1)
                //{
                //    if(domain % 2 != 0)
                //    {
                //        tpg.SetPanGliss(0, tpg.Count - 1, 127, 0);
                //    }
                //    else
                //    {
                //        tpg.SetPanGliss(0, tpg.Count - 1, 0, 127);
                //    }
                //}
                #endregion

                #region begin test code 8, set inverse velocities
                //if(domain % 2 != 0 && tpg.Count > 1)
                //{
                //    TenorPaletteGrp prevTpg = (TenorPaletteGrp)grps[i - 1];
                //    Gamut prevGamut = prevTpg.Gamut;
                //    tpg = new TenorPaletteGrp(prevGamut); // identical to prevTpg
                //    // inverse velocityPerAbsolutePitch
                //    List<byte> velocityPerAbsolutePitch = prevGamut.GetVelocityPerAbsolutePitch(20, 127, prevGamut.NPitchesPerOctave - 1);
                //    tpg.SetVelocityPerAbsolutePitch(velocityPerAbsolutePitch, 20);
                //}
                #endregion

                #region begin test code 8, set Gamut (pitches
                //if(domain % 2 != 0 && tpg.Count > 1)
                //{
                //    TenorPaletteGrp prevTpg = (TenorPaletteGrp)grps[i - 1];
                //    Gamut prevGamut = prevTpg.Gamut;
                //    tpg = new TenorPaletteGrp(prevGamut); // identical to prevTpg

                //    int newRelativePitchHierarchyIndex = prevGamut.RelativePitchHierarchyIndex + 11;
                //    int newBasePitch = prevGamut.BasePitch;
                //    int newNPitchesPerOctave = 8;
                //    Gamut gamut1 = new Gamut(newRelativePitchHierarchyIndex, newBasePitch, newNPitchesPerOctave);
                //    tpg.Gamut = gamut1; // sets the pitches, velocities are still those of the original pitches.

                //    // reverse the velocityperAbsolutePitch hierarchy re the prevGamut.
                //    List<byte> velocityPerAbsolutePitch = prevGamut.GetVelocityPerAbsolutePitch(20, 127, prevGamut.NPitchesPerOctave - 1);
                //    tpg.SetVelocityPerAbsolutePitch(velocityPerAbsolutePitch, 20);
                //}
                #endregion

                grps.Add(tpg);
            }

            return (grps);
        }
Example #2
0
        /// <summary>
        /// Returns a new, related TenorPaletteGrp having the new domain % 12.
        /// </summary>
        /// <param name="domain">the the number of chords in the returned TenorPaletteGrp, and the nPitchesPerOctave of its Gamut (will be treated % 12)</param>
        internal TenorPaletteGrp RelatedDomainGrp(int domain)
        {
            domain %= 12;

            Gamut gamut = new Gamut(Gamut.RelativePitchHierarchyIndex, Gamut.BasePitch, domain);

            TenorPaletteGrp newTenorPaletteGrp = new TenorPaletteGrp(gamut);

            return newTenorPaletteGrp;
        }
Example #3
0
        /// <summary>
        /// Returns a new, related TenorPaletteGrp whose Gamut has the new pitchHierarchyIndex % 22.
        /// Throws an exception if this.Gamut == null.
        /// </summary>
        /// <param name="pitchHierarchyIndex">the pitchHierarchyIndex of the returned TenorPaletteGrp's Gamut (will be treated % 22)</param>
        internal TenorPaletteGrp RelatedPitchHierarchyGrp(int pitchHierarchyIndex)
        {
            pitchHierarchyIndex %= 22;

            Debug.Assert(Gamut != null);

            Gamut gamut = new Gamut(pitchHierarchyIndex, Gamut.BasePitch, Gamut.NPitchesPerOctave);

            TenorPaletteGrp newTenorPaletteGrp = new TenorPaletteGrp(gamut);

            return newTenorPaletteGrp;
        }
Example #4
0
        /// <summary>
        /// Returns a new, related TenorPaletteGrp whose Gamut has the new basePitch % 12.
        /// Throws an exception if this.Gamut == null.
        /// </summary>
        /// <param name="basePitch">the basePitch of the returned TenorPaletteGrp's Gamut (will be treated % 12)</param>
        internal TenorPaletteGrp RelatedBasePitchGrp(int basePitch)
        {
            basePitch %= 12;

            Debug.Assert(Gamut != null);

            Gamut gamut = new Gamut(Gamut.RelativePitchHierarchyIndex, basePitch, Gamut.NPitchesPerOctave);

            TenorPaletteGrp newTenorPaletteGrp = new TenorPaletteGrp(gamut);

            return newTenorPaletteGrp;
        }