|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object be.hogent.tarsos.dsp.EnvelopeFollower
public class EnvelopeFollower
An envelope follower follows the envelope of a signal. Sometimes the name envelope detector is used. From wikipedia:
An envelope detector is an electronic circuit that takes a high-frequency signal as input and provides an output which is the envelope of the original signal. The capacitor in the circuit stores up charge on the rising edge, and releases it slowly through the resistor when the signal falls. The diode in series rectifies the incoming signal, allowing current flow only when the positive input terminal is at a higher potential than the negative input terminal.The resulting envelope is stored in the buffer in the processed AudioEvent. The class can be used thusly:
EnvelopeFollower follower = new EnvelopeFollower(44100); AudioDispatcher dispatcher = AudioDispatcher.fromFloatArray(sine, 44100, 1024, 0); dispatcher.addAudioProcessor(follower); dispatcher.addAudioProcessor(new AudioProcessor() { public boolean process(AudioEvent audioEvent) { //envelope float buffer[] = audioEvent.getFloatBuffer(); for(int i = 0 ; i < buffer.length ; i++){ System.out.println(buffer[i]); } return true; } public void processingFinished() { } }); dispatcher.run();
Constructor Summary | |
---|---|
EnvelopeFollower(double sampleRate)
Create a new envelope follower, with a certain sample rate. |
|
EnvelopeFollower(double sampleRate,
double attackTime,
double releaseTime)
Create a new envelope follower, with a certain sample rate. |
Method Summary | |
---|---|
void |
calculateEnvelope(float[] buffer)
|
boolean |
process(AudioEvent audioEvent)
Process the audio event. |
void |
processingFinished()
Notify the AudioProcessor that no more data is available and processing has finished. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EnvelopeFollower(double sampleRate)
sampleRate
- The sample rate of the audio signal.public EnvelopeFollower(double sampleRate, double attackTime, double releaseTime)
sampleRate
- The sample rate of the audio signal.attackTime
- Defines how fast the envelope raises, defined in seconds.releaseTime
- Defines how fast the envelope goes down, defined in seconds.Method Detail |
---|
public boolean process(AudioEvent audioEvent)
AudioProcessor
process
in interface AudioProcessor
audioEvent
- The audio event that contains audio data.
public void calculateEnvelope(float[] buffer)
public void processingFinished()
AudioProcessor
processingFinished
in interface AudioProcessor
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |