本文介绍了如何用c ++绘制音频文件的幅度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Qt(c ++)创建一个程序,当我使用 QAudiooutput播放音频文件(.wav,.mp3)时,该程序可以绘制幅度信号(如大胆但有动态波形的图) QIODevice .

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.

我所做的:
使用 QAudioouput ,我可以播放任何音频文件,使用qwtplot可以绘制2D信号,在这种情况下,x轴就是时间y轴为振幅.

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)?

任何帮助将不胜感激.

推荐答案

正常的,未压缩的音频表示形式只是其幅度随时间的变化. .wav 文件通常是未压缩的,因此单声道 .WAV 文件实际上是最简单的音频文件:只是一个标头,后面是一系列振幅.

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.

请注意,数字音频具有采样率.例如.32 kHz的采样率意味着您的WAV文件每秒具有32000个幅度.如果只有一个,您听不到!(<20Hz).您可以在Audacity中看到这一点;您可以将波形放大很多.

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.

这篇关于如何用c ++绘制音频文件的幅度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 00:56