node-crunker
v0.0.4
Published
Simple way to merge or concatenate audio files with the Node Web Audio API.
Downloads
557
Maintainers
Readme
Node-Crunker
Experimental, use in production with caution
Simple way to merge, concatenate, play, export and download audio files with the NodseWeb Audio API.
Installation
npm install node-crunker
Usage
const NodeCrunker = require('node-crunker');
const audio = new NodeCrunker();
Merge example
audio
.fetchAudio(
'http://www.mp3classicalmusic.net/48Music/Chopin48/Ballata1.mp3',
'http://www.mp3classicalmusic.net/48Music/Chopin48/Ballata4.mp3'
)
.then(buffers => audio.mergeAudio(buffers))
.then(merged => audio.export(merged, 'merged.mp3'))
.catch(error => {
console.log(error);
});
Local merge example
audio
.fetchLocalAudio(
'http://www.mp3classicalmusic.net/48Music/Chopin48/Ballata1.mp3',
'http://www.mp3classicalmusic.net/48Music/Chopin48/Ballata4.mp3'
)
.then(buffers => audio.mergeAudio(buffers))
.then(merged => audio.export(merged, 'merged.mp3'))
.catch(error => {
console.log(error);
});
Concatenation example
audio
.fetchAudio(
'http://www.mp3classicalmusic.net/48Music/Chopin48/Ballata1.mp3',
'http://www.mp3classicalmusic.net/48Music/Chopin48/Ballata4.mp3'
)
.then(buffers => audio.concatAudio(buffers))
.then(merged => audio.export(merged, 'merged.mp3'))
.catch(error => {
console.log(error);
});
Local concatenation example
audio
.fetchAudio(
'http://www.mp3classicalmusic.net/48Music/Chopin48/Ballata1.mp3',
'http://www.mp3classicalmusic.net/48Music/Chopin48/Ballata4.mp3'
)
.then(buffers => audio.concatAudio(buffers))
.then(merged => audio.export(merged, 'merged.mp3'))
.catch(error => {
console.log(error);
});
License
MIT