bugfix
This commit is contained in:
parent
c9e0956498
commit
678c3b46e0
@ -84,7 +84,7 @@ bricks.VadText = class extends bricks.VBox {
|
|||||||
w.open();
|
w.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function arrayBufferToBase64(wavBuffer) {
|
arrayBufferToBase64(wavBuffer) {
|
||||||
let binary = '';
|
let binary = '';
|
||||||
const bytes = new Uint8Array(wavBuffer);
|
const bytes = new Uint8Array(wavBuffer);
|
||||||
for (let i = 0; i < bytes.byteLength; i++) {
|
for (let i = 0; i < bytes.byteLength; i++) {
|
||||||
@ -92,7 +92,7 @@ bricks.VadText = class extends bricks.VBox {
|
|||||||
}
|
}
|
||||||
return btoa(binary);
|
return btoa(binary);
|
||||||
}
|
}
|
||||||
function floatArrayToWAV(floatArray, sampleRate = 22000) {
|
floatArrayToWAV(floatArray, sampleRate = 22000) {
|
||||||
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
||||||
const buffer = audioCtx.createBuffer(1, floatArray.length, sampleRate);
|
const buffer = audioCtx.createBuffer(1, floatArray.length, sampleRate);
|
||||||
buffer.getChannelData(0).set(floatArray);
|
buffer.getChannelData(0).set(floatArray);
|
||||||
|
Loading…
Reference in New Issue
Block a user