个人工具

“UbuntuHelp:MidiSoftwareSynthesisHowTo”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(New page: {{From|https://help.ubuntu.com/community/MidiSoftwareSynthesisHowTo}} {{Languages|php5}} Use this guide to get MIDI sound working unless: a. you have a [[UbuntuHelp:SoundcardsWithHardwa...)
 
第19行: 第19行:
 
<pre><nowiki>
 
<pre><nowiki>
 
deb http://www.fbriere.net/debian/dists/etch misc/
 
deb http://www.fbriere.net/debian/dists/etch misc/
</nowiki></code>
+
</nowiki></pre>
 
You may then install the package 'timidity-patches-eaw' (a 31 MB download), and change the following line in the /etc/timidity/timidity.cfg file:
 
You may then install the package 'timidity-patches-eaw' (a 31 MB download), and change the following line in the /etc/timidity/timidity.cfg file:
 
<pre><nowiki>
 
<pre><nowiki>
 
source /etc/timidity/freepats.cfg
 
source /etc/timidity/freepats.cfg
</nowiki></code>
+
</nowiki></pre>
 
It should read:
 
It should read:
 
<pre><nowiki>
 
<pre><nowiki>
 
dir /usr/share/timidity/patches-eaw
 
dir /usr/share/timidity/patches-eaw
 
source /etc/timidity/eawpats.cfg
 
source /etc/timidity/eawpats.cfg
</nowiki></code>
+
</nowiki></pre>
 
Then get the configuration file:
 
Then get the configuration file:
 
<pre><nowiki>
 
<pre><nowiki>
 
cd /etc/timidity
 
cd /etc/timidity
 
sudo wget http://timidity.s11.xrea.com/files/cfgs/eawpats.cfg
 
sudo wget http://timidity.s11.xrea.com/files/cfgs/eawpats.cfg
</nowiki></code>
+
</nowiki></pre>
 
To use other samples, read 'Finding and setting up a soundfont' below.
 
To use other samples, read 'Finding and setting up a soundfont' below.
  
第40行: 第40行:
 
<pre><nowiki>
 
<pre><nowiki>
 
timidity myfile.mid
 
timidity myfile.mid
</nowiki></code>
+
</nowiki></pre>
 
If all is well, you should hear delicate strains of synthesised music. If you have problems, read 'Reducing CPU usage' below.
 
If all is well, you should hear delicate strains of synthesised music. If you have problems, read 'Reducing CPU usage' below.
  
第52行: 第52行:
 
sudo modprobe snd-seq-midi-event
 
sudo modprobe snd-seq-midi-event
 
sudo modprobe snd-seq
 
sudo modprobe snd-seq
</nowiki></code>
+
</nowiki></pre>
 
This loads missing modules. Then enter:
 
This loads missing modules. Then enter:
 
<pre><nowiki>
 
<pre><nowiki>
 
timidity -iA -B2,8 -Os1l -s 44100
 
timidity -iA -B2,8 -Os1l -s 44100
</nowiki></code>
+
</nowiki></pre>
 
This loads TiMidity++ as a midi server and opens 2 midi ports, 128:0 and 128:1.
 
This loads TiMidity++ as a midi server and opens 2 midi ports, 128:0 and 128:1.
 
After issuing it, you should have midi players working.  You can open another terminal and issue a command such as:
 
After issuing it, you should have midi players working.  You can open another terminal and issue a command such as:
第62行: 第62行:
 
pmidi -p 128:0 music.mid
 
pmidi -p 128:0 music.mid
 
kmid music.mid
 
kmid music.mid
</nowiki></code>
+
</nowiki></pre>
 
To close TiMidity++, press CTRL-C in the terminal it's running in.
 
To close TiMidity++, press CTRL-C in the terminal it's running in.
  
第76行: 第76行:
 
<pre><nowiki>
 
<pre><nowiki>
 
TIM_ALSASEQ=true
 
TIM_ALSASEQ=true
</nowiki></code>
+
</nowiki></pre>
 
You'll also need to add the modules you loaded earlier to /etc/modules.
 
You'll also need to add the modules you loaded earlier to /etc/modules.
  
第89行: 第89行:
 
<pre><nowiki>
 
<pre><nowiki>
 
soundfont /pathtothesoundfontfile/soundfontfile.sf2
 
soundfont /pathtothesoundfontfile/soundfontfile.sf2
</nowiki></code>
+
</nowiki></pre>
  
 
=== sfArk on Linux ===
 
=== sfArk on Linux ===
第96行: 第96行:
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get install wine
 
sudo apt-get install wine
</nowiki></code>
+
</nowiki></pre>
 
Next, you must obtain sfArk from this URL listed above.  Once you have WINE installed, all you must do is change to the directory where you have downloaded sfArk and issue the following command:
 
Next, you must obtain sfArk from this URL listed above.  Once you have WINE installed, all you must do is change to the directory where you have downloaded sfArk and issue the following command:
 
<pre><nowiki>
 
<pre><nowiki>
 
wine nameoffile
 
wine nameoffile
</nowiki></code>
+
</nowiki></pre>
 
sfArk also works beautifully in Crossover Office 5 as well.
 
sfArk also works beautifully in Crossover Office 5 as well.
  
第113行: 第113行:
 
opt EFchorus=d          #disable chorus
 
opt EFchorus=d          #disable chorus
 
opt EFdelay=d          #disable delay
 
opt EFdelay=d          #disable delay
</nowiki></code>
+
</nowiki></pre>
  
 
On Breezy Badger and Dapper Drake, simply uncomment all the lines in the section of the file that deals with a slow CPU. However, one of the lines contains a mistake. The "opt no-antialias" line should read "opt --no-anti-alias" instead. Also, make "opt p32a" say "opt p64a" because 32 voices just isn't enough.
 
On Breezy Badger and Dapper Drake, simply uncomment all the lines in the section of the file that deals with a slow CPU. However, one of the lines contains a mistake. The "opt no-antialias" line should read "opt --no-anti-alias" instead. Also, make "opt p32a" say "opt p64a" because 32 voices just isn't enough.

2007年5月13日 (日) 12:30的版本



Use this guide to get MIDI sound working unless:

a. you have a soundcard with a linux-supported hardware synth
a. you are using external MIDI instruments

Most people need to setup MIDI sound using software synthesis.

There are two main programs that do software synthesis, TiMidity++ and Fluidsynth. The installation and setup of TiMidity++ is covered in this guide.

Installing TiMidity++

Install TiMidity++

You will need the Universe repository enabled (see AddingRepositoriesHowto). Install the package `timidity` (see SynapticHowto).

Install samples

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, add the following repository line to your /etc/apt/sources.list file:

deb http://www.fbriere.net/debian/dists/etch misc/

You may then install the package 'timidity-patches-eaw' (a 31 MB download), and change the following line in the /etc/timidity/timidity.cfg file:

source /etc/timidity/freepats.cfg

It should read:

dir /usr/share/timidity/patches-eaw
source /etc/timidity/eawpats.cfg

Then get the configuration file:

cd /etc/timidity
sudo wget http://timidity.s11.xrea.com/files/cfgs/eawpats.cfg

To use other samples, read 'Finding and setting up a soundfont' below.

See if midi plays

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: You may not need all these (I found it worked with just the first two).

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. Then enter:

timidity -iA -B2,8 -Os1l -s 44100

This loads TiMidity++ as a midi server and opens 2 midi ports, 128:0 and 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 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: http://www.personalcopy.com (try Unison.sf2) http://www.hammersound.net/ or look up soundfonts in a search engine. A big list may be found at http://timidity.s11.xrea.com/files/readme_cfgp.htm in which the fifth soundfont from the top (SGM-whatever) is quite complete for general use with TiMidity++.

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 http://melodymachine.com/sfark.htm There is a Linux version available on the website.

Then you need to edit the file /etc/timidity/timidity.cfg and add the following line (edit as appropriate):

soundfont /pathtothesoundfontfile/soundfontfile.sf2

sfArk on Linux

If you need to decompress sfArk compressed Soundfonts whenever the Linux version of the extractor does not work, then you can easily install sfArk into linux using WINE. If you don't have WINE installed on your machine then you can install it with the following command:

sudo apt-get install wine

Next, you must obtain sfArk from this URL listed above. Once you have WINE installed, all you must do is change to the directory where you have downloaded sfArk and issue the following command:

wine nameoffile

sfArk also works beautifully in Crossover Office 5 as well.


Reducing CPU usage

If TiMidity++ uses too much CPU on your slow machine, and you're running a version prior to Breezy Badger, 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

On Breezy Badger and Dapper Drake, simply uncomment all the lines in the section of the file that deals with a slow CPU. However, one of the lines contains a mistake. The "opt no-antialias" line should read "opt --no-anti-alias" instead. Also, make "opt p32a" say "opt p64a" because 32 voices just isn't enough.

Discussion

Ask questions at [1]


CategoryDocumentation