major improvements to audio transcription

This commit is contained in:
riqo 2021-03-04 10:56:08 -06:00
commit 47f55138b9
2 changed files with 7 additions and 3 deletions

View file

@ -22,7 +22,12 @@ const audioOptions = {
}
// callback run on space bar key up and down.
const updateRecorder = (_event, payload: boolean): void => { record = payload };
const updateRecorder = (_event, payload: boolean): void => {
record = payload;
if (!record) {
sendAudio(Buffer.from(audioContainer.input, 'base64'));
}
};
// listen for space key up/down event.
ipcMain.removeAllListeners('update-recorder');
@ -50,7 +55,6 @@ export function initAudioIO(): void {
ai.on('data', (chunk: string) => {
if (record) {
console.log('recording data')
audioContainer.input += chunk;
} else {
if (audioContainer.input.length) audioContainer.input = "";

View file

@ -80,7 +80,7 @@ const ao = new portAudio.AudioIO({
ao.start();
let counter = 0;
let tests = [];
const tests = [];
function testCallback() {
tests.forEach(t => console.log(t))