lib/minim/src/ddf/minim/ugens/Wavetable.java
/**
	 * Sample the Wavetable using a value in the range [0,1]. For instance, if
	 * the Wavetable has 1024 values in its float array, then calling value(0.5)
	 * will return the 512th value in the array. If the result is that it needs
	 * say the 456.65th value, this will interpolate between the surrounding
	 * values.
	 * 
	 * @shortdesc Sample the Wavetable using a value in the range [0,1].
	 * 
	 * @example Synthesis/WavetableMethods
	 * 
	 * @param at
	 *            float: a value in the range [0, 1]
	 * 
	 * @return float: this Wavetable sampled at the requested interval
	 * 
	 * @related Wavetable
	 */
Sample the Wavetable using a value in the range [0,1]. For instance, if
the Wavetable has 1024 values in its float array, then calling value(0.5)
will return the 512th value in the array. If the result is that it needs
say the 456.65th value, this will interpolate between the surrounding
values.

@shortdesc Sample the Wavetable using a value in the range [0,1].



@param at
float: a value in the range [0, 1]

@return float: this Wavetable sampled at the requested interval

@related Wavetable
Sample the Wavetable using a value in the range [ 0 1 ] . For instance if the Wavetable has 1024 values in its float array then calling value ( 0 . 5 ) will return the 512th value in the array . If the result is that it needs say the 456 . 65th value this will interpolate between the surrounding values . @shortdesc Sample the Wavetable using a value in the range [ 0 1 ] . @param at float : a value in the range [ 0 1 ] @return float : this Wavetable sampled at the requested interval @related Wavetable
public float value(float at)
	{
		float whichSample = lengthForValue * at;
		int lowSamp = (int)whichSample;
		int hiSamp = lowSamp + 1;
		if ( hiSamp >= waveform.length )
		{
			hiSamp -= waveform.length;
		}
		float rem = whichSample - lowSamp;
		return waveform[lowSamp] + rem
				* ( waveform[hiSamp] - waveform[lowSamp] );
	}
public float value ( float at ) { float whichSample = lengthForValue * at ; int lowSamp = ( int ) whichSample ; int hiSamp = lowSamp + 1 ; if ( hiSamp >= waveform . length ) { hiSamp -= waveform . length ; } float rem = whichSample - lowSamp ; return waveform [ lowSamp ] + rem * ( waveform [ hiSamp ] - waveform [ lowSamp ] ) ; }
Sample the Wavetable using a value in the range [0,1].
Sample the Wavetable using a value in the range [ 0 1 ] .
// linearly interpolate between the two samples we want. // lowSamp might be the last sample in the waveform // we need to make sure we wrap. // This was here for testing. // Causes non-interpolation, but adds max # of oscillators // return get(lowSamp);