bbc / waveform-data.js

Audio Waveform Data Manipulation API – resample, offset and segment waveform data in JavaScript.
https://waveform.prototyping.bbc.co.uk
Other
1.04k stars 103 forks source link

Is it possible to show waveform from microphone MediaStream in realtime? #86

Open remotenode opened 3 years ago

chrisn commented 3 years ago

This library does not support real time input at this time.

jason30704 commented 2 months ago

I'm using MediaRecorder to record audio, and I would like to real time show waveform during record too.

As shown in the red box below. Audio can use waveform-data to obtain real time waveform normally. With the ondataavailable function of MediaRecorder, the UI performs is actually not bad. However, this method will take lots of time to generate waveform as the recording time gets longer.

Therefore, I want to use the audio chunks to generate partial waveform and then concat them together. But I will not be able to obtain the waveform data normally if use audio chunks, as shown in the white box below. image

I think it may be possible to do it if waveform-data can generate partial waveform-data. Is there a correct way to partially extract the waveform-data of an audio by waveform-data? Or I need split chunks data by other correct way? Thanks!

Below is the code I use to get waveform. image