evancohen / sonus

:speech_balloon: /so.nus/ STT (speech to text) for Node with offline hotword detection
MIT License
619 stars 79 forks source link

Text to speech #47

Open sharmmoh1983 opened 7 years ago

sharmmoh1983 commented 7 years ago

Are you planning to use any text to speech conversion

sharmmoh1983 commented 7 years ago

like Amazon polly

evancohen commented 7 years ago

I'd considered baking it into the library #25 but it's so simple to add on I'm not sure it's worth it. Super simple sudocode example of how could do this:

sonus.on('final-result', result => {
  intent.process(result, => (response, prompt) {
    say.speek(response)
    if(prompt) {
      sonus.trigger(sonus, 0, 'some hotword')
    }
  }
})
sharmmoh1983 commented 7 years ago

what is this intent process and prompt.I need to implement session using hotword so as long as session is open i don't want hotrod to be associated with statement in session

evancohen commented 7 years ago

It's just sudocode. You'd replace that with whatever actual intent processor you have. If you say the hotword while cloud recognition is in progress is will not begin another recognition.

sharmmoh1983 commented 7 years ago

Ok I am trying to trigger the hotrod once all the response is flushed out to the speaker if prompt is required from the user.

Player.on('flush' , function(){console.log("In flush block"); if(session) sonus.trigger(sonus, 0, 'snowboy') ;

        });

Is this oK

Also wanted to know if I can use hotword only during the start of the conversation and not in all subsequent interactions until i say stop

sharmmoh1983 commented 7 years ago

How to make sure when speaker has played out the response and then trigger hotword manually

sharmmoh1983 commented 7 years ago

Sonus.pause and resume are not working it is still picking what is said after user utterance

After triggering hotword manually I am getting what was said in speaker. it seems it keeps on listening after sonus.pause

Sinus.Pause is not stoping mic to stop listening

Please let me know how to access Audio buffer from microphone

evancohen commented 7 years ago

Are you use you are using Sonus.pause() correctly? You cannot call .pause() on your created Sonus object. To be clear:

const sonus = Sonus.init({ hotwords }, speech)

sonus.pause() // does nothing
Sonus.pause(sonus) // should work
sharmmoh1983 commented 7 years ago

I am doing following thing:

sonus.on('final-result', result => { console.log("UserSpeech : ", result) Sinus.pause(sonus);


bufferStream.pipe(Player)

         Player.on('flush' , function(){console.log("In flush block");
          //if(session)

        });
         Player.on('close' , function(){console.log("In player close block")
          Sonus.resume(sonus) 
           sonus.trigger(sonus, 0, 'snowboy') ;
       });

and then in some function down the line I am executing Sonus.resume(sonus) after that calling manual trigger of hotword But it seems it is taking time to do pause and resume both

There is no possibility of capturing pauseOnComplete and resumeOnComplete events while pausing and resuming mic?

I need on functionality where mic listens nothing till I emit hotword manually which seems to be not the case as it is going into endless loop of recognising things which are played out by speaker

16alexanders commented 7 years ago

Still doesn't work even after that change I made

evancohen commented 7 years ago

I'll be online after work today and will have time to take a look at this and give you a hand. There's an unofficial Discord channel: https://discord.gg/35zesAR

I should be on at ~7:30 PST

sharmmoh1983 commented 7 years ago

So it is 7:30 am or pm

sharmmoh1983 commented 7 years ago

I have joined the channel .. Are u available on the channel

sharmmoh1983 commented 7 years ago

How to configure for multiple languages(Google Speech API) in sonus

evancohen commented 7 years ago

@sharmmoh1983 please open separate issues for new questions. Right now there is no support for multiple simultaneous languages: API.md#languages

I'm closing this issue because it has been resolved.