1

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.

The Man
  • 407
  • 1
  • 7
  • 19
  • Hi, can you be more precise please ? You want to compute an average amplitute value each second ? – Martin Jul 28 '14 at 11:08
  • my graph is amplitude=f(t), and time is a second that means each time (s) correspond to an amplitude. Actually I want to plot signal like audacity but dynamic waveform – The Man Jul 28 '14 at 11:59
  • What is a "dynamic waveform"? Do you perhaps mean an audio stream? – MSalters Jul 28 '14 at 12:43

1 Answers1

0

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.

MSalters
  • 173,980
  • 10
  • 155
  • 350