Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
9d64ffcb41
31 changed files with 360 additions and 387 deletions
10
testAudio.js
10
testAudio.js
|
|
@ -2,15 +2,13 @@
|
|||
const fs = require('fs');
|
||||
const speech = require('@google-cloud/speech');
|
||||
const portAudio = require('naudiodon');
|
||||
// const rs = fs.createReadStream('rawAudio.wav');
|
||||
const WebSocket = require("ws")
|
||||
const {Writable} = require('stream');
|
||||
|
||||
// Creates a client
|
||||
const client = new speech.SpeechClient();
|
||||
|
||||
// connect to test server
|
||||
// const ws = new WebSocket("ws://localhost:8080");
|
||||
// Creates a client const client = new speech.SpeechClient();
|
||||
|
||||
const encoding = 'LINEAR16';
|
||||
const sampleRateHertz = 16000;
|
||||
const languageCode = 'en-US';
|
||||
|
|
@ -46,11 +44,9 @@ async function transcribeSpeech (audio) {
|
|||
console.log(`Transcription: ${transcription}`);
|
||||
}
|
||||
|
||||
const audioChunks = [];
|
||||
|
||||
let audioInput = [];
|
||||
// Create an instance of AudioIO with inOptions (defaults are as below), which will return a ReadableStream
|
||||
let ia = new portAudio.AudioIO({
|
||||
const ia = new portAudio.AudioIO({
|
||||
inOptions: {
|
||||
channelCount: 1,
|
||||
sampleFormat: 16,
|
||||
|
|
|
|||
Loading…
Reference in a new issue