From 938eaff11d21d1773d7cfcc38356926de35fb6a0 Mon Sep 17 00:00:00 2001 From: riqo Date: Sat, 7 Nov 2020 17:04:49 -0600 Subject: [PATCH] add audio analyser fft data --- src/background.ts | 4 +- src/components/AI/index.vue | 80 +++++++++++++++++++++++++++++++++++-- 2 files changed, 78 insertions(+), 6 deletions(-) diff --git a/src/background.ts b/src/background.ts index 2aaec65..e07342e 100644 --- a/src/background.ts +++ b/src/background.ts @@ -19,7 +19,7 @@ import { SpeechRecorder } from "speech-recorder"; // }); // -const recorder = new SpeechRecorder(); +const recorder = new SpeechRecorder({ sampleRate: 16000, framesPerBuffer: 320 }); // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. @@ -59,7 +59,7 @@ function createWindow() { recorder.start({ onAudio: (audio: object, speech: boolean) => { if (win) { - win.webContents.send('render-audio', { data: audio }) + win.webContents.send('render-audio', audio) } if (speech) { // TODO: send audio to crimata BE diff --git a/src/components/AI/index.vue b/src/components/AI/index.vue index 02bb6a9..2afa6f1 100644 --- a/src/components/AI/index.vue +++ b/src/components/AI/index.vue @@ -9,7 +9,7 @@ gradientUnits="objectBoundingBox" > - + @@ -33,13 +33,85 @@ -- 2.43.0