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

如何在Linux中创建MP3的波形图?,第1张

概述给定一个MP3,我想将文件中的波形解压缩成一个图像(.png) 有没有一个可以做我需要的包? 使用sox和gnuplot可以创建基本的波形图像: sox audio.mp3 audio.dat #create plaintext file of amplitude valuestail -n+3 audio.dat > audio_only.dat #remove comments# wri 给定一个MP3,我想将文件中的波形解压缩成一个图像(.png)

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

解决方法 使用sox和gnuplot可以创建基本的波形图像:
sox audio.mp3 audio.dat #create plaintext file of amplitude valuestail -n+3 audio.dat > audio_only.dat #remove comments# write script file for gnuplotecho set term png size 320,180 > audio.gpi #set output formatecho set output \"audio.png\" >> audio.gpi #set output fileecho plot \"audio_only.dat\" with lines >> audio.gpi #plot datagnuplot audio.gpi #run script

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

#set output format and sizeset term png size 320,180#set output fileset output "audio.png"# set y rangeset yr [-1:1]# we want just the dataunset keyunset ticsunset borderset lmargin 0             set rmargin 0set tmargin 0set bmargin 0# draw rectangle to change background colorset obj 1 rectangle behind from screen 0,0 to screen 1,1set obj 1 fillstyle solID 1.0 fillcolor rgbcolor "#222222"# draw data with foreground colorplot "audio_only.dat" with lines lt rgb 'white'

并运行:

sox audio.mp3 audio.dat #create plaintext file of amplitude valuestail -n+3 audio.dat > audio_only.dat #remove commentsgnuplot audio.gpi #run script

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

总结

以上是内存溢出为你收集整理的如何在Linux中创建MP3的波形图?全部内容,希望文章能够帮你解决如何在Linux中创建MP3的波形图?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1049284.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存