mirror of
https://github.com/ggerganov/ggwave.git
synced 2026-04-20 21:26:30 +08:00
js : fix test and example
This commit is contained in:
@@ -137,7 +137,9 @@
|
|||||||
recorder.onaudioprocess = function (e) {
|
recorder.onaudioprocess = function (e) {
|
||||||
var source = e.inputBuffer;
|
var source = e.inputBuffer;
|
||||||
var res = ggwave.decode(instance, convertTypedArray(new Float32Array(source.getChannelData(0)), Int8Array));
|
var res = ggwave.decode(instance, convertTypedArray(new Float32Array(source.getChannelData(0)), Int8Array));
|
||||||
|
|
||||||
if (res && res.length > 0) {
|
if (res && res.length > 0) {
|
||||||
|
res = new TextDecoder("utf-8").decode(res);
|
||||||
rxData.value = res;
|
rxData.value = res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ factory().then(function(ggwave) {
|
|||||||
// decode the audio waveform back to text
|
// decode the audio waveform back to text
|
||||||
var res = ggwave.decode(instance, waveform);
|
var res = ggwave.decode(instance, waveform);
|
||||||
|
|
||||||
if (res != payload) {
|
if (new TextDecoder("utf-8").decode(res) != payload) {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user