Skip to content

Node/V8 integration possible? #2

Closed
kishorenc opened this Issue Dec 11, 2012 · 1 comment

2 participants

@kishorenc

I'm just wondering whether we can use the audio APis to generate a static waveform image using Node.js. For long audio files, the waveform generation takes a long time client side, so I am wondering if it's possible to move the processing to the server side, so that the audio can be pre-processed.

@katspaugh
Owner

There is node-pcm module which lets you work with the PCM data. They provide an example of drawing waveforms using node-ffprobe, node-pcm and node-canvas.

As for wavesurfer.js, it does have an option to choose Audio API and load a pre-drawn image. See an example here and a demo here.

var audio = document.createElement('audio');
audio.src = 'http://silviodeangelis.myblog.it/media/02/02/2fd19306a30279bc2fcc458b3a033772.mp3';

var wavesurfer = Object.create(WaveSurfer);
wavesurfer.init({
    canvas: document.querySelector('canvas'),
    audio: audio,
    image: '/2fd19306a30279bc2fcc458b3a033772.png',
    progressColor: 'wheat',
    cursorColor: 'orange',
    cursorWidth: 2
});
@katspaugh katspaugh closed this Dec 11, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.