Class EchoFilter
java.lang.Object
fr.paris.lutece.plugins.captcha.modules.jcaptcha.service.sound.filter.SoundFilter
fr.paris.lutece.plugins.captcha.modules.jcaptcha.service.sound.filter.EchoFilter
-
Constructor Summary
ConstructorsConstructorDescriptionEchoFilter(float echoDelay, float decay) Creates an EchoFilter with the specified number of delay samples and the specified decay rate. -
Method Summary
Modifier and TypeMethodDescriptionvoidfilter(byte[] samples, int offset, int length, int sampleSizeInBits) Filters the sound samples to add an echo.intGets the remaining size, in bytes, of samples that this filter can echo after the sound is done playing.voidreset()Clears this EchoFilter's internal delay buffer.Methods inherited from class fr.paris.lutece.plugins.captcha.modules.jcaptcha.service.sound.filter.SoundFilter
get16bitSample, get8bitSample, getAudioFormat, set16bitSample, set8bitSample
-
Constructor Details
-
EchoFilter
public EchoFilter(float echoDelay, float decay) Creates an EchoFilter with the specified number of delay samples and the specified decay rate.The number of delay samples specifies how long before the echo is initially heard. For a 1 second echo with mono, 44100Hz sound, use 44100 delay samples.
The decay value is how much the echo has decayed from the source. A decay value of .5 means the echo heard is half as loud as the source.
- Parameters:
echoDelay- the echoDelaydecay- the decay
-
-
Method Details
-
getRemainingSize
public int getRemainingSize()Gets the remaining size, in bytes, of samples that this filter can echo after the sound is done playing. Ensures that the sound will have decayed to below 1% of maximum volume (amplitude).- Overrides:
getRemainingSizein classSoundFilter- Returns:
- the Remaining Size
-
reset
public void reset()Clears this EchoFilter's internal delay buffer.- Overrides:
resetin classSoundFilter
-
filter
public void filter(byte[] samples, int offset, int length, int sampleSizeInBits) Filters the sound samples to add an echo. The samples played are added to the sound in the delay buffer multipied by the decay rate. The result is then stored in the delay buffer, so multiple echoes are heard.- Specified by:
filterin classSoundFilter- Parameters:
samples- the samplesoffset- the offsetlength- the lengthsampleSizeInBits- the sample size in bits
-