Example #1
0
        public Instrument(IWaveFunction waveFunction, float volume, float attack, float decay, float decayLevel,
                          float sustain, float release)
        {
            this._volume       = volume;
            this._waveFunction = waveFunction;
            this._attack       = attack;
            this._decay        = decay;
            this._decayLevel   = decayLevel;
            this._sustain      = sustain;
            this._release      = release;

            this._currentNotes = new List <Note>();
        }
Example #2
0
        public PlaybackEngine(int sampleRate, int channels)
        {
            Frequency = 1000;
            Amplitude = 0.25f; // let's not hurt our ears

            this.WaveFunction = new SquareWave();
            //this.WaveFunction = new SineWave();
            //this.WaveFunction = new TanWave();
            //this.WaveFunction = new TriangleWave();
            //this.WaveFunction = new DarkWave();
            //this.WaveFunction = new NoiseWave();
            //this.WaveFunction = new SawWave();
            this.WaveFunction = ComboWave.Create(new SineWave(), new SquareWave(), new NoiseWave(), new TanWave(), new CosineWave());
            //this.WaveFunction = ComboWave.Create(new SineWave(), new SquareWave(), new TanWave(), new CosineWave());

            //this.WaveFunction = SequenceWave.Create(new SineWave(), new SquareWave(), new TanWave(), new CosWave());

            SetWaveFormat(sampleRate, channels);
        }
Example #3
0
 public static float WaveValue(IWaveFunction baseWave, IEnumerable <(IWaveFunction, float)> waveAdditions,
Example #4
0
 public Instrument(IWaveFunction waveFunction, float volume = 1, int stepOffset = 0)
 {
     this.WaveFunction = waveFunction;
     this.Volume       = volume;
     this.StepOffset   = stepOffset;
 }