Adjust trim silence parameters to make it less aggressive.
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=208071000
This commit is contained in:
parent
93f591be3e
commit
4b2e382725
@ -33,12 +33,12 @@ public final class SilenceSkippingAudioProcessor implements AudioProcessor {
|
|||||||
* The minimum duration of audio that must be below {@link #SILENCE_THRESHOLD_LEVEL} to classify
|
* The minimum duration of audio that must be below {@link #SILENCE_THRESHOLD_LEVEL} to classify
|
||||||
* that part of audio as silent, in microseconds.
|
* that part of audio as silent, in microseconds.
|
||||||
*/
|
*/
|
||||||
private static final long MINIMUM_SILENCE_DURATION_US = 100_000;
|
private static final long MINIMUM_SILENCE_DURATION_US = 150_000;
|
||||||
/**
|
/**
|
||||||
* The duration of silence by which to extend non-silent sections, in microseconds. The value must
|
* The duration of silence by which to extend non-silent sections, in microseconds. The value must
|
||||||
* not exceed {@link #MINIMUM_SILENCE_DURATION_US}.
|
* not exceed {@link #MINIMUM_SILENCE_DURATION_US}.
|
||||||
*/
|
*/
|
||||||
private static final long PADDING_SILENCE_US = 10_000;
|
private static final long PADDING_SILENCE_US = 20_000;
|
||||||
/**
|
/**
|
||||||
* The absolute level below which an individual PCM sample is classified as silent. Note: the
|
* The absolute level below which an individual PCM sample is classified as silent. Note: the
|
||||||
* specified value will be rounded so that the threshold check only depends on the more
|
* specified value will be rounded so that the threshold check only depends on the more
|
||||||
|
@ -210,8 +210,8 @@ public final class SilenceSkippingAudioProcessorTest {
|
|||||||
process(silenceSkippingAudioProcessor, inputBufferProvider, INPUT_BUFFER_SIZE);
|
process(silenceSkippingAudioProcessor, inputBufferProvider, INPUT_BUFFER_SIZE);
|
||||||
|
|
||||||
// The right number of frames are skipped/output.
|
// The right number of frames are skipped/output.
|
||||||
assertThat(totalOutputFrames).isEqualTo(53990);
|
assertThat(totalOutputFrames).isEqualTo(57980);
|
||||||
assertThat(silenceSkippingAudioProcessor.getSkippedFrames()).isEqualTo(46010);
|
assertThat(silenceSkippingAudioProcessor.getSkippedFrames()).isEqualTo(42020);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -240,8 +240,8 @@ public final class SilenceSkippingAudioProcessorTest {
|
|||||||
process(silenceSkippingAudioProcessor, inputBufferProvider, /* inputBufferSize= */ 80);
|
process(silenceSkippingAudioProcessor, inputBufferProvider, /* inputBufferSize= */ 80);
|
||||||
|
|
||||||
// The right number of frames are skipped/output.
|
// The right number of frames are skipped/output.
|
||||||
assertThat(totalOutputFrames).isEqualTo(53990);
|
assertThat(totalOutputFrames).isEqualTo(57980);
|
||||||
assertThat(silenceSkippingAudioProcessor.getSkippedFrames()).isEqualTo(46010);
|
assertThat(silenceSkippingAudioProcessor.getSkippedFrames()).isEqualTo(42020);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -270,8 +270,8 @@ public final class SilenceSkippingAudioProcessorTest {
|
|||||||
process(silenceSkippingAudioProcessor, inputBufferProvider, /* inputBufferSize= */ 120);
|
process(silenceSkippingAudioProcessor, inputBufferProvider, /* inputBufferSize= */ 120);
|
||||||
|
|
||||||
// The right number of frames are skipped/output.
|
// The right number of frames are skipped/output.
|
||||||
assertThat(totalOutputFrames).isEqualTo(53990);
|
assertThat(totalOutputFrames).isEqualTo(57980);
|
||||||
assertThat(silenceSkippingAudioProcessor.getSkippedFrames()).isEqualTo(46010);
|
assertThat(silenceSkippingAudioProcessor.getSkippedFrames()).isEqualTo(42020);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user