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.


Variable Index

 o ampl
 o decayRate
 o freq
 o max_short_ampl
 o nf

Constructor Index

 o SonicObject()
Create and initialize SonicObject

Method Index

 o getSound(double, double[], double)
At sampling rate srate (must be 8012 now) apply external local force sampled in force[].
 o getSound(double, double[], double, double, double)
At sampling rate srate (must be 8012 now) apply external local force sampled in force[].
 o initSonicObject()
Init SonicObject with some meaningless sounds
 o setMax_short_ampl(int)
Set maximum value of byte array of generated sound.
 o setNf(int)
Set number of frequency modes

Variables

 o freq
 protected double freq[]
 o decayRate
 protected double decayRate[]
 o ampl
 protected double ampl[]
 o nf
 protected int nf
 o max_short_ampl
 protected double max_short_ampl

Constructors

 o SonicObject
 public SonicObject()
Create and initialize SonicObject

Methods

 o initSonicObject
 public void initSonicObject()
Init SonicObject with some meaningless sounds

 o setNf
 public void setNf(int n)
Set number of frequency modes

 o 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

 o 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.

 o 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