bugfix
This commit is contained in:
parent
ed8bf43c7f
commit
07d03dc421
@ -61,7 +61,7 @@ bricks.VadText = class extends bricks.VBox {
|
||||
}
|
||||
async handle_audio(audio){
|
||||
console.log('handle_audil() called', audio);
|
||||
var wavBuffer = this.floatArrayToWAV(audio, sampleRate=16000);
|
||||
var wavBuffer = this.floatArrayToWAV(audio, 16000);
|
||||
var b64audio = this.arrayBufferToBase64(wavBuffer);
|
||||
this.audio.set_url('data:audio/wav;base64,' + b64audio);
|
||||
var hj = new bricks.HttpJson();
|
||||
@ -92,7 +92,7 @@ bricks.VadText = class extends bricks.VBox {
|
||||
}
|
||||
return btoa(binary);
|
||||
}
|
||||
floatArrayToWAV(floatArray, sampleRate = 22000) {
|
||||
floatArrayToWAV(floatArray, sampleRate) {
|
||||
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
||||
const buffer = audioCtx.createBuffer(1, floatArray.length, sampleRate);
|
||||
buffer.getChannelData(0).set(floatArray);
|
||||
|
Loading…
Reference in New Issue
Block a user