Example #1
0
 protected virtual WaveFunction Join(WaveFunction wave)
 {
     return(new WaveFunction(
                x => wave[this[x]],
                wave[this.Amplitude]
                ));
 }
Example #2
0
 protected virtual WaveFunction Combine(Func <double, double> func, WaveFunction wave, double amplitude)
 {
     return(new WaveFunction(
                func,
                amplitude
                ));
 }
Example #3
0
 public void PlayWave(WaveFunction wave, int duration)
 {
     PlayWave(new Wave(1, duration)
     {
         Type = wave
     });
 }
Example #4
0
 protected override WaveFunction Join(WaveFunction wave)
 {
     if (wave is PeriodicWave)
     {
         return(new PeriodicWave(
                    x => wave[this[x]],
                    wave[this.Amplitude]
                    ));
     }
     else
     {
         return(base.Join(wave));
     }
 }
Example #5
0
 protected override WaveFunction Combine(Func <double, double> func, WaveFunction wave, double amplitude)
 {
     if (wave == null || wave is PeriodicWave)
     {
         return(new PeriodicWave(
                    func,
                    amplitude
                    ));
     }
     else
     {
         return(base.Combine(func, wave, amplitude));
     }
 }
Example #6
0
        public static WaveFunction Noise(WaveFunction coef)
        {
            Random rnd = new Random();

            return(new WaveFunction(x => (rnd.NextDouble() * 2 - 1) * coef[x], coef.Amplitude));
        }
Example #7
0
 public Wave(double frequency, double duration, WaveFunction type) : this(frequency, duration)
 {
     Type = type;
 }