Commit a6f45e00 authored by Yoann HOUPERT's avatar Yoann HOUPERT
Browse files

generate user audio

parent 0ce98228
Pipeline #12677 failed with stage
......@@ -110,7 +110,11 @@ robot = {
getUserStream(easyrtcid) {
const stream = robotController.getRemoteStream(easyrtcid);
robot.participantsMediaRecorders[easyrtcid] = robot.processAudio(stream, e => robot.recordedParticipantsWS[easyrtcid].send(e.data), 100);
robot.participantsMediaRecorders[easyrtcid] = robot.processAudio(stream, e => robot.audioGenerator(easyrtcid, e), 100);
},
audioGenerator(easyrtcid, e) {
robot.recordedParticipantsWS[easyrtcid].send(e.data);
},
recordParticipant(easyrtcid) {
......
......@@ -18,7 +18,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const fs = require('fs');
const http = require('http');
const uuidv1 = require('uuid/v1');
const SockJS = require('sockjs-client');
const stomp = require('webstomp-client');
const WebSocket = require('ws');
......@@ -55,13 +57,21 @@ module.exports = config => {
}
function kaldiWS(connectionToClient) {
if (!fs.existsSync('hublot_audio')) {
fs.mkdirSync('hublot_audio');
}
const connectionToKaldi = new WebSocket(config.services.kaldi);
connectionToKaldi.on('open', () => {
const filename = uuidv1();
const wstream = fs.createWriteStream('hublot_audio/' + filename + '.wav');
connectionToClient.on('message', message => {
connectionToKaldi.send(message, {
binary: true
});
wstream.write(message);
});
connectionToKaldi.on('message', message => {
try {
connectionToClient.send(message);
......
......@@ -15,9 +15,11 @@
"dependencies": {
"body-parser": "^1.18.2",
"express": "^4.16.2",
"file-system": "^2.2.2",
"mz": "2.6.0",
"puppeteer": "0.12.0",
"sockjs-client": "1.1.4",
"uuid": "^3.2.1",
"webstomp-client": "1.2.0",
"ws": "3.3.1",
"xmlhttprequest": "1.8.0 "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment