コード例 #1
0
 public static ISampleProvider[] GenerateSawWaveHarmonics(int MaxHarmonics)
 {
     ConstantSampleValue[] harmonics = new ConstantSampleValue[MaxHarmonics];
     for (int i = 0; i < harmonics.Length; i++)
     {
         harmonics[i] = new ConstantSampleValue(1F / (i + 1));
     }
     return(harmonics);
 }
コード例 #2
0
 public static ISampleProvider[] GenerateTriangleWaveHarmonics(int MaxHarmonics)
 {
     ConstantSampleValue[] harmonics = new ConstantSampleValue[MaxHarmonics];
     for (int i = 0; i < harmonics.Length; i++)
     {
         if ((i + 1) % 2 == 1)
         {
             harmonics[i] = new ConstantSampleValue((float)(1F / (Math.Pow(i + 1, 2))));
             if ((i + 3) % 4 == 1)
             {
                 harmonics[i].ConstantValue = -harmonics[i].ConstantValue;
             }
         }
         else
         {
             harmonics[i] = new ConstantSampleValue(0);
         }
     }
     return(harmonics);
 }
コード例 #3
0
 public static ISampleProvider[] GenerateSineWaveHarmonics()
 {
     ConstantSampleValue[] harmonics = new ConstantSampleValue[1];
     harmonics[0] = new ConstantSampleValue(1F);
     return(harmonics);
 }