All Packages Class Hierarchy This Package Previous Next Index
Class soundmodel.SonicObject
java.lang.Object
|
+----soundmodel.SonicObject
- public class SonicObject
- extends Object
Vibration model of object.
After creating a SonicObject you can obtain its sound through
getSound(), which give you a mu-law encoded byte array of the sound in response
to a force (encoded as an array of double). This byte array can be used for
rendering with sun.audio.*, or you do with it what you want.
Has some default simple sound, and is intended to be subclassed for
different types of models.
-
ampl
-
-
decayRate
-
-
freq
-
-
max_short_ampl
-
-
nf
-
-
SonicObject()
- Create and initialize SonicObject
-
getSound(double, double[], double)
- At sampling rate srate (must be 8012 now) apply external local force
sampled in force[].
-
getSound(double, double[], double, double, double)
- At sampling rate srate (must be 8012 now) apply external local force
sampled in force[].
-
initSonicObject()
- Init SonicObject with some meaningless sounds
-
setMax_short_ampl(int)
- Set maximum value of byte array of generated sound.
-
setNf(int)
- Set number of frequency modes
freq
protected double freq[]
decayRate
protected double decayRate[]
ampl
protected double ampl[]
nf
protected int nf
max_short_ampl
protected double max_short_ampl
SonicObject
public SonicObject()
- Create and initialize SonicObject
initSonicObject
public void initSonicObject()
- Init SonicObject with some meaningless sounds
setNf
public void setNf(int n)
- Set number of frequency modes
setMax_short_ampl
public void setMax_short_ampl(int val)
- Set maximum value of byte array of generated sound.
Should be less than 2^15 if you want multiple sounds to add
up together. Default is 10000
getSound
public byte[] getSound(double srate,
double force[],
double dur)
- At sampling rate srate (must be 8012 now) apply external local force
sampled in force[]. Duration of everything is dur. If dur longer
than time of force[] will pad with silence at end. Write to byte array.
Equalize by first writing to double array and then scaling to (short).
Maximum value of sound is max_short_ampl.
getSound
public byte[] getSound(double srate,
double force[],
double dur,
double fscale,
double dscale)
- At sampling rate srate (must be 8012 now) apply external local force
sampled in force[]. Duration of everything is dur. If dur longer
than time of force[] will pad with silence at end. Write to byte array.
Equalize by first writing to double array and then scaling to (short).
frscale and dscale scale frequencies and damping by a constant factor.
Maximum value of sound is max_short_ampl.
All Packages Class Hierarchy This Package Previous Next Index