lib/minim/src/ddf/minim/ugens/WavetableGenerator.java
// phases are between 0 and 1
phases are between 0 and 1
phases are between 0 and 1
public static Wavetable gen9(int size, float[] partial, float[] amp, float[] phase)
	{
		if (partial.length != amp.length 
		 || partial.length != phase.length
		 || amp.length != phase.length)
		{
			System.err.println("Input arrays of different size!");
			return null;
		}
		float[] waveform = new float[size];
		float index = 0;
		for (int i = 0; i < size; i++)
		{
			index = (float)i / (size - 1);
			for (int j = 0; j < partial.length; j++)
			{
				waveform[i] += amp[j]
						* Math.sin(2 * Math.PI * partial[j] * index + phase[j]);
			}
		}
		return new Wavetable(waveform);
	}
public static Wavetable gen9 ( int size , float [ ] partial , float [ ] amp , float [ ] phase ) { if ( partial . length != amp . length || partial . length != phase . length || amp . length != phase . length ) { System . err . println ( "Input arrays of different size!" ) ; return null ; } float [ ] waveform = new float [ size ] ; float index = 0 ; for ( int i = 0 ; i < size ; i ++ ) { index = ( float ) i / ( size - 1 ) ; for ( int j = 0 ; j < partial . length ; j ++ ) { waveform [ i ] += amp [ j ] * Math . sin ( 2 * Math . PI * partial [ j ] * index + phase [ j ] ) ; } } return new Wavetable ( waveform ) ; }
phases are between 0 and 1
phases are between 0 and 1