public static Wavetable operator -(Wavetable w1, Wavetable w2) { float[] waveform = new float[defaultSize]; for (int i = 0; i < defaultSize; i++) { waveform[i] = w1.ratio * w1[i * w1.Size / defaultSize] - w2.ratio * w2[i * w2.Size / defaultSize]; } Wavetable output = new Wavetable(waveform); output.ratio = w1.ratio + w2.ratio; return(output); }
public static Wavetable operator - (Wavetable w1, Wavetable w2){ float[] waveform = new float[defaultSize]; for(int i = 0; i < defaultSize; i++) waveform[i] = w1.ratio * w1[i * w1.Size / defaultSize] - w2.ratio * w2[i * w2.Size / defaultSize]; Wavetable output = new Wavetable(waveform); output.ratio = w1.ratio + w2.ratio; return output; }
public Oscillator(Wavetable wavetable, float amplitude = 1f, float frequency = 1f) { Setup(amplitude, frequency); this.wavetable = wavetable; }