Skip to content

A simple audio grabber for windows, linux, mac, and raspberry pi

License

Notifications You must be signed in to change notification settings

Bes-js/audiograb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


A simple audio grabber for windows, linux, mac, and raspberry pi.

Discord Buy Me A Coffee

Installation

Using npm:

$ npm install audiograb

Other Installations:

$ yarn add audiograb
$ pnpm add audiograb

Usage

import { Recorder, EventType } from 'audiograb';
import fs from 'fs';

const recorder = new Recorder({
    '-i': 'Microphone (5- USB PnP Sound Device)',
}).setFormat('dshow');

// Create a `WriteStream` to save the audio data to a temporary file
const outputFilePath = './output.mp3';
const outputFile = fs.createWriteStream(outputFilePath);

// When recording starts
recorder.on('recordStarted', () => {
    console.log('Recording started...');
});

// Write audio data to the file as it arrives
recorder.on('audioData', (data) => {
    outputFile.write(data);
});

// When recording stops or an error occurs
recorder.on('recordStopped', () => {
    console.log('Recording stopped.');
    outputFile.end(); // Close the file stream
});

recorder.on('ffmpegInformation', (info) => {
    console.error('FFmpeg:', info);
});

// Start recording
recorder.start();

// Stop recording after a certain period
setTimeout(() => {
    recorder.stop();
}, 10000); // Stop recording after 10 seconds

License

audiograb is licensed under the GPL 3.0 License. See the LICENSE file for details.

Support

Discord Banner

About

A simple audio grabber for windows, linux, mac, and raspberry pi

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published