| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
</CsOptions> |
| 4 |
<CsInstruments> |
| 5 |
; Adapted from Richard Boulanger's toots |
| 6 |
sr = 44100 |
| 7 |
ksmps = 128 |
| 8 |
nchnls = 2 |
| 9 |
0dbfs = 1 |
| 10 |
|
| 11 |
instr 4 |
| 12 |
iamp = ampdbfs(p4) ; convert dB FS to linear amp |
| 13 |
iscale = iamp * .333 ; scale the amp at initialization |
| 14 |
inote = cpspch(p5) ; convert octave.pitch to cps |
| 15 |
|
| 16 |
k1 linen iscale, p6, p3, p7 ; p4=amp |
| 17 |
|
| 18 |
a3 oscil k1, inote*.996, 1 ; p5=freq |
| 19 |
a2 oscil k1, inote*1.004, 1 ; p6=attack time |
| 20 |
a1 oscil k1, inote, 1 ; p7=release time |
| 21 |
|
| 22 |
a1 = a1+a2+a3 |
| 23 |
outs a1, a1 |
| 24 |
|
| 25 |
endin |
| 26 |
</CsInstruments> |
| 27 |
<CsScore> |
| 28 |
; number time size GEN p1 |
| 29 |
f 1 0 4096 10 1 ; use GEN10 to compute a sine wave |
| 30 |
|
| 31 |
;ins strt dur amp freq attack release |
| 32 |
i4 0 1 -20 8.04 0.1 0.7 |
| 33 |
|
| 34 |
i4 1 1 -15 8.02 0.07 0.6 |
| 35 |
|
| 36 |
i4 2 1 -20 8.00 0.05 0.5 |
| 37 |
|
| 38 |
i4 3 1 -30 8.02 0.05 0.4 |
| 39 |
|
| 40 |
i4 4 1 -15 8.04 0.1 0.5 |
| 41 |
|
| 42 |
i4 5 1 -10 8.04 0.05 0.5 |
| 43 |
|
| 44 |
i4 6 2 -10 8.04 0.03 1. |
| 45 |
e ; indicates the end of the score |
| 46 |
</CsScore> |
| 47 |
</CsoundSynthesizer> |
| 48 |
<bsbPanel> |
| 49 |
<label>Widgets</label> |
| 50 |
<objectName/> |
| 51 |
<x>514</x> |
| 52 |
<y>322</y> |
| 53 |
<width>413</width> |
| 54 |
<height>431</height> |
| 55 |
<visible>true</visible> |
| 56 |
<uuid/> |
| 57 |
<bgcolor mode="background"> |
| 58 |
<r>7</r> |
| 59 |
<g>95</g> |
| 60 |
<b>162</b> |
| 61 |
</bgcolor> |
| 62 |
<bsbObject version="2" type="BSBLabel"> |
| 63 |
<objectName/> |
| 64 |
<x>14</x> |
| 65 |
<y>12</y> |
| 66 |
<width>100</width> |
| 67 |
<height>29</height> |
| 68 |
<uuid>{a6fa6d02-14cc-4f0c-b2c3-5e3da73375d3}</uuid> |
| 69 |
<visible>true</visible> |
| 70 |
<midichan>0</midichan> |
| 71 |
<midicc>-3</midicc> |
| 72 |
<label>Toot 4</label> |
| 73 |
<alignment>left</alignment> |
| 74 |
<font>DejaVu Sans</font> |
| 75 |
<fontsize>18</fontsize> |
| 76 |
<precision>3</precision> |
| 77 |
<color> |
| 78 |
<r>241</r> |
| 79 |
<g>241</g> |
| 80 |
<b>241</b> |
| 81 |
</color> |
| 82 |
<bgcolor mode="nobackground"> |
| 83 |
<r>255</r> |
| 84 |
<g>255</g> |
| 85 |
<b>255</b> |
| 86 |
</bgcolor> |
| 87 |
<bordermode>noborder</bordermode> |
| 88 |
<borderradius>1</borderradius> |
| 89 |
<borderwidth>1</borderwidth> |
| 90 |
</bsbObject> |
| 91 |
<bsbObject version="2" type="BSBLabel"> |
| 92 |
<objectName/> |
| 93 |
<x>14</x> |
| 94 |
<y>43</y> |
| 95 |
<width>365</width> |
| 96 |
<height>114</height> |
| 97 |
<uuid>{80a23d3c-a09d-4c5a-a02f-838a51099125}</uuid> |
| 98 |
<visible>true</visible> |
| 99 |
<midichan>0</midichan> |
| 100 |
<midicc>-3</midicc> |
| 101 |
<label>Next we'll animate the basic sound by mixing it with two slightly de-tuned copies of itself. We'll employ Csound's cpspch value converter which will allow us to specify the pitches by octave and pitch-class rather than by frequency, and we'll use the ampdbfs converter to specify loudness in dB FS rather than linearly.</label> |
| 102 |
<alignment>left</alignment> |
| 103 |
<font>DejaVu Sans</font> |
| 104 |
<fontsize>12</fontsize> |
| 105 |
<precision>3</precision> |
| 106 |
<color> |
| 107 |
<r>241</r> |
| 108 |
<g>241</g> |
| 109 |
<b>241</b> |
| 110 |
</color> |
| 111 |
<bgcolor mode="nobackground"> |
| 112 |
<r>255</r> |
| 113 |
<g>255</g> |
| 114 |
<b>255</b> |
| 115 |
</bgcolor> |
| 116 |
<bordermode>noborder</bordermode> |
| 117 |
<borderradius>1</borderradius> |
| 118 |
<borderwidth>1</borderwidth> |
| 119 |
</bsbObject> |
| 120 |
<bsbObject version="2" type="BSBScope"> |
| 121 |
<objectName/> |
| 122 |
<x>50</x> |
| 123 |
<y>276</y> |
| 124 |
<width>292</width> |
| 125 |
<height>96</height> |
| 126 |
<uuid>{2075a23a-bf65-471c-a1c4-f675ed4b806c}</uuid> |
| 127 |
<visible>true</visible> |
| 128 |
<midichan>0</midichan> |
| 129 |
<midicc>-3</midicc> |
| 130 |
<value>-255.00000000</value> |
| 131 |
<type>scope</type> |
| 132 |
<zoomx>2.00000000</zoomx> |
| 133 |
<zoomy>1.00000000</zoomy> |
| 134 |
<dispx>1.00000000</dispx> |
| 135 |
<dispy>1.00000000</dispy> |
| 136 |
<mode>0.00000000</mode> |
| 137 |
</bsbObject> |
| 138 |
<bsbObject version="2" type="BSBLabel"> |
| 139 |
<objectName/> |
| 140 |
<x>14</x> |
| 141 |
<y>162</y> |
| 142 |
<width>365</width> |
| 143 |
<height>102</height> |
| 144 |
<uuid>{94118d9a-d6aa-485c-81ac-b5148a74545b}</uuid> |
| 145 |
<visible>true</visible> |
| 146 |
<midichan>0</midichan> |
| 147 |
<midicc>-3</midicc> |
| 148 |
<label>Since we are adding the outputs of three oscillators, each with the same amplitude envelope, we'll scale the amplitude before we mix them. Both iscale and inote are arbitrary names to make the design a bit easier to read. Each is an i-rate variable, evaluated when the instrument is initialized.</label> |
| 149 |
<alignment>left</alignment> |
| 150 |
<font>DejaVu Sans</font> |
| 151 |
<fontsize>12</fontsize> |
| 152 |
<precision>3</precision> |
| 153 |
<color> |
| 154 |
<r>241</r> |
| 155 |
<g>241</g> |
| 156 |
<b>241</b> |
| 157 |
</color> |
| 158 |
<bgcolor mode="nobackground"> |
| 159 |
<r>255</r> |
| 160 |
<g>255</g> |
| 161 |
<b>255</b> |
| 162 |
</bgcolor> |
| 163 |
<bordermode>noborder</bordermode> |
| 164 |
<borderradius>1</borderradius> |
| 165 |
<borderwidth>1</borderwidth> |
| 166 |
</bsbObject> |
| 167 |
</bsbPanel> |
| 168 |
<bsbPresets> |
| 169 |
</bsbPresets> |