2

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?

Jongware
  • 22,200
  • 8
  • 54
  • 100
dominic
  • 105
  • 2
  • 9
  • 2
    What is your Question? – Matthias Jun 30 '14 at 08:59
  • I need a tutorial/hint to help me in making a spectrum analyzer for .raw 16-bit linear files. – dominic Jun 30 '14 at 09:21
  • 1
    No you don't. You can use the same tutorial as in your question. What you need is a way of reading .raw files and then putting the data you get from there in the same format as used in the tutorial. – RobbieE Jun 30 '14 at 11:54

2 Answers2

2

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.

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
-1

I agree with RobbieE in the comments in that what you need is not a different tutorial, but a method to convert RAW files to WAV files. I am also currently working on an audio application in Qt, and the library I use is libsndfile by Erik de Castro Lopo. It can transfer to and from many, many formats, including RAW to WAV.

If the Qt tutorial requires the sound to be loaded as a QSound (which I assume it does), you will first have to convert the RAW file to a WAV file, save it, and then proceed to load the WAV file.

Mark Miller
  • 706
  • 4
  • 14