-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmic.js
More file actions
29 lines (25 loc) · 750 Bytes
/
Copy pathmic.js
File metadata and controls
29 lines (25 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// var streams = require('memory-streams');
// var reader = new streams.ReadableStream('');
// reader.pipe(process.stdout);
//
// for (var i = 0; i < 1000; i++) {
// reader.append('random string\n');
// }
var streams = require('memory-streams');
var writer = new streams.WritableStream();
var fs = require('fs');
writer = fs.createWriteStream('./test.wav');
const record = require('node-record-lpcm16');
record
.start({
sampleRateHertz: 16000,
threshold: 0,
// Other options, see https://www.npmjs.com/package/node-record-lpcm16#options
verbose: false,
recordProgram: 'rec', // Try also "arecord" or "sox"
silence: '10.0',
})
.on('error', console.error)
.pipe(writer);
//
// console.log(writer.toString('hex'));