Search code examples
c++qtaudio

How to get waveform of .wav file in Qt Creator?


I'm developing a player and I want to display a wave file waveform on the widget. From start to end, the waveform should be dynamic.

I looked at the examples of Qt but I didn't understand because they are so complicated projects. I use multimedia module of Qt. I have media player, so I can play and record .wav files.


Solution

  • You may be lucky and have someone post the exact code you're looking for. If that doesn't happen ... divide and conquer.

    There are many parts to what you are wanting to do ... split them up, learn how to do the different parts, then bring your knowledge and the parts together. For example, you will need to learn how to:

    • draw lines on a canvas on a window;
    • draw different colour lines;
    • scale values from a wav file so they fit on the canvas;
    • extract values from the wav file; and
    • scale down the horizontal values and peak out the peak amplitudes.

    On their own, none of these is too tricky.

    While not an answer with full code and full explanations, I hope this gets you going in the right direction.