Sox是音频处理的“瑞士军刀”,可以从音频文件生成准确的PNG频谱图。它可以播放几乎任何格式的音频文件,并提供了Windows二进制版本。在最基本的级别上,你会像这样使用它:
sox my.wav -n spectrogram
如果您想要一个没有坐标轴、标题、图例和浅色背景的频谱图,高度为100像素:
sox "Me, London.mp3" -n spectrogram -Y 130 -l -r -o "Me, London.png"
如果您只想分析单个通道,Sox接受许多选项。如果您需要更酷炫的视觉效果,可以对生成的PNG进行后处理。
以下是有关所有可用参数的简要概述,手册中有更多详细信息:
-x num X-axis size in pixels; default derived or 800
-X num X-axis pixels/second; default derived or 100
-y num Y-axis size in pixels (per channel); slow if not 1 + 2^n
-Y num Y-height total (i.e. not per channel); default 550
-z num Z-axis range in dB; default 120
-Z num Z-axis maximum in dBFS; default 0
-q num Z-axis quantisation (0 - 249); default 249
-w name Window: Hann (default), Hamming, Bartlett, Rectangular, Kaiser
-W num Window adjust parameter (-10 - 10); applies only to Kaiser
-s Slack overlap of windows
-a Suppress axis lines
-r Raw spectrogram; no axes or legends
-l Light background
-m Monochrome
-h High colour
-p num Permute colours (1 - 6); default 1
-A Alternative, inferior, fixed colour-set (for compatibility only)
-t text Title text
-c text Comment text
-o text Output file name; default `spectrogram.png'
-d time Audio duration to fit to X-axis; e.g. 1:00, 48
-S time Start the spectrogram at the given time through the input
sox --help-effect spectrogram
命令获取更多选项。 - Sanya_Zolsox
选项。答案中列出的参数是专门针对频谱图子命令的(应该在其后列出)。 - Wander Nautasox TRACK.mp3 -t raw 4000 -c 1 -e floating-point -L -
更新的批处理版本Wander Nauta,可以为文件夹中的所有wav文件生成直方图(BASH/DASH):
for i in *.wav; do ./sox $i -n spectrogram -y 130 -l -r -o ${i%%.wav}.png; done