音轨的振幅

发布于 2024-09-10 22:26:56 字数 385 浏览 1 评论 0原文

我想使用 Qt 开发一个音频编辑器。 为此,我需要绘制音乐曲目的波形图,我认为它应该是声音峰值幅度与时间的关系图(如果我错了,请纠正我)。

目前,我一直使用 Phonon::AudioOutput 类对象作为音频接收器,并将其与我的 Phonon::MediaObject 类对象连接以播放音频文件。

现在,要绘制波形,我需要知道此 AudioOutput 对象每秒(左右)的音轨幅度,以便我可以绘制一条长度与不同时间的声音频率成比例的线(使用 QPainter),因此,获取我的波形。

因此,请帮助我了解如何获取不同时间音轨的幅度。

其次,我是否使用了绘制音轨波形的正确方法 - 通过在不同时间在小部件上绘制 QPainter 对象的线条来绘制声音幅度与时间的关系。

谢谢。

I want to develop an audio editor using Qt.
For this, I need to plot a waveform of the music track which I think should be a plot of peak amplitude of sound versus time(please correct me if I am wrong).

Currently, I have been using Phonon::AudioOutput class object as an audio sink and connected it with my Phonon::MediaObject class object to play the audio file.

Now, to draw the waveform I need to know the amplitude of audio track at every second (,or so) from this AudioOutput object so that I can draw a line (using QPainter) of length proportional to sound frequency at different times and hence, obtain my waveform.

So, please help me on how to obtain amplitude of audio tracks at different times.

Secondly,am I using the correct way of plotting waveforms of audio tracks - plotting amplitudes of sound against time by plotting lines by QPainter object on a widget at different times.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冰之心 2024-09-17 22:26:56

频谱分析器 示例,随 Qt 一起提供(在 demos/spectrum 目录中)。

在 Symbian 上运行的频谱分析器演示的屏幕截图 http:// labs.trolltech.com/blogs/wp-content/uploads/2010/05/spectrum.png

该演示还计算并显示频谱。正如另一位评论者指出的那样,这与波形图不同:频谱是幅度与频率的关系图,而波形图是幅度与时间的关系图。

该演示使用 QtMultimedia 而不是 Phonon 来捕获和渲染音频。如果您只对播放音频感兴趣,不需要录制音频,Phonon 可能就足够了,但请注意流支持(即 Phonon::MediaSource(QIODevice *))不可用在所有平台上。另一方面,QAudioInputQAudioOutput 在 Qt 的所有主要平台上都得到了很好的支持,至少对于 PCM 音频数据来说是如此。

There is code which does both of the things you ask about (calculating peak amplitude, and plotting audio waveforms) in the Spectrum Analyzer example which ships with Qt (in the demos/spectrum directory).

Screenshot of Spectrum Analyzer demo running on Symbian http://labs.trolltech.com/blogs/wp-content/uploads/2010/05/spectrum.png

This demo also calculates and displays a frequency spectrum. As another commenter points out, this is distinct from a waveform plot: the spectrum is a plot of amplitude against frequency, whereas the waveform plots amplitude against time.

The demo uses QtMultimedia rather than Phonon to capture and render audio. If you are only interested in playing audio, and don't need to record it, Phonon may be sufficient, but be aware that streaming support (i.e. Phonon::MediaSource(QIODevice *)) is not available on all platforms. QAudioInput and QAudioOutput on the other hand are well supported, at least for PCM audio data, on all the main platform targetted by Qt.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文