major improvements to audio transcription
This commit is contained in:
parent
c7f91d3e6b
commit
47f55138b9
2 changed files with 7 additions and 3 deletions
|
|
@ -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 = "";
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Reference in a new issue