Search code examples
qtspectrum

Spectrum analyzer for .raw 16bit linear files


I have to make a spectrum analyzer for .raw 16-bit linear files.

I had a look at this but it works only with .wav files.

Do you know any tutorial/example that can help me create a spectrum analyzer for .raw files?


Solution

  • The WavFile class reads a .wav header to obtain the audio format information from the file. It's simple to modify that class to use a fixed format instead.

    If you look at the documentation for the QAudioInput class, the first code sample given shows how to set up the QAudioInput to read a raw file with a format slightly different from yours. All you need is to adapt the parameters of the QAudioFormat instance to match your needs.