在给定时间查找.wav的“音量" [英] Finding the 'volume' of a .wav at a given time
问题描述
我正在为我的第四年项目开发一个小示例应用程序(处理功能响应式编程).这个想法是创建一个简单的程序,该程序可以播放.wav文件,然后显示正在播放的歌曲当前音量的弹跳"动画(例如在录音软件中).我正在Scala中构建它,因此主要是在研究Java库和现有的解决方案.
目前,我已经设法轻松播放.wav文件,但似乎无法实现第二个目标.基本上有一种方法可以解码.wav文件,以便我可以通过某种方式访问 在任何给定时间的音量"?从数量上看,我认为我的意思是振幅,但我对此可能是错的-高等物理学是前一段时间....
很显然,我对此一无所知,所以如果有人能指出我正确的方向,那就太好了!
在数字音频处理中,您通常指的是信号的瞬时峰值幅度(也称为
另一种测量模式是RMS,它是通过在特定时间窗口内积分而计算得出的(将平方采样值相加,除以窗口长度,然后求平方根,即均方根RMS).这样可以更好地理解信号的能量",其移动比峰值测量更平滑,但无法捕获观察到的最大值.有时也将此模式称为 VU表.您可以使用某种滞后(低通)滤波器对此进行近似,例如 您通常以对数形式显示值,即在分贝中显示,因为这更符合我们的看法信号强度,并且对于大多数信号,可以更规则地覆盖屏幕空间. 我参与的三个项目可能会为您提供帮助: I am working on a small example application for my fourth year project (dealing with Functional Reactive Programming). The idea is to create a simple program that can play a .wav file and then shows a 'bouncing' animation of the current volume of the playing song (like in audio recording software). I'm building this in Scala so have mainly been looking at Java libraries and existing solutions. Currently, I have managed to play a .wav file easily but I can't seem to achieve the second goal. Basically is there a way I can decode a .wav file so I can have someway of accessing
the 'volume' at any given time? By volume I think I means its amplitude but I may be wrong about this - Higher Physics was a while ago.... Clearly, I don't know much about this at all so it would be great if someone could point me in the right direction! In digital audio processing you typically refer to the momentary peak amplitude of the signal (this is also called PPM -- peak programme metering). Depending on how accurate you want to be or if you wish to model some standardised metering or not, you could either The other measuring mode is RMS which is calculated by integrating over a certain time window (add the squared sample values, divide by the window length, and take the square-root, thus root-mean-square RMS). This gives a better idea of the 'energy' of the signal, moving smoother than peak measurements, but not capturing the maximum values observed. This mode is sometimes called VU meter as well. You can approximate this with a sort of lagging (lowpass) filter, e.g. You typically display the values logarithmically, i.e. in decibels, as this corresponds better with our perception of signal strength and also for most signals produces a more regular coverage of your screen space. Three projects I'm involved with may help you: 这篇关于在给定时间查找.wav的“音量"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!y[i] = y[i-1]*a + |x[i]|*(a-1)
,对于某些值0 < a < 1
y[i] = y[i-1]*a + |x[i]|*(a-1)
, for some value 0 < a < 1