Generating a waveform from an audio (or video) file?

前端 未结 2 1084
北荒
北荒 2021-01-16 06:40

I\'m trying to understand how I can generate a waveform from an audio (or video) file to display to the user.

I\'ve been googling around for quite a while now and ca

相关标签:
2条回答
  • 2021-01-16 07:26

    Going the "no external library" route will likely just lead to more of a headache and more work than is necessary. The other advantage of going with an established library is you won't be bound to one file format, as not all formats store their data the same way. If the audio format is uncompressed (wav or other) you can read the header until you get to the data chunk. An answer to this question here details this in C. You should be able to get an idea for the file format from this to apply it to another language.

    You will want to understand how many channels are in the wav file, bit depth, and also the sampling rate before you can do anything worthwhile with the data. All this info can be grabbed from the header.

    0 讨论(0)
  • 2021-01-16 07:28

    It turns out that QAudioProbe is not supported on OSX – the platform I am working on. Took quite a while (a "Qt while. . .") to ferret that info out so I am posting it here explicitly.

    See this document for full details: Qt 5.5.0 Multimedia Backends

    0 讨论(0)
提交回复
热议问题