package party.bami.eqfix.transientGenerator;

public class Generator{

    private int sampleRate;
    public Generator(int sampleRate) {
        this.sampleRate = sampleRate;
    }

    public float[] generate(float frequency, int length) {
        float[] output = new float[length];

        float stepSize = (float) (2 * Math.PI) / ((float) sampleRate / frequency);

        for (int i = 0; i < output.length; i++) {
            output[i] =  (float)Math.sin(i * stepSize);
        }

        return output;
    }


    /***** GETTERS and SETTERS *****/
    public void setSampleRate(int sampleRate) {
        this.sampleRate = sampleRate;
    }

    public int getSampleRate() {
        return this.sampleRate;
    }
}
