Najibsaurus / VoiceBot-Watson

Simple chatbot using IBM Watson (STT, TTS, Assistant)
Apache License 2.0
13 stars 23 forks source link

Speech to text not working #1

Closed kif01 closed 4 years ago

kif01 commented 4 years ago

Hey Najib, so I cloned the code and added my credentials, but when I record my voice, the voice's length is 0 and I get this following error: Error: { Error: Stream was 44 bytes but needs to be at least 100 bytes.

Najibsaurus commented 4 years ago

Hi @kif01 , thanks for reaching out. Are you using Google Chrome as your browser ? The issue cause the policy of playing audio file on it. You could check the audio policiy in here

So, you need to add the code on /js/audio.js on line 16 :

var onSuccess = function (stream) {
  audioContext.resume();
  inputPoint = audioContext.createGain();
  audioInput = audioContext.createMediaStreamSource(stream);
  audioInput.connect(inputPoint);
  recorder = new Recorder(inputPoint);
  recorder.clear();
  recorder.record();
};

Regards,

kif01 commented 4 years ago

Thank you!