问题
I'm trying to create a program, using Qt (c++), which can plot the amplitude Signal (plot like audacity but dynamic waveform) when I playback an audio file (.wav, .mp3) using QAudiooutput
and QIODevice
.
What I've done:
with QAudioouput
I can play the any audio file, with qwtplot I can plot any signal in 2D, in this case, x-axis will be time and y-axis will be the amplitude.
Now, my problem is how to get the amplitude for each second (time)?
Any help would be appreciated.
回答1:
The normal, uncompressed representation of audio is just its amplitude as a function of time. .wav
files are ordinarily uncompressed, so a mono .WAV
file is really the simplest of audio files: just a header followed by a series of amplitudes.
Note that digital audio has a sampling rate. E.g. a 32 kHz sample rate means that your WAV file has 32000 amplitudes per second. If it only had one, you couldn't hear it ! (<20 Hz). You can see this in Audacity; you can zoom in quite a bit on the waveform.
来源:https://stackoverflow.com/questions/24993808/how-to-plot-the-amplitude-of-audio-file-with-c