speech to text with google speech api
Using npm:
``bash`
$ npm install speech-to-text-apiConfig
$3
Enable the Cloud Speech API. Cloud Platform Console
bash
googleApiKey: ""
`Example
`js
import SpeechApi from 'speech-to-text-api'
// default { encoding: 'LINEAR16', sampleRateHertz: 44100, languageCode: 'th-TH' }
const speechApi = new SpeechApi('google-cloud-api-key')
// or https://cloud.google.com/speech-to-text/docs/reference/rest/v1/RecognitionConfig
const speechApi = new SpeechApi('google-cloud-api-key', { encoding: 'LINEAR16', sampleRateHertz: 44100, languageCode: 'th-TH' })// start speech
await speechApi.start()
// result text
const result = await speechApi.stop()
``