mirror of
https://github.com/DanielSWolf/rhubarb-lip-sync.git
synced 2026-11-21 12:25:08 +00:00
Removing zero silence, seems like Sphinx doesn't like it
See http://cmusphinx.sourceforge.net/wiki/faq#qwhy_my_accuracy_is_poor I couldn't reproduce the original problem, but it doesn't seem to hurt, either.
This commit is contained in:
@@ -90,10 +90,20 @@ void processAudioStream(AudioStream& audioStream16kHzMono, ps_decoder_t& recogni
|
||||
do {
|
||||
// Read to buffer
|
||||
buffer.clear();
|
||||
int16_t lastSample = INT16_MIN;
|
||||
while (buffer.size() < capacity) {
|
||||
float sample;
|
||||
if (!audioStream16kHzMono.getNextSample(sample)) break;
|
||||
buffer.push_back(floatSampleToInt16(sample));
|
||||
// Read sample
|
||||
float floatSample;
|
||||
if (!audioStream16kHzMono.getNextSample(floatSample)) break;
|
||||
int16_t sample = floatSampleToInt16(floatSample);
|
||||
|
||||
// Remove zero silence (see http://cmusphinx.sourceforge.net/wiki/faq#qwhy_my_accuracy_is_poor)
|
||||
if (sample == lastSample) {
|
||||
sample += (sample < INT16_MAX) ? 1 : -1;
|
||||
}
|
||||
lastSample = sample;
|
||||
|
||||
buffer.push_back(sample);
|
||||
}
|
||||
|
||||
// Analyze buffer
|
||||
|
||||
Reference in New Issue
Block a user