Hotwords won't trigger on bumblebee-hotword-node

19 views Asked by At

I'm trying to setup bumblebee (bumblebee-hotword-node) within a server that will listen to a discord server for the 'bumblebee' hotword derived from https://github.com/SteTR/Emost-Bot/tree/master

So far I have got the tool integrated and emitting 'data', but it never fires the 'hotspot' callback when i say "bumblebee".

I am not sure whether I have the wrong format for the stream perhaps that is going into it, or doing something else wrong.

converter.js - Where we convert the discord stream into the appropriate format

const ffmpegPath = require("@ffmpeg-installer/ffmpeg").path;
const ffmpeg = require("fluent-ffmpeg");
ffmpeg.setFfmpegPath(ffmpegPath);
/**
 * Creates a audio stream convert to convert one audio stream's format to another.
 * E.g. 48000 Hz 2 channel to 16000 Hz 1 channel
 * @param stream input audio stream
 * @param inputArray array of flags for ffmpeg to describe input format
 * @param outputArray  array of flags for ffmpeg to describe output format
 * @param formatType REQUIRED. the format of the output (e.g. s16le)
 * @returns {stream.Writable|{end: boolean}|*} a new stream that has converted the input audio stream into the format requested
 */
function createConverter(
  stream,
  inputArray = ["-f s16le", "-ac 2", "-ar 44100"],
  outputArray = ["-ac 1", "-ar 16000"],
  formatType = "s16le"
) {
  return new ffmpeg()
    .input(stream)
    .inputOptions(inputArray)
    .outputOptions(outputArray)
    .format(formatType)
    .pipe({ end: false });
}

module.exports = { createConverter };

Connect.js - Where stream is converted and then fed to Voice

const listenStream = await connection.receiver
        .subscribe(member.user.id, {
          end: {
            behavior: EndBehaviorType.Manual,
          },
        })
        .on("error", (error) => {
          console.log("audioReceiveStream error: ", error);
        });

      // // // Make voice streams for voice commands
      const voiceRecorderStream = createConverter(listenStream);


      voiceRecorderStream.on('data',(data)=>{
        console.log(data)
      })
      const vr = new VoiceRecognitionService(
        hotword,
        connection,
        voiceRecorderStream
      );

I have tried to alter the conversion and I have been scanning the logs to see if this is working - I am getting data back through the converted stream with .on('data') - But Bumblebee will not trigger for the hotword I have set (bumblebee).

I have also printed within the bumblebee-hotword-node packages and it appears it is processing the audio just fine and porcupine just isn't flagging when I speak the hotword.

Any help or suggestions are appreciated!

0

There are 0 answers