一个规律、有周期性的声音称为乐音,反之则称为噪音。愈有周期性的声音会愈好听,许多音乐甚至还会加入某些音效来强调音乐的周期性,明确地点出节奏,来丰富音乐的内容。用来强调节拍的乐器常是打击乐器,有许多种类,鼓在这里占了非常重要的地位哦!
在 Csound 中,要合成打击乐器的声音比较困难,因此这个部份通常会使用外部的声音文件来解决。鼓是打击乐器的代表,在这里就以鼓组的声音来搭出节奏吧!
鼓组的音效可以按这里下载。
节奏程序范例
<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
sr = 44100 ;sample rate
ksmps = 16 ;samples in a control period
nchnls = 1 ;number of channels
0dbfs = 100 ;value of 0db
instr 20
ininstr = 100 ;number of loop cycles
index = 0 ;loop counter
istart = 0
iradio = 60./p4
ib_half_half = 0.25 * iradio;
ib_half = 0.5 * iradio;
ib_one = 1 * iradio;
ib_one_half = 1.5 * iradio;
ib_two = 2.0 * iradio;
ib_two_half = 2.5 * iradio;
ib_three = 3.0 * iradio;
ib_three_half = 3.5 * iradio;
ib_four = 4.0 * iradio;
loop:
;------Put your instruments here------
event_i "i", 10, istart, ib_half, 8.00, 13
istart = istart + ib_half
event_i "i", 10, istart, ib_half, 8.00, 17
istart = istart + ib_half
event_i "i", 10, istart, ib_one, 8.00, 17
istart = istart + ib_one
event_i "i", 10, istart, ib_half, 8.00, 13
istart = istart + ib_half
event_i "i", 10, istart, ib_half, 8.00, 17
istart = istart + ib_half
event_i "i", 10, istart, ib_one, 8.00, 17
istart = istart + ib_one
event_i "i", 10, istart, ib_half, 8.00, 13
istart = istart + ib_half
event_i "i", 10, istart, ib_half, 8.00, 17
istart = istart + ib_half
event_i "i", 10, istart, ib_half, 8.00, 17
istart = istart + ib_half
event_i "i", 10, istart, ib_half, 8.00, 17
istart = istart + ib_half
event_i "i", 10, istart, ib_half, 8.00, 13
istart = istart + ib_half
event_i "i", 10, istart, ib_half, 8.00, 17
istart = istart + ib_half
event_i "i", 10, istart, ib_one, 8.00, 17
istart = istart + ib_one
;-------------------------------------
loop_lt index, 1, ininstr, loop
endin
instr 10
;Settings
iTable init p5 ;Funcation table number
iTableLen tableng iTable ;Funcation table length
iFreq init sr / iTableLen * (cpspch(p4)/cpspch(8.0)) ;Cycle per second
aenv linseg 1, 1./iFreq, 1, 0, 0, p3-1./iFreq, 0
asig oscil 100, iFreq, iTable
out aenv*asig
endin
</CsInstruments>
<CsScore>
f11 0 32768 1 1 0 0 2
f12 0 32768 1 2 0 0 2
f13 0 32768 1 3 0 0 2
f14 0 32768 1 4 0 0 2
f15 0 32768 1 5 0 0 2
f16 0 32768 1 6 0 0 2
f17 0 32768 1 7 0 0 2
t 0 120
;ins strt dur pitch table
;i10 0 1 8.00 17
;ins strt dur tempo
i20 0 100 120
e
</CsScore>
</CsoundSynthesizer>
只要更改第 20 号乐器 loop 内的乐器搭配方式,就可以打出不同的节奏啦!
节奏分享
两拍节奏
istart2 = istart
event_i "i", 10, istart2, ib_half, 8.00, 14
istart2 = istart2 + ib_half
event_i "i", 10, istart2, ib_half, 8.00, 14
istart2 = istart2 + ib_half
event_i "i", 10, istart2, ib_half, 8.00, 14
istart2 = istart2 + ib_half
event_i "i", 10, istart2, ib_half, 8.00, 14
istart2 = istart2 + ib_half
event_i "i", 10, istart, ib_one, 8.00, 17
istart = istart + ib_one
event_i "i", 10, istart, ib_one, 8.00, 13
istart = istart + ib_one
三拍节奏
istart2 = istart
event_i "i", 10, istart2, ib_half, 8.00, 14
istart2 = istart2 + ib_half
event_i "i", 10, istart2, ib_half, 8.00, 14
istart2 = istart2 + ib_half
event_i "i", 10, istart2, ib_half, 8.00, 14
istart2 = istart2 + ib_half
event_i "i", 10, istart2, ib_half, 8.00, 14
istart2 = istart2 + ib_half
event_i "i", 10, istart2, ib_half, 8.00, 14
istart2 = istart2 + ib_half
event_i "i", 10, istart2, ib_half, 8.00, 14
istart2 = istart2 + ib_half
event_i "i", 10, istart, ib_half, 8.00, 17
istart = istart + ib_half
event_i "i", 10, istart, ib_half, 8.00, 13
istart = istart + ib_half
event_i "i", 10, istart, ib_half, 8.00, 13
istart = istart + ib_half
event_i "i", 10, istart, ib_half, 8.00, 17
istart = istart + ib_half
event_i "i", 10, istart, ib_one, 8.00, 13
istart = istart + ib_one
四拍节奏
istart2 = istart
event_i "i", 10, istart2, ib_half, 8.00, 14
istart2 = istart2 + ib_half
event_i "i", 10, istart2, ib_half, 8.00, 14
istart2 = istart2 + ib_half
event_i "i", 10, istart2, ib_half, 8.00, 14
istart2 = istart2 + ib_half
event_i "i", 10, istart2, ib_half, 8.00, 14
istart2 = istart2 + ib_half
event_i "i", 10, istart2, ib_half, 8.00, 14
istart2 = istart2 + ib_half
event_i "i", 10, istart2, ib_half, 8.00, 14
istart2 = istart2 + ib_half
event_i "i", 10, istart2, ib_half, 8.00, 13
istart2 = istart2 + ib_half
event_i "i", 10, istart2, ib_half, 8.00, 14
istart2 = istart2 + ib_half
event_i "i", 10, istart, ib_half, 8.00, 17
istart = istart + ib_half
event_i "i", 10, istart, ib_half, 8.00, 17
istart = istart + ib_half
event_i "i", 10, istart, ib_one, 8.00, 13
istart = istart + ib_one_half
event_i "i", 10, istart, ib_half, 8.00, 17
istart = istart + ib_one_half
八拍节奏
event_i "i", 10, istart, ib_half, 8.00, 13
istart = istart + ib_half
event_i "i", 10, istart, ib_half, 8.00, 17
istart = istart + ib_half
event_i "i", 10, istart, ib_one, 8.00, 17
istart = istart + ib_one
event_i "i", 10, istart, ib_half, 8.00, 13
istart = istart + ib_half
event_i "i", 10, istart, ib_half, 8.00, 17
istart = istart + ib_half
event_i "i", 10, istart, ib_one, 8.00, 17
istart = istart + ib_one
event_i "i", 10, istart, ib_half, 8.00, 13
istart = istart + ib_half
event_i "i", 10, istart, ib_half, 8.00, 17
istart = istart + ib_half
event_i "i", 10, istart, ib_half, 8.00, 17
istart = istart + ib_half
event_i "i", 10, istart, ib_half, 8.00, 17
istart = istart + ib_half
event_i "i", 10, istart, ib_half, 8.00, 13
istart = istart + ib_half
event_i "i", 10, istart, ib_half, 8.00, 17
istart = istart + ib_half
event_i "i", 10, istart, ib_one, 8.00, 17
istart = istart + ib_one
