从Windows 2008 Server中的MP3 / WAV文件生成视觉(波形)?

时间:2012-03-31 14:36:51

标签: command-line mp3 visualization wav windows-server-2008-x64

是否(某处)Windows的命令行程序将从MP3 / WAV创建PNG / JPEG视觉效果?

修改 这是图像外观的一个很好的例子。 enter image description here

5 个答案:

答案 0 :(得分:33)

Sox,“瑞士军刀音频操纵”,可以从声音文件中生成准确的PNG频谱图。它几乎可以播放任何内容,二进制文件可用于Windows。在最基本的层面上,你会使用这样的东西:

sox my.wav -n spectrogram

如果你想要一个没有轴,标题,图例和100px高光背景的光谱图:

sox "Me, London.mp3" -n spectrogram -Y 130 -l -r -o "Me, London.png"

如果您只想分析单个频道,那么Sox会接受很多选项。如果您需要更清晰的视觉效果,可以对生成的PNG进行后期处理。

以下是命令行中关于所有可用参数的简短概述,manpage has more details

-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

答案 1 :(得分:7)

使用ffmpeg可以实现真实波形,您可以下载它here

在某处安装它并使用以下命令行作为示例:

ffmpeg.exe -i "filename.mp3" -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png

或以下内容以匹配您的示例图片颜色或其他colors

ffmpeg.exe -i "filename.mp3" -lavfi showwavespic=s=1024x800:colors=0971CE waveform.png

Documentation of FFmpeg showwavespic

答案 2 :(得分:3)

我已经创建了一个小型PHP库,可以执行此操作:https://github.com/jasny/audio


它的工作原理如下。它使用

获取样本
sox TRACK.mp3 -t raw 4000 -c 1 -e floating-point -L -

将此曲目下采样到4k并将所有内容放入1个频道。

接下来,我采取大块样本(每像素一次)并计算最小值和最大值。用它们画出波形。

答案 3 :(得分:1)

我发现这里非常好(从网络档案中,原来的一个已经消失了): http://web.archive.org/web/20140715171716/http://andrewfreiday.com/2011/12/04/optimizing-the-php-mp3-waveform-generator/

以PHP为基础,通过shell使用lame。

更新:该网站似乎不时死亡,这里的回复是:https://github.com/afreiday

答案 4 :(得分:0)

Wander Nauta的更新批量版本,它为所有wav文件生成直方图(BASH / DASH):

for i in *.wav; do ./sox $i -n spectrogram -y 130 -l -r -o ${i%%.wav}.png; done