-
Notifications
You must be signed in to change notification settings - Fork 10
/
cambiosMIc.patch
114 lines (107 loc) · 3.8 KB
/
cambiosMIc.patch
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
diff --git a/light-programs/LightController.js b/light-programs/LightController.js
index 59fb502..79aa87e 100644
--- a/light-programs/LightController.js
+++ b/light-programs/LightController.js
@@ -2,6 +2,7 @@ const Geometry = require('./Geometry')
const _ = require('lodash');
const programNames = [
+ "musicVolumeDot",
"PROGRAM_Main",
// "PROGRAM_Transition",
// "PROGRAM_Triangulo",
@@ -16,7 +17,6 @@ const programNames = [
"water-flood",
"musicFlow",
"rainbow",
- "musicVolumeDot",
"stars",
"debugSetup",
"debugShapes",
@@ -146,4 +146,4 @@ module.exports = class LightController {
lightsSampleEmitter.emit('lights', leds)
this.setLightsCbk(leds)
}
-}
\ No newline at end of file
+}
diff --git a/mic/mic.js b/mic/mic.js
index 4296059..4fca95c 100644
--- a/mic/mic.js
+++ b/mic/mic.js
@@ -9,9 +9,9 @@ var mic = function mic(options) {
options = options || {};
var that = {};
var endian = osEndianness == "BE"? "big" : "little";
- var bitwidth = 32;
- var encoding = 'floating-point';
- var rate = that._sampleRate = options.rate || 44100;
+ var outputBitwidth = 32;
+ var outputEncoding = 'floating-point';
+ var outputRate = that._sampleRate = options.rate || 44100;
var channels = that._channels = options.channels || 1;
if (channels != 1) {
// TODO: stereo support.
@@ -21,7 +21,7 @@ var mic = function mic(options) {
var exitOnSilence = options.exitOnSilence || 0;
var fileType = options.fileType || 'raw';
var frameSize = options.frameSize || 512;
- var bufferSize = frameSize * channels * bitwidth / 8;
+ var bufferSize = frameSize * channels * outputBitwidth / 8;
var debug = options.debug || false;
var format, formatEndian, formatEncoding;
var audioProcess = null;
@@ -36,28 +36,43 @@ var mic = function mic(options) {
}
// Setup format variable for arecord call
- if(encoding === 'unsigned-integer') {
+ if(outputEncoding === 'unsigned-integer') {
formatEncoding = 'U';
} else {
formatEncoding = 'S';
}
- format = formatEncoding + bitwidth + '_' + osEndianness;
+ format = formatEncoding + outputBitwidth + '_' + osEndianness;
that.start = function start() {
if(audioProcess === null) {
if(isWindows){
- var params = ['-b', bitwidth, '--endian', endian,
- '-c', channels, '-r', rate, '-e', encoding,
- '-t' , 'waveaudio', 'default', '-p', '--buffer', bufferSize, '-V',
- '-V'];
+ var params = [
+ // Parameters for input (-t wave audio)
+ // '-b', '16',
+ // '--endian', endian,
+ '-c', channels,
+ // '-r', '44100',
+ // '-e', 'signed-integer',
+ '-t' , 'waveaudio', 'default',
+
+ // Parameters for input (- means pipe it)
+ '-b', outputBitwidth,
+ '--endian', endian,
+ '-c', channels,
+ '-r', outputRate,
+ '-e', outputEncoding,
+ '--buffer', bufferSize,
+ '-t' , 'raw',
+ '-'
+ ];
audioProcess = spawn('sox', params, audioProcessOptions)
console.log(params.join(" "))
}
else if(isMac){
- let params = ['-b', bitwidth, '--endian', endian,
- '-c', channels, '-r', rate, '-e', encoding,
+ let params = ['-b', outputBitwidth, '--endian', endian,
+ '-c', channels, '-r', outputRate, '-e', outputEncoding,
'-t', fileType, '--buffer', bufferSize, '-'];
console.log("rec", params.join(' '))
@@ -65,7 +80,7 @@ var mic = function mic(options) {
}
else {
// TODO: fix this branch, no idea about the args for this program.
- let params = ['-c', channels, '-r', rate, '-f',
+ let params = ['-c', channels, '-r', outputRate, '-f',
format, '-D', device, '-B', '100000'];
console.log("arecord", params.join(' '))