npm.io
0.4.13 • Published 2 years ago

@fonoster/googleasr

Licence
MIT
Version
0.4.13
Deps
5
Size
17 kB
Vulns
0
Weekly
0
Stars
8.2K
DeprecatedThis package is deprecated

Voice application plugin that accurately convert speech into text using an API powered by Google’s AI technologies.

Installation

npm install @fonoster/googleasr

or

yarn add @fonoster/googleasr

Usage

const { VoiceServer } = require("@fonoster/voice");
const GoogleASR = require("@fonoster/googleasr");
const voiceServer = new VoiceServer({ base: '/voiceapp' });

// Set the server to use the speech APIS
const speechConfig = { keyFilename: "./google.json" };
voiceServer.use(new GoogleASR(speechConfig));

voiceServer.listen(async(req, res) => {
  console.log(req);
  await res.answer();
  // To use this verb you MUST have a TTS plugin
  const speech = await res.gather();

  console.log("User input: " + speech");
  await res.hangup();
});