Files:
The Spectrum Analyzer demo shows how the QtMultimedia Module can be used in Qt applications to capture and then play back an audio stream.
Because QtMultimedia allows the application to access the raw audio stream, the data can either be inspected or modified by the application. The Spectrum Analyzer demo displays three pieces of information while audio is being either captured or played back:
- Information about the raw audio stream, shown in the uppermost widget:
- The amount of data currently in the buffer, shown in blue
- The segment of data which was most recently analysed to compute the frequency spectrum, shown in green
- The raw audio waveform, shown in white and scrolling from right to left
- A representation of the frequency spectrum, shown at the lower left
- The current RMS level of the audio stream, and the recent 'high watermark' level, shown at the lower right
Spectrum analysis is performed by calculating the Fast Fourier Transform (FFT) of a segment of audio data. An open-source library, FFTReal, against which the application is dynamically linked, is used to compute the transform.