Sam Bellen, an engineer at madewithlove, explains how to draw an audio form in real time using the sound from your computer's microphone.

I've recently started creating an online audio editor. One of the features I wanted to implement was to create a waveform for each track in the editor. This gives a nice overview of the content of each track. While recording a new track, it would be cool to visually see the the waveform you're recording so I decided to generate a waveform in realtime while recording a new audio track. Below I will go through the basics of how you can create such a waveform from your audio input device.

https://blog.sambego.be/creating-an-audio-waveform-from-your-microphone-input/