File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,7 @@ export class FrameProcessor implements FrameProcessorInterface {
144
144
145
145
reset = ( ) => {
146
146
this . speaking = false
147
+ this . speechRealStartFired = false
147
148
this . audioBuffer = [ ]
148
149
this . modelResetFunc ( )
149
150
this . redemptionCounter = 0
@@ -169,11 +170,10 @@ export class FrameProcessor implements FrameProcessorInterface {
169
170
const speaking = this . speaking
170
171
this . reset ( )
171
172
172
- const speechFrameCount = audioBuffer . reduce ( ( acc , item ) => {
173
- return acc + + item . isSpeech
174
- } , 0 )
175
-
176
173
if ( speaking ) {
174
+ const speechFrameCount = audioBuffer . reduce ( ( acc , item ) => {
175
+ return item . isSpeech ? ( acc + 1 ) : acc
176
+ } , 0 )
177
177
if ( speechFrameCount >= this . options . minSpeechFrames ) {
178
178
const audio = concatArrays ( audioBuffer . map ( ( item ) => item . frame ) )
179
179
handleEvent ( { msg : Message . SpeechEnd , audio } )
@@ -234,7 +234,7 @@ export class FrameProcessor implements FrameProcessorInterface {
234
234
this . audioBuffer = [ ]
235
235
236
236
const speechFrameCount = audioBuffer . reduce ( ( acc , item ) => {
237
- return acc + + item . isSpeech
237
+ return item . isSpeech ? ( acc + 1 ) : acc
238
238
} , 0 )
239
239
240
240
if ( speechFrameCount >= this . options . minSpeechFrames ) {
You can’t perform that action at this time.
0 commit comments