|
|||||||||
| Home >> All >> jm >> audio >> [ synth overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
jm.audio.synth
Class WaveTable

java.lang.Objectjm.audio.AudioObject
jm.audio.synth.WaveTable
- All Implemented Interfaces:
- jm.constants.Alignments, jm.constants.DrumMap, jm.constants.Durations, jm.constants.Dynamics, jm.constants.Frequencies, jm.JMC, jm.constants.Noises, jm.constants.Panning, jm.constants.Pitches, jm.constants.ProgramChanges, jm.constants.RhythmValues, jm.constants.Scales, jm.constants.Tunings, jm.constants.Volumes, jm.constants.Waveforms
- public class WaveTable
- extends jm.audio.AudioObject
Wavetable lookup creates an efficient means for resampling data
into any frequency. It is particularly useful for holding simple
wave information such as sinewaves and is often used as an
oscillator.
This WaveTable implementation can accept either one or two inputs. Two
inputs expects that amplitude is the left input and frequency is the right
input. One input allows the user to specify whether the input is for
amplitude or frequency by setting the aoDestination variable((0)amplitude
(1)frequency.
A WaveTable can use fixed variables for both amplitude and frequency. The
default is to use a default amplitude of 1.0 and a frequency based upon the
value of the build methods Note.pitch(). These fixed variables are
amp(amplitude) and frq(frequency) and both have set methods. NOTE (please do
not add more constructors to set amp and frq but leave them as set
methods).
The frqRatio variable is used to produce a frequency which is a ratio
against the current notesFrq (the build methods note.getPitch()) variable
setting.
It is common to use WaveTables as oscillators and even more common for these
oscillators to based on simple wave forms. Simple wave forms in jMusic can
be retrieved using static method calls to the Oscillator class.
- Version:
- 1.0,Sun Feb 25 18:42:52 2001
| Field Summary | |
private float |
amp
Value to use as a fixed amplitude for the waveTable. |
static int |
AMPLITUDE
constant for use with aoDestination |
private int |
aoDestination
If we have one audio object input is at amp(0) or freq(1) ? |
static int |
FREQUENCY
constant for use with aoDestination |
private float |
frq
Value to use as a fixed frequency for the waveTable. |
private float |
frqRatio
Frequency ratio allows an incoming note's pitch to be adjusted to a fixed ratio amount |
static int |
MONO
constant for use with channels |
private float |
phase
what is the phase of the wavetable to start at |
private float |
si
how many samples to we skip while passing through the wavetable |
static int |
STEREO
constant for use with channels |
private float[] |
waveTable
this contains the wavetable data as samples |
| Fields inherited from class jm.audio.AudioObject |
channels, currentNote, currentNoteStartTime, finished, inputs, inst, name, next, numOfSamples, previous, sampleRate |
| Fields inherited from interface jm.JMC |
DEBUG, DYNAMIC, EIGHT_BIT, KEY_SIG_EVT, NO_DENOMINATOR, NO_INSTRUMENT, NO_KEY_QUALITY, NO_KEY_SIGNATURE, NO_NUMERATOR, OCTAPHONIC, PAN, PITCH, PROG_EVT, QUADRAPHONIC, RHYTHM, SIXTEEN_BIT, TEMP_EVT, THIRTY_TWO_BIT, TIME_SIG_EVT, VERBOSE |
| Fields inherited from interface jm.constants.Durations |
C, CD, CDD, CROTCHET, CROTCHET_TRIPLET, CT, DC, DDC, DDEN, DDHN, DDM, DDQ, DDQN, DEMI_SEMI_QUAVER, DEMI_SEMI_QUAVER_TRIPLET, DEN, DHN, DM, DOTTED_CROTCHET, DOTTED_EIGHTH_NOTE, DOTTED_HALF_NOTE, DOTTED_MINIM, DOTTED_QUARTER_NOTE, DOTTED_QUAVER, DOTTED_SEMI_QUAVER, DOTTED_SIXTEENTH_NOTE, DOUBLE_DOTTED_CROTCHET, DOUBLE_DOTTED_EIGHTH_NOTE, DOUBLE_DOTTED_HALF_NOTE, DOUBLE_DOTTED_MINIM, DOUBLE_DOTTED_QUARTER_NOTE, DOUBLE_DOTTED_QUAVER, DQ, DQN, DSN, DSQ, DSQT, EIGHTH_NOTE, EIGHTH_NOTE_TRIPLET, EN, ENT, HALF_NOTE, HALF_NOTE_TRIPLET, HN, HNT, M, MD, MDD, MINIM, MINIM_TRIPLET, MT, Q, QD, QDD, QN, QNT, QT, QUARTER_NOTE, QUARTER_NOTE_TRIPLET, QUAVER, QUAVER_TRIPLET, SB, SEMI_QUAVER, SEMI_QUAVER_TRIPLET, SEMIBREVE, SIXTEENTH_NOTE, SIXTEENTH_NOTE_TRIPLET, SN, SNT, SQ, SQD, SQT, THIRTYSECOND_NOTE, THIRTYSECOND_NOTE_TRIPLET, TN, TNT, TSN, TSNT, WHOLE_NOTE, WN |
| Fields inherited from interface jm.constants.Frequencies |
FRQ |
| Fields inherited from interface jm.constants.Tunings |
EQUAL, JUST, MEAN, PYTHAGOREAN |
| Fields inherited from interface jm.constants.Volumes |
F, FF, FFF, FORTE, FORTISSIMO, MEZZO_FORTE, MEZZO_PIANO, MF, MP, P, PIANISSIMO, PP, PPP, SILENT |
| Fields inherited from interface jm.constants.Panning |
PAN_CENTER, PAN_CENTRE, PAN_LEFT, PAN_RIGHT |
| Fields inherited from interface jm.constants.DrumMap |
ACOUSTIC_BASS_DRUM, ACOUSTIC_SNARE, BASS_DRUM_1, CABASA, CHINESE_CYMBAL, CLAVES, CLOSED_HI_HAT, COWBELL, CRASH_CYMBAL_1, CRASH_CYMBAL_2, ELECTRIC_SNARE, HAND_CLAP, HI_BONGO, HI_MID_TOM, HI_WOOD_BLOCK, HIGH_AGOGO, HIGH_FLOOR_TOM, HIGH_TIMBALE, HIGH_TOM, LONG_GUIRO, LONG_WHISTLE, LOW_AGOGO, LOW_BONGO, LOW_CONGA, LOW_FLOOR_TOM, LOW_MID_TOM, LOW_TIMBALE, LOW_TOM, LOW_WOOD_BLOCK, MARACAS, MUTE_CUICA, MUTE_HI_CONGA, MUTE_TRIANGLE, OPEN_CUICA, OPEN_HI_CONGA, OPEN_HI_HAT, OPEN_TRIANGLE, PEDAL_HI_HAT, RIDE_BELL, RIDE_CYMBAL_1, RIDE_CYMBAL_2, SHORT_GUIRO, SHORT_WHISTLE, SIDE_STICK, SPLASH_CYMBAL, TAMBOURINE, VIBRASLAP |
| Fields inherited from interface jm.constants.Scales |
AEOLIAN_SCALE, BLUES_SCALE, CHROMATIC_SCALE, DIATONIC_MINOR_SCALE, DORIAN_SCALE, HARMONIC_MINOR_SCALE, INDIAN_SCALE, LYDIAN_SCALE, MAJOR_SCALE, MELODIC_MINOR_SCALE, MINOR_SCALE, MIXOLYDIAN_SCALE, NATURAL_MINOR_SCALE, PENTATONIC_SCALE, TURKISH_SCALE |
| Fields inherited from interface jm.constants.Waveforms |
COSINE_WAVE, PULSE_WAVE, SABERSAW_WAVE, SAWDOWN_WAVE, SAWTOOTH_WAVE, SINE_WAVE, SQUARE_WAVE, TRIANGLE_WAVE |
| Fields inherited from interface jm.constants.Noises |
BROWN_NOISE, FRACTAL_NOISE, SMOOTH_NOISE, STEP_NOISE, WHITE_NOISE |
| Fields inherited from interface jm.constants.Alignments |
AFTER, BEFORE, CENTER_ALIGN, CENTER_ON_END, CENTER_ON_START, CENTRE_ALIGN, CENTRE_ON_END, CENTRE_ON_START, END_ON_CENTER, END_ON_CENTRE, END_TOGETHER, START_ON_CENTER, START_ON_CENTRE, START_TOGETHER |
| Constructor Summary | |
WaveTable(jm.audio.AudioObject[] ao,
float[] waveTable)
This constructor sets the WaveTable to act as a processor object taking in two inputs. |
|
WaveTable(jm.audio.AudioObject ao,
float[] waveTable,
int aoDestination)
This constructor sets the WaveTable to act as a processor object taking in one input. |
|
WaveTable(jm.audio.Instrument inst,
int sampleRate,
float[] waveTable,
int channels)
This constructor sets this wavetable up as a generator object meaning that it will pass sample information down the chain based on its wave table data. Set WaveTable with some initial values including the sampling rate and the samples to use for this wave table |
|
WaveTable(jm.audio.Instrument inst,
int sampleRate,
float[] waveTable,
int channels,
int aoDestination,
float val)
This constructor sets the WaveTable to act as a generator object taking in one input. |
|
| Method Summary | |
void |
build()
The build method can be overriden by Audio Objects to provide any extra initialization that may be required before the Audio Object can be used for each new note that needs rendering. |
void |
setAmp(float amp)
Set the fixed amp of this wavetable |
void |
setFrq(float frq)
Set the fixed Frequecy of this wavetable |
void |
setFrqRatio(float frqRatio)
Sets the frequency ratio to alter a notes pitch by |
protected void |
setSI(float frequency)
Returns the sampling increment which is used to nextWork out how many samples in the wavetable skip on each pass. |
int |
work(float[] buffer)
Moves through the WaveTable array (noramally forwards but sometimes backwards) by increments set by si (sample increment value). |
| Methods inherited from class jm.audio.AudioObject |
buildNext, getChannels, getSampleRate, newNote, nextWork |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
waveTable
private float[] waveTable
- this contains the wavetable data as samples
si
private float si
- how many samples to we skip while passing through the wavetable
phase
private float phase
- what is the phase of the wavetable to start at
aoDestination
private int aoDestination
- If we have one audio object input is at amp(0) or freq(1) ?
amp
private float amp
- Value to use as a fixed amplitude for the waveTable.
frq
private float frq
- Value to use as a fixed frequency for the waveTable.
frqRatio
private float frqRatio
- Frequency ratio allows an incoming note's pitch to be adjusted to a
fixed ratio amount
AMPLITUDE
public static final int AMPLITUDE
- constant for use with aoDestination
- See Also:
- Constant Field Values
FREQUENCY
public static final int FREQUENCY
- constant for use with aoDestination
- See Also:
- Constant Field Values
MONO
public static final int MONO
- constant for use with channels
- See Also:
- Constant Field Values
STEREO
public static final int STEREO
- constant for use with channels
- See Also:
- Constant Field Values
| Constructor Detail |
WaveTable
public WaveTable(jm.audio.AudioObject[] ao, float[] waveTable) throws jm.audio.AOException
- This constructor sets the WaveTable to act as
a processor object taking in two inputs. Input
one is defined as amplitude and input two is
defined as frequency.
WaveTable
public WaveTable(jm.audio.AudioObject ao, float[] waveTable, int aoDestination)
- This constructor sets the WaveTable to act as
a processor object taking in one input. That
input can be either amplitude(0) or frequency(1)
and is defined by the aoDestination variable (int).
WaveTable
public WaveTable(jm.audio.Instrument inst, int sampleRate, float[] waveTable, int channels, int aoDestination, float val)
- This constructor sets the WaveTable to act as
a generator object taking in one input. That
input can be either amplitude(0) or frequency(1)
and is defined by the aoDestination variable (int).
WaveTable
public WaveTable(jm.audio.Instrument inst, int sampleRate, float[] waveTable, int channels)
- This constructor sets this wavetable up as a generator
object meaning that it will pass sample information
down the chain based on its wave table data.
Set WaveTable with some initial values including the sampling rate and the samples to use for this wave table
| Method Detail |
work
public int work(float[] buffer)
throws jm.audio.AOException
- Moves through the WaveTable array (noramally forwards but sometimes
backwards) by increments set by si (sample increment value). This nextWork
method can take one or two inputs which are either amplitude, frequency
or both (a single input can be assigned to either frequency or amplitude
by assigning the aoDestination value to either (0)Amp or (1)Frq in the
appropriate constructor. A WaveTable that takes two inputs expects the
first input to be amplitude and the second input to be frequency.
build
public void build()
- Description copied from class:
jm.audio.AudioObject - The build method can be overriden by Audio Objects
to provide any extra initialization that may be
required before the Audio Object can be used for
each new note that needs rendering. The AudioObject parameters
currentNote, currentNoteStartTime and numOfSamples will provide
any note specific information that the build method may need to
utilise.
setAmp
public void setAmp(float amp)
- Set the fixed amp of this wavetable
setFrq
public void setFrq(float frq)
- Set the fixed Frequecy of this wavetable
setFrqRatio
public void setFrqRatio(float frqRatio)
- Sets the frequency ratio to alter a notes pitch by
setSI
protected void setSI(float frequency)
- Returns the sampling increment which is used
to nextWork out how many samples in the wavetable
skip on each pass.
|
|||||||||
| Home >> All >> jm >> audio >> [ synth overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC