How to get midi sound in Ubuntu
This could come in handy if you don't have a soundcard with hardware MIDI or have no external MIDI instruments connected to your PC. You must then use software synthesis. There are two common options, Timidity and Fluidsynth. This section only covers setting up and using Timidity at the moment.
Installing Timidity
First install Timidity (using apt-get or Synaptic).
Next you need a set of samples. The easiest way is to install package 'freepats' (a 28 MB download), and you're done. Alternatively, for better sound, read the section below to set up a soundfont.
Once you've done that, you can try playing a midi file:
timidity myfile.mid
If all is well, you should hear delicate strains of synthesised music. If you have problems, read 'Reducing CPU usage' below.
Setting up Timidity as a MIDI server
Issue the following commands:
sudo modprobe snd-seq-device
sudo modprobe snd-seq-midi
sudo modprobe snd-seq-oss
sudo modprobe snd-seq-midi-event
sudo modprobe snd-seq
This loads missing modules. You may not need all these (I found it worked with just the first two). Then enter:
timidity -iA -B2,8 -Os1l -s 44100
This loads timidity as a midi server and opens 2 midi ports, 128:0 ad 128:1. After issuing it, you should have midi players working. You can open another terminal and issue a command such as:
pmidi -p 128:0 music.mid
kmid music.mid
To close timidity, press CTRL-C in the terminal it's running in.
Launching the server as root may improve performance because of higher priorities given to the process.
Notedit, or your score editor of choice can then be loaded and recognised the midi ports.
If the computer is busy doing something else other than playing music, you may hear scratches or have latency problems. This might be solved with a realtime kernel patch, but is out of the scope of this HOWTO.
Automatically starting Timidity on boot
Ubuntu Hoary sets up scripts in /etc/init.d when you install Timidity. To start it on boot, edit /etc/default/timidity and uncomment the line
TIM_ALSASEQ=true
You'll also need to add the modules you loaded earlier to /etc/modules.
Finding and setting up a soundfont
Websites: [WWW] http://www.personalcopy.com (try Unison.sf2) [WWW] http://www.hammersound.net/ or look up soundfonts in a search engine.
If you end up with a file ending with .sfArk, it's compressed in an annoying proprietary format. You may need a windows machine to decompress it, depending which version they've used. Details at [WWW] http://melodymachine.com/sfark.htm
Then you need to create the file /etc/timidity/timidity.cfg and add the following line (edit as appropriate):
soundfont /pathtothesoundfontfile/soundfontfile.sf2
Reducing CPU usage
If Timidity uses too much CPU on your slow machine, try adding these lines to the start of /etc/timidity/timidity.cfg (you may need to create this file)
opt EFresamp=l #use linear resampling
opt EFvlpf=d #disable VLPF
opt EFreverb=d #disable reverb
opt EFchorus=d #disable chorus
opt EFdelay=d #disable delay
[wiki]MidiSoftwareSynthesisHowTo
- oneleaf
- 论坛管理员
- 帖子: 10454
- 注册时间: 2005-03-27 0:06
- 系统: Ubuntu 12.04
[wiki]MidiSoftwareSynthesisHowTo
当净其意如虚空,远离妄想及诸取,令心所向皆无碍
- firehare
- 帖子: 2625
- 注册时间: 2005-04-10 16:54
- 来自: 温州大学
- 联系:
MIDI软件Synthesis指南
How to get midi sound in Ubuntu
怎样在Ubuntu中得到MIDI声音
This could come in handy if you don't have a soundcard with hardware MIDI or have no external MIDI instruments connected to your PC. You must then use software synthesis. There are two common options, Timidity and Fluidsynth. This section only covers setting up and using Timidity at the moment.
如果你没有支持MIDI的声卡或没有连接到你PC的外接MIDI设备,那你就必须要用软件Synthesis。它有两个通用组件,Timidity和Fluidsynth。本节此时只是展示如何安装和使用Timidity。
Installing Timidity
安装Timidity
First install Timidity (using apt-get or Synaptic).
首先安装Timidity(使用apt-get或Synaptic)
Next you need a set of samples. The easiest way is to install package 'freepats' (a 28 MB download), and you're done. Alternatively, for better sound, read the section below to set up a soundfont.
接下来你需要一组例子。最容易的方式就是安装‘freepats’包(下载需28MB),或者为了能得到更好的声音,阅读下面的章节以安装Soundfont。
Once you've done that, you can try playing a midi file:
当你安装好了之后,你可以尝试播放一个MIDI文件:
timidity myfile.mid
If all is well, you should hear delicate strains of synthesised music. If you have problems, read 'Reducing CPU usage' below.
如果一切正常的话,你可以听到Synthesis音乐的优美旋律。如果你有问题,请阅读下面的“减少CPU的使用”。
Setting up Timidity as a MIDI server
将Timidity设为MIDI服务器
Issue the following commands:
执行下列命令:
sudo modprobe snd-seq-device
sudo modprobe snd-seq-midi
sudo modprobe snd-seq-oss
sudo modprobe snd-seq-midi-event
sudo modprobe snd-seq
This loads missing modules. You may not need all these (I found it worked with just the first two). Then enter:
这样会引导错过的模块。你也许不需要全部的模块(我发现只需要前面二个就可以正常工作了)。然后输入:
timidity -iA -B2,8 -Os1l -s 44100
This loads timidity as a midi server and opens 2 midi ports, 128:0 ad 128:1. After issuing it, you should have midi players working. You can open another terminal and issue a command such as:
该命令使Timidity成为MIDI服务器并打开2个MIDI端口,128:0 ad 128:1。在你运行它之后,你就可以运行MIDI播放器了。你可以打开另一个终端并运行命令:
pmidi -p 128:0 music.mid
kmid music.mid
To close timidity, press CTRL-C in the terminal it's running in.
关闭Timidity,可以在它运行的终端里按CTRL-C。
Launching the server as root may improve performance because of higher priorities given to the process.
以根用户来运行服务也许能提高性能,因为它能给进程更高的权限。
Notedit, or your score editor of choice can then be loaded and recognised the midi ports.
不进行编辑或你选择的乐谱编辑器将被引导并能自动识别MIDI端口。
If the computer is busy doing something else other than playing music, you may hear scratches or have latency problems. This might be solved with a realtime kernel patch, but is out of the scope of this HOWTO.
如果计算机除了播放音乐外还在忙于处理其他事情,你也许会听到一些刮擦音或者有一些潜在的问题。这可以通过打实时内核补丁来解决,但这已经超出了本指南的范围。
Automatically starting Timidity on boot
引导时自启动Timidity
Ubuntu Hoary sets up scripts in /etc/init.d when you install Timidity. To start it on boot, edit /etc/default/timidity and uncomment the line
当你安装Timidity时,Ubuntu Hoary会在/etc/init.d目录中设置启动脚本。为了能在引导时启动,编辑/etc/default/timidity文件并反注释下列行:
TIM_ALSASEQ=true
You'll also need to add the modules you loaded earlier to /etc/modules.
你也需要添加需更早引导的模块到/etc/modules目录中。
Finding and setting up a soundfont
找到并设置soundfont
Websites: [WWW] http://www.personalcopy.com (try Unison.sf2) [WWW] http://www.hammersound.net/ or look up soundfonts in a search engine.
网站:[WWW] http://www.personalcopy.com (尝试 Unison.sf2) [WWW] http://www.hammersound.net/ 或在搜索引擎中查找Soundfonts。
If you end up with a file ending with .sfArk, it's compressed in an annoying proprietary format. You may need a windows machine to decompress it, depending which version they've used. Details at [WWW] http://melodymachine.com/sfark.htm
如果你的文件是以.afArk结束的话,那么它是用讨厌的私有格式压缩的。你也许需要用Windows机器根据所用版本来来解压它。详情请参见[WWW] http://melodymachine.com/sfark.htm
Then you need to create the file /etc/timidity/timidity.cfg and add the following line (edit as appropriate):
接下来,你需要创建文件/etc/timidity/timidity.cfg,并将下列行添加其中(适当编辑)
soundfont /pathtothesoundfontfile/soundfontfile.sf2
Reducing CPU usage
减少CPU的使用
If Timidity uses too much CPU on your slow machine, try adding these lines to the start of /etc/timidity/timidity.cfg (you may need to create this file)
如果Timidity在你低配置机器上占用太多CPU的话,试着将下列几行添加到/etc/timidity/timidity.cfg文件的开头(你也许需要创建该文件)
opt EFresamp=l #use linear resampling
opt EFvlpf=d #disable VLPF
opt EFreverb=d #disable reverb
opt EFchorus=d #disable chorus
opt EFdelay=d #disable delay
怎样在Ubuntu中得到MIDI声音
This could come in handy if you don't have a soundcard with hardware MIDI or have no external MIDI instruments connected to your PC. You must then use software synthesis. There are two common options, Timidity and Fluidsynth. This section only covers setting up and using Timidity at the moment.
如果你没有支持MIDI的声卡或没有连接到你PC的外接MIDI设备,那你就必须要用软件Synthesis。它有两个通用组件,Timidity和Fluidsynth。本节此时只是展示如何安装和使用Timidity。
Installing Timidity
安装Timidity
First install Timidity (using apt-get or Synaptic).
首先安装Timidity(使用apt-get或Synaptic)
Next you need a set of samples. The easiest way is to install package 'freepats' (a 28 MB download), and you're done. Alternatively, for better sound, read the section below to set up a soundfont.
接下来你需要一组例子。最容易的方式就是安装‘freepats’包(下载需28MB),或者为了能得到更好的声音,阅读下面的章节以安装Soundfont。
Once you've done that, you can try playing a midi file:
当你安装好了之后,你可以尝试播放一个MIDI文件:
timidity myfile.mid
If all is well, you should hear delicate strains of synthesised music. If you have problems, read 'Reducing CPU usage' below.
如果一切正常的话,你可以听到Synthesis音乐的优美旋律。如果你有问题,请阅读下面的“减少CPU的使用”。
Setting up Timidity as a MIDI server
将Timidity设为MIDI服务器
Issue the following commands:
执行下列命令:
sudo modprobe snd-seq-device
sudo modprobe snd-seq-midi
sudo modprobe snd-seq-oss
sudo modprobe snd-seq-midi-event
sudo modprobe snd-seq
This loads missing modules. You may not need all these (I found it worked with just the first two). Then enter:
这样会引导错过的模块。你也许不需要全部的模块(我发现只需要前面二个就可以正常工作了)。然后输入:
timidity -iA -B2,8 -Os1l -s 44100
This loads timidity as a midi server and opens 2 midi ports, 128:0 ad 128:1. After issuing it, you should have midi players working. You can open another terminal and issue a command such as:
该命令使Timidity成为MIDI服务器并打开2个MIDI端口,128:0 ad 128:1。在你运行它之后,你就可以运行MIDI播放器了。你可以打开另一个终端并运行命令:
pmidi -p 128:0 music.mid
kmid music.mid
To close timidity, press CTRL-C in the terminal it's running in.
关闭Timidity,可以在它运行的终端里按CTRL-C。
Launching the server as root may improve performance because of higher priorities given to the process.
以根用户来运行服务也许能提高性能,因为它能给进程更高的权限。
Notedit, or your score editor of choice can then be loaded and recognised the midi ports.
不进行编辑或你选择的乐谱编辑器将被引导并能自动识别MIDI端口。
If the computer is busy doing something else other than playing music, you may hear scratches or have latency problems. This might be solved with a realtime kernel patch, but is out of the scope of this HOWTO.
如果计算机除了播放音乐外还在忙于处理其他事情,你也许会听到一些刮擦音或者有一些潜在的问题。这可以通过打实时内核补丁来解决,但这已经超出了本指南的范围。
Automatically starting Timidity on boot
引导时自启动Timidity
Ubuntu Hoary sets up scripts in /etc/init.d when you install Timidity. To start it on boot, edit /etc/default/timidity and uncomment the line
当你安装Timidity时,Ubuntu Hoary会在/etc/init.d目录中设置启动脚本。为了能在引导时启动,编辑/etc/default/timidity文件并反注释下列行:
TIM_ALSASEQ=true
You'll also need to add the modules you loaded earlier to /etc/modules.
你也需要添加需更早引导的模块到/etc/modules目录中。
Finding and setting up a soundfont
找到并设置soundfont
Websites: [WWW] http://www.personalcopy.com (try Unison.sf2) [WWW] http://www.hammersound.net/ or look up soundfonts in a search engine.
网站:[WWW] http://www.personalcopy.com (尝试 Unison.sf2) [WWW] http://www.hammersound.net/ 或在搜索引擎中查找Soundfonts。
If you end up with a file ending with .sfArk, it's compressed in an annoying proprietary format. You may need a windows machine to decompress it, depending which version they've used. Details at [WWW] http://melodymachine.com/sfark.htm
如果你的文件是以.afArk结束的话,那么它是用讨厌的私有格式压缩的。你也许需要用Windows机器根据所用版本来来解压它。详情请参见[WWW] http://melodymachine.com/sfark.htm
Then you need to create the file /etc/timidity/timidity.cfg and add the following line (edit as appropriate):
接下来,你需要创建文件/etc/timidity/timidity.cfg,并将下列行添加其中(适当编辑)
soundfont /pathtothesoundfontfile/soundfontfile.sf2
Reducing CPU usage
减少CPU的使用
If Timidity uses too much CPU on your slow machine, try adding these lines to the start of /etc/timidity/timidity.cfg (you may need to create this file)
如果Timidity在你低配置机器上占用太多CPU的话,试着将下列几行添加到/etc/timidity/timidity.cfg文件的开头(你也许需要创建该文件)
opt EFresamp=l #use linear resampling
opt EFvlpf=d #disable VLPF
opt EFreverb=d #disable reverb
opt EFchorus=d #disable chorus
opt EFdelay=d #disable delay
我心无畏,源自于我心无知。


- oneleaf
- 论坛管理员
- 帖子: 10454
- 注册时间: 2005-03-27 0:06
- 系统: Ubuntu 12.04
- Hamtaro
- 帖子: 308
- 注册时间: 2005-04-15 5:59
- millenniumdark
- 论坛版主
- 帖子: 4159
- 注册时间: 2005-07-02 14:41
- 系统: Ubuntu 14.04 (Kylin)
- 联系: