| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
; Audio out Audio in |
| 5 |
-odac ;;;RT audio out |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o delay1.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
; by Menno Knevel 2021, after Russel Pinkston |
| 12 |
|
| 13 |
sr = 44100 |
| 14 |
ksmps = 32 |
| 15 |
nchnls = 2 |
| 16 |
0dbfs = 1 |
| 17 |
|
| 18 |
|
| 19 |
instr 1 ; original sounds |
| 20 |
|
| 21 |
ichoice = p4 |
| 22 |
if ichoice == 0 then |
| 23 |
prints "\n--**original beats**--\n\n" |
| 24 |
aout diskin2 "drumsMlp.wav" |
| 25 |
else |
| 26 |
prints "\n--**original noise**--\n\n" |
| 27 |
aout rand .2 |
| 28 |
endif |
| 29 |
outs aout, aout |
| 30 |
|
| 31 |
endin |
| 32 |
|
| 33 |
instr 2 ; Finite Impulse Response (FIR) Filter |
| 34 |
|
| 35 |
ichoice = p4 |
| 36 |
if ichoice == 0 then |
| 37 |
prints "\n--**FIRST-ORDER LOW-PASS on the beats**--\n\n" |
| 38 |
aout diskin2 "drumsMlp.wav" |
| 39 |
else |
| 40 |
prints "\n--**FIRST-ORDER LOW-PASS on the noise**--\n\n" |
| 41 |
aout rand .2 |
| 42 |
endif |
| 43 |
|
| 44 |
adel1 delay1 aout ; delay 1 sample |
| 45 |
asig = (.5* aout)+(.5* adel1) ; average 2 succesive inputs |
| 46 |
outs asig, asig |
| 47 |
|
| 48 |
endin |
| 49 |
|
| 50 |
|
| 51 |
instr 3 ; Finite Impulse Response (FIR) Filter |
| 52 |
|
| 53 |
ichoice = p4 |
| 54 |
if ichoice == 0 then |
| 55 |
prints "\n--**FIRST-ORDER HIGH-PASS on the beats**--\n\n" |
| 56 |
aout diskin2 "drumsMlp.wav" |
| 57 |
else |
| 58 |
prints "\n--**FIRST-ORDER HIGH-PASS on the noise**--\n\n" |
| 59 |
aout rand .2 |
| 60 |
endif |
| 61 |
|
| 62 |
adel1 delay1 aout ; delay 1 sample |
| 63 |
asig = (.5*aout)-(.5*adel1) ; difference of 2 inputs |
| 64 |
outs asig, asig |
| 65 |
|
| 66 |
endin |
| 67 |
|
| 68 |
instr 4 ; Finite Impulse Response (FIR) Filter |
| 69 |
|
| 70 |
ichoice = p4 |
| 71 |
if ichoice == 0 then |
| 72 |
prints "\n--**SECOND-ORDER NOTCH on the beats**--\n\n" |
| 73 |
aout diskin2 "drumsMlp.wav" |
| 74 |
else |
| 75 |
prints "\n--**SECOND-ORDER NOTCH on the noise**--\n\n" |
| 76 |
aout rand .2 |
| 77 |
endif |
| 78 |
|
| 79 |
adel1 delay1 aout ; x(n - 1) |
| 80 |
adel2 delay1 adel1 ; x(n - 2) |
| 81 |
asig = (.5*aout)+(.5*adel2) ; y(n) = .5x(n) + .5x(n - 2) |
| 82 |
outs asig, asig |
| 83 |
|
| 84 |
endin |
| 85 |
|
| 86 |
instr 5 ; Finite Impulse Response (FIR) Filter |
| 87 |
|
| 88 |
ichoice = p4 |
| 89 |
if ichoice == 0 then |
| 90 |
prints "\n--**SECOND-ORDER BAND-PASS on the beats**--\n\n" |
| 91 |
aout diskin2 "drumsMlp.wav" |
| 92 |
else |
| 93 |
prints "\n--**SECOND-ORDER BAND-PASS on the noise**--\n\n" |
| 94 |
aout rand .2 |
| 95 |
endif |
| 96 |
|
| 97 |
adel1 delay1 aout ; x(n - 1) |
| 98 |
adel2 delay1 adel1 ; x(n - 2) |
| 99 |
asig = (.5*aout)-(.5*adel2) ; y(n) = .5x(n) - .5x(n - 2) |
| 100 |
outs asig, asig |
| 101 |
|
| 102 |
endin |
| 103 |
|
| 104 |
</CsInstruments> |
| 105 |
<CsScore> |
| 106 |
|
| 107 |
i1 0 2 0 |
| 108 |
i1 3 2 1 |
| 109 |
s |
| 110 |
i2 1 2 0 |
| 111 |
i2 4 2 1 |
| 112 |
s |
| 113 |
i3 1 2 0 |
| 114 |
i3 4 2 1 |
| 115 |
s |
| 116 |
i4 1 2 0 |
| 117 |
i4 4 2 1 |
| 118 |
s |
| 119 |
i5 1 2 0 |
| 120 |
i5 4 2 1 |
| 121 |
e |
| 122 |
</CsScore> |
| 123 |
</CsoundSynthesizer> |