Hey guys. So, I am wondering.. I need to implement this interface for some of the common waveforms such as sine:

And.. im not exactly sure how... I mean for sine, would it simply be this:Code :

public interface SignalFunction { public double f(int freq, int time); }

?Code :

public double f(int freq, int time) { return Math.sin(time); }

As for sawtooth, triangle and square, im not sure. If anyone can help me implement these, I would really appreciate it. Thanks!

EDIT:

okay... so... I am currently working on making a triangle wave. I have this:

It almost works... but its not QUITE a triangle.... what am I doing wrong?Code :

Math.abs((((2 * t) / Math.PI - 1) % 4) - 2) - 1