syl22-00 / pocketsphinx.js

Speech recognition in JavaScript and WebAssembly

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Buffer in recognizer uses obsolete data on multiple "process"-requests

laudenberg opened this issue · comments

Sending multiple "process"-requests to the recognizer, where the latter data length is shorter than the former, leads recognizer.js to only override the front portion of the data, leaving older data in the end of the buffer:

while (buffer.size() < array.length)
    buffer.push_back(0);
for (var i = 0 ; i < array.length ; i++)
    buffer.set(i, array[i]);

https://github.com/syl22-00/pocketsphinx.js/blob/master/webapp/js/recognizer.js#L284-L287