video-tools/src/dev.ts
2025-04-16 23:47:32 +08:00

21 lines
403 B
TypeScript

import { Recording } from './recorder/index.ts';
import fs from 'fs';
const file = fs.createWriteStream('test.wav', { encoding: 'binary' });
const record = new Recording({
sampleRate: 16000,
channels: 1,
audioType: 'wav',
threshold: 0,
recorder: 'rec',
silence: '1.0',
endOnSilence: true,
});
record.stream().pipe(file);
setTimeout(() => {
record.stop();
process.exit(0);
}, 5000);