使用Linux命令行从WAV/RIFF获取频谱 [英] Get a spectrum of frequencies from WAV/RIFF using linux command line

查看:264
本文介绍了使用Linux命令行从WAV/RIFF获取频谱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何生成包括wav/riff声音文件频率频谱的文件?我想使用linux命令行.

How to generate file including spectrum of frequencies of wav/riff sound file? I would like to use linux command line.

我知道凉爽的sox函数可以生成png频谱图

I know the cool sox function to generate png spectrograms

sox sound.wav -n spectrogram

但是我不需要视觉表示频率频谱.我只想获取数据文件中的频谱频谱,以便可以对其进行处理.我相信必须有使用sox的选项. Sox需要在绘制数据之前先生成该数据.如何得到这个?

But I do not need visual representation of the spectrum of frequencies. I just want to get spectrum of frequencies in data file so I can work on them. I believe that there must be an option using sox. Sox need to generate that data before plotting it. How to get this?

不确定,也许第二种解决方案是将wav文件导出到dat文件中. dat文件中的每个样本都是膜在某个时刻的位置的量度.因此,这不是频率频谱.

Not sure, maybe the second solution is exporting wav file into the dat file. Each sample from dat file is a measure of the position of the membrane at a moment in time. So this is not spectrum of frequencies.

sox sound.wav file.dat

如何将那些膜位置转换成我需要的光谱?

How to convert those membrane positions into spectrum i need?

谢谢.

推荐答案

您正在寻找的东西称为傅立叶变换或快速傅立叶变换(FFT). FFT是一种数学算法,可将包含在.wav文件中的时域样本(即您在时间点上表示的膜位置)转换为频率分量.如果您使用Google FFT,则会发现更多信息,包括可在Linux中编译和重用的源代码.参见如何绘制一个使用FFT的wav文件?是一个很好的开始.

What you are looking for is called a Fourier Transform, or Fast Fourier Transform (FFT). The FFT is a mathematical algorithm that transforms time domain samples (i.e. the membrane positions, as you put it, at points in time), which are contained in a .wav file - into frequency components. If you Google FFT, you will find much more information, including source code that you can compile and reuse in Linux. See How do I plot the spectrum of a wav file using FFT? for a good start.

这篇关于使用Linux命令行从WAV/RIFF获取频谱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆