Microphone Recorder to Mp3
Record your microphone audio input and get a audio/mp3
file in the end.
Install
Yarn
yarn add mic-recorder-to-mp3
NPM
npm install mic-recorder-to-mp3
How to use
const MicRecorder = require('mic-recorder-to-mp3');
const recorder = new MicRecorder({
bitRate: 128
});
recorder.start(function () {
console.log('Start recording');
}, function () {
alert('We could not make use of your microphone at the moment');
});
recorder
.stop()
.getMp3((buffer, blob) => {
const file = new File(buffer, 'me-at-thevoice.mp3', {
type: blob.type,
lastModified: Date.now()
});
const player = new Audio(URL.createObjectURL(file));
player.play();
}, function (e) {
alert('We could not retrieve your message');
console.log(e);
});
License
MIT