|
|
This article is available in: English Castellano ChineseGB Deutsch Francais Italiano Nederlands Russian Turkce |
by Guido Socher (homepage) 关于作者: Guido 喜欢Linux不仅仅是因为了解操作系统如何工作是一件有趣的事, 而是那些能将自身的设计融入其中的人。 目录: |
摘要:
Midi是一种声音文件格式,它不包含采样的数码声音,但它包含如何生成声音的描述信息。这和一个带有说明的表格类似,每一个说明表示一种声调。因此,相对于其它声音格式的文件。比如:Wav格式的文件,midi文件就显得小得多。
为了将Midi 转化为实际的声音,你需要一个Midi合成器。Midi合成器是一种硬件或软件,它能利用一种乐器(比如钢琴)的数字采样频率来产生声调。这些声音样本被称为"声音字体"。
这篇文章将讨论如何使用ALSA(Advanced Linux Sound Architecture)的接口来实现一个Midi合成器。
tar jxvf alsa-driver-0.5.12a.tar.bz2
cd alsa-driver-0.5.12a
./configure --with-sequencer=yes --with-oss=yes
--with-isapnp=no
make
make install
./snddevices
modprobe snd-card-emu10k1
modprobe snd-synth-emu10k1
modprobe snd-seq-midi
modprobe snd-pcm-oss
modprobe snd-mixer-oss
modprobe snd-seq-oss
/usr/sbin/alsactl store
好了,现在运行play flute.wav
你应该能够听到一些声音了。如果没有听到,进入/proc/asound目录,检查/proc/asound/devices和/proc/asound/oss-devices,应该存在"mixer"和 "digital audio" (在我的计算机)。/bin/sfxload /etc/midi/8MBGMSFX.SF2
一个比较好的测试程序是pmidi(参见附录),运行Port Client name Port name
64:0 External MIDI 0 MIDI 0-0
65:0 Emu10k1 WaveTable Emu10k1 Port 0
65:1 Emu10k1 WaveTable Emu10k1 Port 1
65:2 Emu10k1 WaveTable Emu10k1 Port 2
65:3 Emu10k1 WaveTable Emu10k1 Port 3
pmidi -p 65:0 test.mid
你应该能够听到Midi 的声音了。真酷!CFLAGS = -O3 -mpentium -march=pentium
-fomit-frame-pointer \
-funroll-all-loops -malign-double -ffast-math
./configure --enable-ncurses --enable-xaw
--enable-spectrogram --enable-xaw=dynamic
--enable-audio=oss,alsa --enable-alsaseq
--prefix=/usr/local/timidity-2.11.3
make
make install
cd /usr
find share/timidity -print | cpio -dump
/usr/local/timidity-2.11.3
/usr/local/timidity-2.11.3/bin/timidity -iA
-B2,8 -Os -EFreverb=0
以ALSA服务器模式运行TiMidity
set SCHED_FIFO
打开合成器端口:128:0 128:1
Port Client name Port name
128:0 Client-128 TiMidity port 0
128:1 Client-128 TiMidity port 1
pmidi -p 128:0 test.mid
你应该能够听Midi的声音了。alias char-major-116 snd
alias char-major-14 soundcore
alias snd-card-0 snd-card-emu10k1
alias sound-slot-0 snd-card-0
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
alias midi snd-synth-emu10k1
below snd-seq-oss snd-synth-emu10k1
post-install snd-synth-emu10k1 /bin/sfxload
/etc/midi/8MBGMSFX.SF2 ; alsactl restore
# uncomment to save volume settings at shutdown:
#pre-remove snd-synth-emu10k1 alsactl store
alias char-major-116 snd
alias char-major-14 soundcore
alias snd-card-0 snd-card-via686a
alias sound-slot-0 snd-card-0
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-12 snd-pcm-oss
# restore original mixer:
post-install snd-card-via686a alsactl restore
# uncomment to save volume settings at shutdown:
#pre-remove snd-synth-emu10k1 alsactl store
echo "starting timidity"
timidiy=/usr/local/timidity-2.11.3/bin/timidity # do not forget
the "&" in the next line:
$timidity -iA -B2,8 -Os -EFreverb=0 > /dev/null &
|
主页由LinuxFocus编辑组维护
© Guido Socher, FDL LinuxFocus.org 点击这里向LinuxFocus报告错误或提出意见 |
翻译信息:
|
2002-10-31, generated by lfparser version 2.25