示例#1
0
 static void AddNote(PartialProvider pp, double cents, Partial[] partials)
 {
     foreach (Partial p in partials)
     {
         double c     = cents + p.rational.ToCents();
         double hz    = Partials.CentsToHz(c);
         double level = Math.Pow(p.harmonicity, 7.0f);
         pp.AddPartial(
             hz,
             10, (int)(2000 * p.harmonicity),
             (float)(level / partials.Length),
             -4f
             );
     }
     pp.FlushPartials();
 }
示例#2
0
 static void AddNote(PartialTimeline timeline, int startMs, double cents, Partial[] partials, int bendIndex = -1)
 {
     foreach (Partial p in partials)
     {
         double c     = cents + p.rational.ToCents();
         double hz    = Partials.CentsToHz(c);
         double level = Math.Pow(p.harmonicity, 2.0f); // !!! was 7.0f
         timeline.AddPartial(
             startMs,
             hz,
             10, (int)(2000 * p.harmonicity),
             level: (float)(level / partials.Length),
             balance: 0f,
             curve: -4f,
             bendIndex: bendIndex
             );
     }
 }
示例#3
0
        static void AddNote(PartialProvider pp, Rational r0)
        {
            string[] rs = new string[] { "1", "2", "3", "4", "81/16", "6" };
            float [] ls = new float [] { 1f, .04f, .8f, .08f, .8f, .1f };

            double c0 = r0.ToCents();

            for (int i = 0; i < rs.Length; ++i)
            {
                Rational r  = Rational.Parse(rs[i]);
                double   c  = c0 + r.ToCents();
                double   hz = Partials.CentsToHz(c);
                pp.AddPartial(
                    hz,
                    10, (int)(2000 * ls[i]),
                    ls[i] * .1f,
                    -4f
                    );
            }
            pp.FlushPartials();
        }