Create a gist now

Instantly share code, notes, and snippets.

Embed
Flat Drum
Jacob Joaquin
October 8, 2010
jacobjoaquin@gmail.com
csoundblog.com
<CsoundSynthesizer>
<CsInstruments>
sr = 44100
kr = 44100
ksmps = 1
nchnls = 1
0dbfs = 1.0
instr 1
p3 = 0.15 + rnd(0.1) ; Override score duration
idur = p3 ; Duration
iamp = p4 * (0.8 + rnd(0.2)) ; Amplitude
ifreq = cpspch(p5) * (0.995 + rnd(0.01)) ; Frequency
; Percussive Transient
kenv linseg 1, 0.02 + rnd(0.02), 0, 0, 0 ; Amp envelope
a1 vco2 1, ifreq, 12 ; Triangle Oscillator
a2 vco2 1, ifreq * (1.6774 + rnd(0.00874)), 12 ; Triangle Oscillator
aring = (a1 * a2) * kenv ; Ring modulation
; Drum head
kenv linseg 1, 0.01, 0.3, idur - 0.01, 0 ; Amplitude envelope
a1 noise 1, 0 ; White Noise
a2 butterbp a1, ifreq, ifreq * 0.005 ; Band pass filter
a2 balance a2, a1 ; Compensate for gain loss
adrum = a2 * kenv * 0.3 ; Apply amplitude envelope
amix = (aring + adrum) * iamp ; Mix and change amplitude
out amix
endin
</CsInstruments>
<CsScore>
; Tune drums
# define a # 6.09 #
# define b # 7.03 #
# define c # 8.07 #
# define d # 9.05 #
t 0 160
i 1 0 0.5 0.707 $a
i 1 + . . $b
i 1 + . . $b
i 1 + . . $a
i 1 + . . $b
i 1 + . . $b
i 1 + . . $a
i 1 + . . $b
i 1 + . . $a
i 1 + . . $b
i 1 + . . $b
i 1 + . . $a
i 1 + . . $b
i 1 + . . $b
i 1 + . . $a
i 1 + . . $b
i 1 + . . $c
i 1 + . . $a
i 1 + . . $a
i 1 + . . $c
i 1 + . . $a
i 1 + . . $a
i 1 + . . $c
i 1 + . . $a
i 1 + . . $c
i 1 + . . $a
i 1 + . . $a
i 1 + . . $c
i 1 + . . $a
i 1 + . . $c
i 1 + . . $c
i 1 + . . $c
i 1 16 1 0.707 $a
i 1 + . . $a
i 1 + . . $b
i 1 + . . $a
i 1 + . . $a
i 1 + . . $a
i 1 + . . $b
i 1 + . . $a
i 1 + . . $a
i 1 + . . $a
i 1 + . . $b
i 1 + . . $a
i 1 + . . $a
i 1 + . . $a
i 1 + . . $b
i 1 + . . $a
i 1 16 0.666 0.707 $c
i 1 + . . .
i 1 + . . $d
i 1 + . . $c
i 1 + . . .
i 1 + . . $d
i 1 + . . $c
i 1 + . . .
i 1 + . . $d
i 1 + . . $c
i 1 + . . $d
i 1 + . . $c
i 1 + . . $c
i 1 + . . .
i 1 + . . $d
i 1 + . . $c
i 1 + . . .
i 1 + . . $d
i 1 + . . $c
i 1 + . . .
i 1 + . . $d
i 1 + . . $c
i 1 + . . .
i 1 + . . .
e 32
</CsScore>
</CsoundSynthesizer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment