如何在Linux中创建MP3的波形图?

给定一个MP3,我想将文件中的波形解压缩成一个图像(.png)

有没有一个可以做我需要的包?

解决方法

使用sox和gnuplot可以创建基本的波形图像:
sox audio.mp3 audio.dat #create plaintext file of amplitude values
tail -n+3 audio.dat > audio_only.dat #remove comments

# write script file for gnuplot
echo set term png size 320,180 > audio.gpi #set output format
echo set output \"audio.png\" >> audio.gpi #set output file
echo plot \"audio_only.dat\" with lines >> audio.gpi #plot data

gnuplot audio.gpi #run script

要创建更简单/更漂亮的东西,请使用以下GNU Plot文件作为模板(将其保存为audio.gpi):

#set output format and size
set term png size 320,180

#set output file
set output "audio.png"

# set y range
set yr [-1:1]

# we want just the data
unset key
unset tics
unset border
set lmargin 0             
set rmargin 0
set tmargin 0
set bmargin 0

# draw rectangle to change background color
set obj 1 rectangle behind from screen 0,0 to screen 1,1
set obj 1 fillstyle solid 1.0 fillcolor rgbcolor "#222222"

# draw data with foreground color
plot "audio_only.dat" with lines lt rgb 'white'

并运行:

sox audio.mp3 audio.dat #create plaintext file of amplitude values
tail -n+3 audio.dat > audio_only.dat #remove comments

gnuplot audio.gpi #run script

基于this answer的一个类似的问题,对于文件格式而言更为普遍,但对于使用的软件则不太一般.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


查找全部容器的日志文件 $ sudo find /var/lib/docker/containers -name *.log 查看日志位置 $ docker inspect --format='{{.LogPath}}' <container_name> 实时查询内容 $
Linux日志文件中列属性的详细解析
在Linux系统中没有duf命令,如何有效地管理磁盘空间?
深入探讨EncryptPad在Linux操作系统中的功能和优势
原理和应用场景:Linux中ttyload工具的工作原理和实际用途
深度解析SELinux的三种策略类型
评估Linux系统性能的ttyload工具使用效果
分享在Linux系统中检测SSH版本的方法
介绍Linux平台上的数据加密工具EncryptPad
在Linux系统中,如何查看和诊断块设备信息?
在Linux环境下如何查看块设备信息?
探索Linux操作系统下的数据加密工具EncryptPad
学会在Linux系统中查看硬盘信息
分析SELinux:原理与实践
掌握SELinux策略类别
技巧:有效解读和管理Linux日志文件
查看Linux系统中的所有用户
了解Linux系统中各种不同类型的日志文件
深入理解Linux PS命令
方法:在Linux操作系统中查看用户