Real-time graphic drawing (waveform)

I would like to do some projects with sound in C # .NET 4.0 in the future, so I put together some code samples for recording sound, working with WAVE files, etc. But what I could not find,

How can I draw audio signals / spectrograms in real time (ish)? Obviously, creating a bitmap in memory and loading it into a picture window will be very slow, right? So what is the easiest way?

Thanks!

+7
source share
2 answers

You can use Graphics and Drawing in GDI + -based Windows Forms to draw content directly. This will be much faster than rendering to a bitmap and displaying in an image window to constantly change the content.

+1
source

Just draw directly on a suitable control surface, that is, on the panel. Get the graphic context of the control and update it in the Paint event using the Invalidate () function. Every time you are invalid, Paint is called automatically. Here you want to put your drawing logic.

The best way to update it is to use DrawImageUnscaled (). The image itself is most quickly executed using the LockBits method, which is explained excellently here:

http://www.bobpowell.net/lockingbits.htm

+1
source

All Articles