linux上怎么画波形图_如何在Linux中创建MP3的波形图?

使用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的一个类似的问题,对于文件格式而言更为普遍,但对于使用的软件则不太一般.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值