Restored transcription service
authorCedric Godin <cedric.godin@usherbrooke.ca>
Mon, 26 Feb 2018 18:44:24 +0000 (13:44 -0500)
committerCedric Godin <cedric.godin@usherbrooke.ca>
Mon, 26 Feb 2018 18:44:24 +0000 (13:44 -0500)
audio-recorder.js
package.json
record.js
resources/js/recordings_model.js

index 9d46c0d1b1523460c4acf370ae57ead5fd74d06e..e036825f1bebb053c7ab8e8ad9864606c84781ac 100644 (file)
@@ -1,4 +1,4 @@
-//const streamToText = require('./stream-to-text.js');
+const streamToText = require('./stream-to-text.js');
 const path = require('path');
 const wav = require('wav')
 const EventEmitter = require('events');
@@ -29,7 +29,7 @@ exports.AudioRecorder =  class AudioRecorder extends EventEmitter {
         this.buffer = undefined;
         this.writer = undefined;
         this.path = undefined;
-/*
+
         this.transcripter = new streamToText.Transcripter();
 
         this.transcripter.on('data', data => {
@@ -39,7 +39,7 @@ exports.AudioRecorder =  class AudioRecorder extends EventEmitter {
 
         this.transcripter.on('error', err => {
             console.error(err);
-        });*/
+        });
     }
 
     receive(data) {
@@ -88,7 +88,7 @@ exports.AudioRecorder =  class AudioRecorder extends EventEmitter {
 
             }
 
-            //this.transcripter.putData(data);
+            this.transcripter.putData(data);
 
         }
     }
@@ -124,7 +124,7 @@ exports.AudioRecorder =  class AudioRecorder extends EventEmitter {
                 this.active = true;
                 this.hold = false;
                 this.buffer = undefined;
-                //this.transcripter.start();
+                this.transcripter.start();
             }
 
             catch(err) {
@@ -141,7 +141,7 @@ exports.AudioRecorder =  class AudioRecorder extends EventEmitter {
 
             this.active = false;
             console.log(`Recorder ${this.index} ended`);
-            //this.transcripter.stop();
+            this.transcripter.stop();
 
             console.log(`Registering header on recorder ${this.index}`);
             this.writer.end();
index 13e454ec9a2c03770321bd040e84d8785f7dd889..4bad9ea0b8035907e3fd3f17708bde4b12f45094 100644 (file)
@@ -4,7 +4,8 @@
   "description": "A desktop GUI for the ODAS library",
   "main": "main.js",
   "scripts": {
-    "start": "electron ."
+    "start": "electron .",
+    "postinstall": "./node_modules/.bin/electron-rebuild"
   },
   "author": "Cedric Godin",
   "license": "MIT",
index 95fcb925fa172d04bb80551cf9479e6b327adad8..26d10c57dbc85b602682c48ad458d1788d9e7509 100644 (file)
--- a/record.js
+++ b/record.js
@@ -1,5 +1,6 @@
 const electron = require('electron');
 const fork = require('child_process').fork;
+const spawn = require('child_process').spawn;
 const path = require('path')
 const url = require('url')
 
@@ -10,7 +11,7 @@ const ipcMain = electron.ipcMain;
  * Start the recording process
  */
 
-const recordingProcess = fork('./recordings.js');
+const recordingProcess = spawn(process.execPath, ['./recordings.js'], {stdio: [0, 1, 2, 'ipc']});
 exports.quit = function quit() {
     recordingProcess.kill();
 }
index 043a8cdeb1597732ba533c28b5118ff106e3d115..bec840aa2d67a831676f394a4ea2d75dcab674d1 100644 (file)
@@ -4,7 +4,7 @@ const os = require('os');
 const fs = require('fs');
 const info = require('wav-file-info');
 const dialog = require('electron').remote.dialog;
-//const speechToText = require('./../resources/js/speech-to-text.js');
+const speechToText = require('./../resources/js/speech-to-text.js');
 
 // Fuzzy recording class
 class FuzzyRecording {
@@ -43,11 +43,11 @@ class Recording {
             if(err) console.log(err);
         })
     }
-/*
+
     else {
         this.createTranscript();
     }
-*/
+
   }
 
   readInfo(retry) {
@@ -80,7 +80,7 @@ class Recording {
       }
     })
   }
-/*
+
   createTranscript() {
 
       const txtPath = this.path.slice(0, -4)+'.txt';
@@ -107,7 +107,7 @@ class Recording {
           }
       });
   }
-*/
+
   play() {
     this.isPlaying = true