Csound Csound-dev Csound-tekno Search About

drum kit

Date1998-12-09 01:01
FromXLR8R251@aol.com
Subjectdrum kit
My apologies to those who recieve this twice.  It looked like not all of this
made it through the first time.

*****

Here is the "non-MIDI" instr.  As you can see the only p references are to p4
and p5, easily changeable to veloc and notnum.  Sorry I didn't include it in
my original post as I was at work.  I have tried this version, without MIDI,
and I am now getting the same error, so it must be somewhere in my code.


sr	= 44100
kr	 = 4410
ksmps =  10
nchnls =  1

;f1 0 2048 10 1									;sine wave
;f2 0 2049 5  1 256 .667 1792 .0001				;exp env


		instr 4		;Drum Kit			
;=======================================

iamp	=			p4*10
inote	=			p5

if inote==36 goto	Kick
if inote==38 goto	Snare
if inote==42 goto	HHat
		goto		end

Kick:
ifdur	=			.00125

;pitch
;-------------------
kenv	linseg		0, .001, 1, .001, 1, .002, .4, .246, 0
kfrq	expseg		75, ifdur, 50, .25-ifdur, 25
alow	oscil		kenv*iamp, kfrq, 1
alow	butterlp	alow, 1000

;click
;-------------------
kamp	linseg		0, .001, .15, .002, 0, .247, 0
anrnd	rand		kamp
anoiz	oscil		anrnd*iamp, 200, 1

asig	=			alow+anoiz
		goto		end


Snare:

;tone
;-------------------
kenv	linseg		0, .001, iamp, .01, iamp, .015, iamp*.3, .015, 0
kpch	linseg		750, .002, 600, .004, 400
asnr	oscil		kenv, kpch, 1

;snap
;-------------------
k1		expseg		iamp*.45, .18, .001
k2		gauss		10000
a1		oscil		k1, k2, 1
anoiz	=			a1
asig	=			asnr+anoiz

;verb
;-------------------
arev	reverb2		asig, .26, 1
arev	butterlp	arev, 4000

asig	=			asig+arev*.08
		goto		end


HHat:

idur	=			0.3335
ifrq	=			15000                 

k4      linseg		1, idur-.05, 1, .05, 0, .01, 0
                                
ks      oscili		iamp, idur, 2         
ar      randi		ks, ifrq
a1      atone		ar, ks+ifrq
a1      balance		a1, ar
a1      oscili		a1, ifrq, 1

asig	=			k4*a1
		goto		end
		
end:
		out			asig