PDA

View Full Version : Displaying a Wavform with the QGraphics API



Sergex
17th July 2011, 19:15
Hello,

I am trying to display the waveform from a wavfile on a widget using the QGraphics architecture. I will use a QGraphicsView as the widget where the waveform will be displayed.

I would like to know which classes are best and how to get the information from a wavefile to then, paint the corresponding waveform. All the wav data would have to be passed to the paint method in the QGraphicsView?

Any help with this would be greatly appreciated, thanks!

AlexSudnik
17th July 2011, 20:26
Hey,
well , grab the wav format specification : it's free .In general Wav file consists of a header and a data itself. containing most of the file-related data. All the "meta" data is stored in the header : file's sampling rate, whether it is mono or stereo , amount of bits per sampling etc. Data contains original signal's amplitude values...that's it. So in case if a sample is coded with a single byte , for a single channel , you can store it's value as unsigned char.Working with 16 bit samples is a little more tricky but since QString offers a great interface to work with the same 16bit unicode characters...not that hard. Once file's data is translated...plot it , there are a lot of examples regarding graphics in Qt.
P.S: there is great program that performs some great spectrum analysys : FFT Properties (you might want to use it to check if your obtained data is correct or not)