js : fix test and example

This commit is contained in:
Georgi Gerganov
2022-05-02 19:39:59 +03:00
parent fb4f0b15d0
commit 81f7647c81
2 changed files with 3 additions and 1 deletions

View File

@@ -137,7 +137,9 @@
recorder.onaudioprocess = function (e) {
var source = e.inputBuffer;
var res = ggwave.decode(instance, convertTypedArray(new Float32Array(source.getChannelData(0)), Int8Array));
if (res && res.length > 0) {
res = new TextDecoder("utf-8").decode(res);
rxData.value = res;
}

View File

@@ -13,7 +13,7 @@ factory().then(function(ggwave) {
// decode the audio waveform back to text
var res = ggwave.decode(instance, waveform);
if (res != payload) {
if (new TextDecoder("utf-8").decode(res) != payload) {
process.exit(1);
}
});