一個規律、有週期性的聲音稱為樂音,反之則稱為噪音。愈有週期性的聲音會愈好聽,許多音樂甚至還會加入某些音效來強調音樂的週期性,明確地點出節奏,來豐富音樂的內容。用來強調節拍的樂器常是打擊樂器,有許多種類,鼓在這裡佔了非常重要的地位哦!



在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	str	dur	pitch	table
		;i10	0	1	8.00	17
		
		;ins	str	dur	tempo
		i20	0	100	120
		e
	</CsScore>
</CsoundSynthesizer>

只要更改第20號樂器loop內的樂器搭配方式,就可以打出不同的節奏啦!

節奏分享

兩拍節奏

兩拍節奏試聽

				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