1.wavesurfer.js is a Javascript library that enables one to display the waveform of an audio file. check here  for examples

I don’t know what the use of this technique would be for linguistic experiments. I guess some experiments might want participants to consult the waveforms and/or the spectrograms of the audio stimuli.

2. Apparently, the Web Audio API has provided possibilities to generate spectrograms in real time. Check this tutorial for more