update recorder inputs
This commit is contained in:
parent
5c55910e26
commit
37764bb3a0
3 changed files with 39 additions and 30 deletions
4
crash.log
Normal file
4
crash.log
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
PID 335844 received SIGSEGV for address: 0xc
|
||||||
|
/home/enrique/Developer/electron-app/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x37a5)[0x7f1c071387a5]
|
||||||
|
/lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0)[0x7f1c10ffa3c0]
|
||||||
|
/home/enrique/Developer/electron-app/node_modules/electron/dist/electron dist_electron(+0x72d9550)[0x55ccd61fe550]
|
||||||
|
|
@ -7,17 +7,19 @@ var portAudio = require('naudiodon');
|
||||||
// NOTE Program Begins Here
|
// NOTE Program Begins Here
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|
||||||
|
console.log(portAudio.getDevices())
|
||||||
const isDevelopment = process.env.NODE_ENV !== "production";
|
const isDevelopment = process.env.NODE_ENV !== "production";
|
||||||
|
|
||||||
const recorder = new Recorder({
|
|
||||||
channelCount: 1,
|
|
||||||
sampleFormat: portAudio.SampleFormat16Bit,
|
|
||||||
sampleRate: 16000,
|
|
||||||
deviceId: -1, // Use -1 or omit the deviceId to select the default device
|
|
||||||
closeOnError: true
|
|
||||||
}, 'binary');
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
const recorder = new Recorder({
|
||||||
|
channelCount: 1,
|
||||||
|
sampleFormat: 16,
|
||||||
|
sampleRate: 16000,
|
||||||
|
deviceId: 24, // Use -1 or omit the deviceId to select the default device
|
||||||
|
closeOnError: true
|
||||||
|
}, 'binary');
|
||||||
// await authenticate method
|
// await authenticate method
|
||||||
initApp(isDevelopment);
|
initApp(isDevelopment);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,14 @@ interface RecorderI {
|
||||||
pause(): void;
|
pause(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type inputOptions = {
|
||||||
|
channelCount: number,
|
||||||
|
sampleFormat: number,
|
||||||
|
sampleRate: number,
|
||||||
|
deviceId: number,
|
||||||
|
closeOnError: boolean
|
||||||
|
}
|
||||||
|
|
||||||
class StringWritable extends Writable {
|
class StringWritable extends Writable {
|
||||||
|
|
||||||
constructor(options: {
|
constructor(options: {
|
||||||
|
|
@ -37,15 +45,6 @@ class StringWritable extends Writable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type inputOptions = {clear
|
|
||||||
|
|
||||||
channelCount: number,
|
|
||||||
sampleFormat: string,
|
|
||||||
sampleRate: number,
|
|
||||||
deviceId: number,
|
|
||||||
closeOnError: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Recorder implements RecorderI {
|
export class Recorder implements RecorderI {
|
||||||
|
|
||||||
private ia: any;
|
private ia: any;
|
||||||
|
|
@ -93,21 +92,25 @@ export class Recorder implements RecorderI {
|
||||||
|
|
||||||
private _update = (Event: any, record: boolean) => {
|
private _update = (Event: any, record: boolean) => {
|
||||||
if (record) {
|
if (record) {
|
||||||
console.log('recording');
|
// check for stream status
|
||||||
this.micWritable.data = '';
|
console.log('recording')
|
||||||
if(this.ia._readableState.paused){
|
|
||||||
this.resume();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.ia.pipe(this.micWritable);
|
|
||||||
|
|
||||||
console.log(this.ia._readableState.paused);
|
|
||||||
|
// this.ia.pipe(this.micWritable);
|
||||||
} else {
|
} else {
|
||||||
console.log('stop recording');
|
console.log('stop recording')
|
||||||
this.ia.unpipe(this.micWritable);
|
// unpipe
|
||||||
this.micWritable.on('finish', () => {
|
// this.ia.unpipe(this.micWritable);
|
||||||
console.log('hello');
|
|
||||||
})
|
// stop stream
|
||||||
|
// this.ia.quit();
|
||||||
|
// this.ia = null;
|
||||||
|
|
||||||
|
// get stream data
|
||||||
|
// this.micWritable.on('finish', () => {
|
||||||
|
// console.log('finished writing data');
|
||||||
|
// })
|
||||||
|
// this.restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue