You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got the above failure error message
the code snippet:
audioCtx = new AudioContext,
Speaker = require('speaker');
audioCtx.outStream = new Speaker({
channels: audioCtx.format.numberOfChannels,
bitDepth: audioCtx.format.bitDepth,
sampleRate: audioCtx.sampleRate
})
let data;
let count;
let startTime;
var WebSocket = require('ws');
var wsUri = "ws://" + xlVAServer[0].wsURI;
console.log("Connecting to " + wsUri);
var ws = new WebSocket(wsUri);
ws.onopen = function(evt) { onOpen(evt) };
ws.onclose = function(evt) { onClose(evt) };
ws.onmessage = function(evt) { onMessage(evt) };
ws.onerror = function(evt) { onError(evt) };
// Event Handlers to websocket connection
function onOpen(evt) {
console.log("Connected to server");
}
function onClose(evt) {
console.log("Disconnected from server");
}
function onError(evt) {
console.log("Communication error");
}
function onMessage(evt) {
console.log("Receiving data on websocket ...");
if (evt.data instanceof ArrayBuffer)
{
if (count == 0) {
startTime = audioCtx.currentTime;
}
audioCtx.decodeAudioData(evt.data, function(data) {
count++;
startTime = startTime + 0.3;
let duration = playSound(data, startTime);
console.log('Duration: ' + duration);
startTime = startTime + duration;
});
}
}
function playSound(buffer, playTime)
{
let source = audioCtx.createBufferSource();
console.log('Audio playback...');
source.buffer = buffer;
source.start(playTime);
source.connect(audioCtx.destination);
console.log('connect destination ');
let duration = buffer.duration;
return duration;
}
function perform_tts(text)
{
data = new ArrayBuffer(0);
count = 0;
ws.binaryType = "arraybuffer";
console.log('Sending text ' + text);
ws.send(text);
}
export async function playAudio(text, image_name, start_delay, end_delay) {
switch(xlVAServer[0].useTL_TTS) {
case 'yes':
return perform_tts(text);
The text was updated successfully, but these errors were encountered:
LayMuiToh
changed the title
Didn't have any audio data in callback (buffer underflow)
[../deps/mpg123/src/output/coreaudio.c:81] warning: Didn't have any audio data in callback (buffer underflow)
Apr 9, 2019
I got the above failure error message
the code snippet:
The text was updated successfully, but these errors were encountered: