public class ExpanderEffect
extends java.lang.Object
Expander| Constructor and Description |
|---|
ExpanderEffect(float threshold,
double ratio,
int attack,
int release,
double gain,
boolean autoGain,
java.lang.String detectionType,
int thresholdWidth,
float sampleRate)
Creates an Expander effect
|
| Modifier and Type | Method and Description |
|---|---|
short |
getRegionAverage(short[] currentChunk,
int currentPosition)
Method to calculate the threshold when 'Regional Average' is selected.
|
short |
getRegionMax(short[] currentChunk,
int currentPosition)
Method to calculate the threshold when 'Regional Max' is selected.
|
short |
getRegionRMS(short[] currentChunk,
int currentPosition)
Method to calculate the threshold when 'Regional RMS' is selected.
|
short[] |
process(short[] input)
Process method that compresses the audio.
|
void |
setAttackTime(int att)
Sets the compressor's attack time in samples, after converting from milliseconds
|
void |
setAutoGain(boolean auto)
Selects if the signal will be normalised before outputting
|
void |
setDetectionType(java.lang.String detect)
Sets the type of threshold calculator that will be used (Peak, RMS, Region Average or Region Max)
|
void |
setGain(double vol)
Sets the make up gain.
|
void |
setRatio(double rat)
Sets the compression ratio.
|
void |
setReleaseTime(int rel)
Sets the compressors release time in samples, after converting from milliseconds
|
void |
setThreshold(float thresh)
Sets the threshold level in DECIBELS.
|
void |
setThresholdWidth(int tWidth)
Sets the threshold width that will be used in samples, after converting from milliseconds.
|
public ExpanderEffect(float threshold,
double ratio,
int attack,
int release,
double gain,
boolean autoGain,
java.lang.String detectionType,
int thresholdWidth,
float sampleRate)
threshold - the threshold level in (negative) decibels. When the signal goes under this threshold,
expansion is appliedratio - the expansion ratio is the ratio of change of the input signal versus the change in the
output signalattack - the time taken before the expander kicks into action. In milliseconds.release - the time taken for the 'expansion' to stop after the signal falls below the threshold. In
milliseconds.gain - make up gain to boost the signal level after expansionautoGain - boolean value to indicate if the user wishes to automatically normalise the audio after
compressiondetectionType - multiple choice string input which chooses the type of choices by process method to choose
suitable method. Chooses between Peak, Region Average, Region Max, and RMS.thresholdWidth - the size of the window which is the 'region' being examined too be able to set the
thresholdsampleRate - the sample rate of the incoming audiopublic void setThreshold(float thresh)
thresh - this is an integer value, which is converted to a decibel value, relative to the maximum short value
of 32767public void setRatio(double rat)
rat - this is compression ratio value. Any samples which are over the threshold level are divided by this
value, but first taking into account the attack/release timespublic void setAttackTime(int att)
att - this is the size of the attack 'delay'. This is used to set delay before the compression is applied, and
create the compression envelopepublic void setReleaseTime(int rel)
rel - this is the size of the release 'delay'. This is used before the compression is stopped being applied,
and creates the compression release envelopepublic void setGain(double vol)
vol - this can be used to increase the volume of the signal, after compression. This is in decibels
(logarithmic).public void setDetectionType(java.lang.String detect)
detect - this is the type of threshold calculator which will be used.public void setThresholdWidth(int tWidth)
tWidth - this is the threshold width, in milliseconds. This method is used to convert tWidth to samples.public void setAutoGain(boolean auto)
auto - this is a boolean variable. This is used to to decide if the signal will be normalised to 100%, or if
the make up gain is usedpublic short getRegionMax(short[] currentChunk,
int currentPosition)
currentChunk - the current short array or 'audio chunk' being considered. If chunking is not being used,
this will stay constant.currentPosition - the current position of the sample being considered in for loop in the process method.public short getRegionAverage(short[] currentChunk,
int currentPosition)
currentChunk - the current short array or 'audio chunk' being considered. If chunking is not being used,
this will stay constant.currentPosition - the current position of the sample being considered in for loop in the process method.public short getRegionRMS(short[] currentChunk,
int currentPosition)
currentChunk - the current short array or 'audio chunk' being considered. If chunking is not being used,
this will stay constant.currentPosition - the current position of the sample being considered in for loop in the process method.public short[] process(short[] input)
input - short array containing the input data to be manipulated by algorithm