分页: 1 / 1

做了一个垃圾脚本:midi2mp3。望高手完善!

发表于 : 2011-02-06 17:29
rgwan
做了一个垃圾脚本:midi2mp3。望高手完善!
最近做了个soundfont(wine 可恶的viena)。然后用它转换,效果不错。现在我做了一个脚本,可以把mid转成mp3.

#!/bin/bash
if [ "$1" = "" ]; then
echo 'Usage:$0 <midifile> <mp3 Kbps> '
echo 'This script is depend on timidity and lame.Please install this first.'
exit
fi
if [ "$1" = "-h" ]; then
echo 'Usage:$0 <midifile> <mp3 Kbps> '
echo 'This script is depend on timidity and lame.Please install this first.'
exit
fi
if [ "$1" = "--help" ]; then
echo 'Usage:$0 <midifile> <mp3 Kbps>'
echo 'This script is depend on timidity and lame.Please install this first.'
exit
fi

echo 'This script is depend on timidity and lame.Please install this first.'
echo 'Now.convert midi file to WAV format.'
timidity -Ow --resample=n "$1" -o "$1.wav"
echo 'Now.Timidity is finished job.use lame to convert format.'
lame -v -k -B $2 -V 0 -q 2 "$1.wav"
rm -v $1.wav
echo 'OK.Your mp3 file name is :'
echo $1.wav.mp3
。示范在这里http://www.kmlinux.tk/html/dev-party/523.html

Re: 做了一个垃圾脚本:midi2mp3。望高手完善!

发表于 : 2011-02-06 17:35
eexpress
不记得mplayer能播放不。如果能,就不用wine。

Re: 做了一个垃圾脚本:midi2mp3。望高手完善!

发表于 : 2011-02-06 19:32
rgwan
谁wine了?我只不过wine 编辑soundfont的软件。timidity 加载soundfont转码