Package net.paulhertz.pixelaudio
Class PixelAudio
java.lang.Object
net.paulhertz.pixelaudio.PixelAudio
PixelAudio library for Processing.
Typical usage in Processing is to declare a global:
PixelAudio pixelaudio;and then initialize it in the setup method:
public void setup() {
// ... setup code
pixelaudio = new PixelAudio(this);
// ... more setup code
}
The host PApplet can be obtained from PixelAudio by other classes. A number of useful static
variables and methods are also included.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPixelAudio(processing.core.PApplet theParent) a Constructor, usually called in the setup() method in your sketch to initialize and start the Library. -
Method Summary
Modifier and TypeMethodDescriptionstatic final floatconstrain(float amt, float low, float high) Processing's PApplet.constrain method, copied for convenience.static final intconstrain(int amt, int low, int high) Processing's PApplet.constrain method, copied for convenience.static doublegauss(double mean, double variance) Returns a Gaussian variable using a Java library call toRandom.nextGaussian.static final floatlerp(float a, float b, float f) Good old lerp.static final floatmap(float value, float start1, float stop1, float start2, float stop2) Processing's map method, but with no error checkingstatic Randomrando()static Randomrando(long seed) sayHello()static Stringversion()return the version of the Library.private voidwelcome()
-
Field Details
-
myParent
public static processing.core.PApplet myParentmyParent is a reference to the parent sketch, we make it static so it's available to other classes -
rando
Java Random -
VERSION
SHould be set by Ant script (?), but that is not happening- See Also:
-
-
Constructor Details
-
PixelAudio
public PixelAudio(processing.core.PApplet theParent) a Constructor, usually called in the setup() method in your sketch to initialize and start the Library.- Parameters:
theParent- the parent PApplet
-
-
Method Details
-
welcome
private void welcome() -
sayHello
-
version
return the version of the Library.- Returns:
- String
-
constrain
public static final float constrain(float amt, float low, float high) Processing's PApplet.constrain method, copied for convenience.- Parameters:
amt-low-high-- Returns:
- amt clipped to low and high, closed interval
-
constrain
public static final int constrain(int amt, int low, int high) Processing's PApplet.constrain method, copied for convenience.- Parameters:
amt-low-high-- Returns:
- amt clipped to low and high, closed interval
-
map
public static final float map(float value, float start1, float stop1, float start2, float stop2) Processing's map method, but with no error checking- Parameters:
value-start1-stop1-start2-stop2-- Returns:
-
lerp
public static final float lerp(float a, float b, float f) Good old lerp.- Parameters:
a- first bound, typically a minimum valueb- second bound, typically a maximum valuef- scaling value, from 0..1 to interpolate between a and b, but can go over or under- Returns:
- a value between a and b, scaled by f
(if 0 <= f >= 1).
-
gauss
public static double gauss(double mean, double variance) Returns a Gaussian variable using a Java library call toRandom.nextGaussian.- Parameters:
mean-variance-- Returns:
- a Gaussian-distributed random number with mean
meanand variancevariance
-
rando
-
rando
-