Visualising sound

Hello,

Does anyone have any experience with visualising sounds based on microphone input (or CDs, or whatever), preferably in an applet? I’m just trying to figure out where to start, really. It doesn’t need to do anything complicated in terms of analysing the signal, I mostly just want to grab bits of the waveform and use them to make a display. I might also want to do something with the overall volume of the incoming sound.

I thought I’d surely be able to find some sample code somewhere to get an idea how it can work, but I can’t seem to find anything remotely similar! This may be because I’m being dense, I just don’t know.

Anyway - any thoughts or helpful links would be much appreciated - I’m okay for general-purpose documentation of Java Sound, I just have nothing about using sound to make anything besides more sound!

Is Java Sound pretty much my only option for this, without expecting my visitors to download a plugin? I will soon be wanting to output sound, as well, if that makes a difference.

Cheers

  • f.

When you get sound input, you get chunks of data which you can directly render to screen. Just translate the amplitudes to Y coordinates and draw them along an X axis. How you have to translate the samples to Y coordinates depends on the format you’re receiving the samples (8 or 16 bits, byte order). You might want to average a few samples otherwise you’ll have a lot of drawing to do. Average more samples do create an overal volume indicator.

Thanks erikd.

I’m a little troubled by not being able to find anything similar that anyone else has done - it seems like such an obvious thing to do that its absence makes me wonder if there’s some good reason why it won’t work right…!

I wrote a simple analogue VU-meter a couple of years ago. It captures the soundcard’s recording device.

http://geocities.com/sunet2000/vumeter.jar

You can run it as an application. You need to use a signed applet to record from the sound card, if I remember correctly.