My friend hanvi.
Switch branches/tags
Nothing to show
Clone or download
Latest commit c05951c Nov 29, 2018

README.md

GitHub node node

hanvi project

AI( Artificial Intelligent ) Speaker.

Listen to my voice and reinvent it with a new voice. In the future, Natural Language Processing(NLP) should be possible.

Simple Architecture

Prerequisite

Authentication

$ gcloud auth application-default login

Firebase settings

To use firebase, you must issue a json key and specify it in the path specified in config/process.js. Then change the setting to true. The default is to not use firebase.

exports.firebaseConfig =
{
  useFirebase     : true,
  databaseURL     : "https://hanvi-223711.firebaseio.com",
  serviceAccount  : "../your_service_account_key.json"
};

In Firebases, data is stored in the following structure.

Install Dependencies

$ npm install

Usage

$ node hanvi.js
Listening, press Ctrl+C to stop.
Transcription: 좋은 아침입니다
Audio content written to file: output.mp3
Transcription:  음성인식을 테스트 중입니다
Audio content written to file: output.mp3
Transcription:  생각보다 잘 됩니다
Audio content written to file: output.mp3

You can use pm2 to make it more stable.

$ pm2 start hanvi.js --name "hanvi"

Currently, the recognized voice is ping/pong and saved as output.mp3 file. In future, it will be added the function to output directly through the speaker. Check the audio samples in the sampleAudio directory. You can also check it on YouTube.

Error

If the following error is found when running, the API key is missing. Download the API key as a json file as described here. You must also specify the path to the file as an environment variable.

ERROR: { Error: 7 PERMISSION_DENIED: Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.
    at Object.exports.createStatusError (/Users/caley/hanvi/node_modules/grpc/src/common.js:87:15)
    at Object.onReceiveStatus (/Users/caley/hanvi/node_modules/grpc/src/client_interceptors.js:1188:28)
    at InterceptingListener._callNext (/Users/caley/hanvi/node_modules/grpc/src/client_interceptors.js:564:42)
    at InterceptingListener.onReceiveStatus (/Users/caley/hanvi/node_modules/grpc/src/client_interceptors.js:614:8)
    at callback (/Users/caley/hanvi/node_modules/grpc/src/client_interceptors.js:841:24)
  code: 7,
  metadata: Metadata { _internal_repr: {} },
  details:
   'Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.',
  note:
   'Exception occurred in retry method that was not classified as transient' }

reference

TODO

  • Fixed to respond only when calling hanvi
  • Analyzes the voice and returns the desired answer in TTS( text to speech ).
  • TTS and STT development. ( Without using the Google API )