UtiLite  0.3.1
A lite utilities library
Public Slots | Public Member Functions
USpectrogram Class Reference

#include <USpectrogram.h>

List of all members.

Public Slots

void clear ()
void push (const std::vector< float > &frame)
void push (const QVector< float > &frame)
void setSamplingRate (int fs)

Public Member Functions

 USpectrogram (QWidget *parent=0)
 USpectrogram (int fs, QWidget *parent=0)
void setData (const QList< QVector< float > > &data)

Detailed Description

USpectrogram is a QWidget to show a spectrogram. Add frames (squared magnitude values) incrementally using Qt signals/slots.

USpectrogram.png
Chirp

Example:

 #include "utilite/USpectrogram.h"
 #include <QApplication>

 int main(int argc, char * argv[])
 {
  QApplication app(argc, argv);
        USpectrogram spectrogram;

        // Get audio frames and compute the FFTs,
        // compute the squared magnitude (im*im + re*re) of the FFTs, then
        // add the frequency frames to the spectrogram.
        std::vector<float> frame1, frame2, frame3, frame4; //...
        spectrogram.push(frame1);
        spectrogram.push(frame2);
        spectrogram.push(frame3);
        spectrogram.push(frame4);
        spectrogram.push(frameXXXX);
        //...

        spectrogram.show();
        app.exec();
        return 0;
 }

Constructor & Destructor Documentation

USpectrogram::USpectrogram ( QWidget *  parent = 0)

Constructor 1.

USpectrogram::USpectrogram ( int  fs,
QWidget *  parent = 0 
)

Constructor 2. Set the sampling frequency of the frames (used to show values in Hz).


Member Function Documentation

void USpectrogram::clear ( ) [slot]

Clear the spectrogram.

void USpectrogram::push ( const std::vector< float > &  frame) [slot]

Push a new frame. It must be the same size of the previous added frames. If not, a clear() is required.

void USpectrogram::push ( const QVector< float > &  frame) [slot]

For convenience, push a new frame. It must be the same size of the previous added frames. If not, a clear() is required.

void USpectrogram::setData ( const QList< QVector< float > > &  data)

Set all frames. If you want to incrementally add frames, use slot push().

void USpectrogram::setSamplingRate ( int  fs) [slot]

Set sampling rate (to display frequencies in Hz).


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Enumerations Friends Defines