ddf.minim.signals
Class WhiteNoise

java.lang.Object
  extended by ddf.minim.signals.WhiteNoise
All Implemented Interfaces:
AudioSignal

public class WhiteNoise
extends java.lang.Object
implements AudioSignal

White noise is a signal that contains all frequencies in equal amounts.

Author:
Damien Di Fede
See Also:
White Noise

Field Summary
protected  float amp
           
protected  float leftScale
           
protected  float pan
           
protected  float rightScale
           
 
Constructor Summary
WhiteNoise()
          Constructs a white noise generator with an amplitude of 1.
WhiteNoise(float amp)
          Constructs a white noise generator with the given amplitude.
 
Method Summary
 void generate(float[] signal)
          Fills signal with values in the range of [-1, 1].
 void generate(float[] left, float[] right)
          Fills left and right with values in the range of [-1, 1].
 void setAmp(float a)
          Sets the amplitude to a.
 void setPan(float p)
          Sets the pan to p.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

amp

protected float amp

pan

protected float pan

leftScale

protected float leftScale

rightScale

protected float rightScale
Constructor Detail

WhiteNoise

public WhiteNoise()
Constructs a white noise generator with an amplitude of 1.


WhiteNoise

public WhiteNoise(float amp)
Constructs a white noise generator with the given amplitude. amp should be between 0 and 1.

Parameters:
amp - the amplitude
Method Detail

setAmp

public void setAmp(float a)
Sets the amplitude to a. This value will be constrained to [0, 1].

Parameters:
a - the new amplitude

setPan

public void setPan(float p)
Sets the pan to p. This value will be constrained to [-1, 1].

Parameters:
p - the new pan

generate

public void generate(float[] signal)
Description copied from interface: AudioSignal
Fills signal with values in the range of [-1, 1]. signal represents a mono audio signal.

Specified by:
generate in interface AudioSignal
Parameters:
signal - the float array to fill

generate

public void generate(float[] left,
                     float[] right)
Description copied from interface: AudioSignal
Fills left and right with values in the range of [-1, 1]. left represents the left channel of a stereo signal, right represents the right channel of that same stereo signal.

Specified by:
generate in interface AudioSignal
Parameters:
left - the left channel
right - the right channel