1 year ago

#385113

test-img

Irina Rapoport

How do I sample audio from microphone in javascript, for microphone animation?

I am recording audio from microphone in a browser using MediaStream Recording API. I would like to provide user with a visual feedback of a pulsating microphone icon. Something like this, only tied to the actual sound amplitude from the mike. https://codepen.io/megwayne/pen/bWOYEj How do I do this?

I am recording audio like this:

    const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
    const mediaRecorder = new MediaRecorder(stream);
    const audioChunks = [];

    mediaRecorder.addEventListener("dataavailable", event => {
      audioChunks.push(event.data);
    });

javascript

audio

html5-audio

mediastream

0 Answers

Your Answer

Accepted video resources