~ubuntu-branches/ubuntu/trusty/csound-manual/trusty-proposed

« back to all changes in this revision

Viewing changes to examples-xml/modmatrix.csd.xml

  • Committer: Bazaar Package Importer
  • Author(s): Felipe Sateler
  • Date: 2011-08-01 22:21:58 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110801222158-90kslkp5ujci2f5d
Tags: 1:5.13~dfsg-1
* New upstream release
 - Add Menno Knevel to the copyright file
 - Refresh patch 2000-stripped-opcodes.diff
 - Update copyright hints file
* Update Vcs-* headers
* Bump Standards-Version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<programlisting>
 
2
<emphasis role="csdtag">&lt;CsoundSynthesizer&gt;</emphasis>
 
3
<emphasis role="csdtag">&lt;CsOptions&gt;</emphasis>
 
4
<emphasis role="comment">; Select audio flags here according to platform</emphasis>
 
5
<emphasis role="comment">; Audio out   Audio in</emphasis>
 
6
<emphasis role="comment">;-odac           -iadc    ;;;RT audio I/O</emphasis>
 
7
<emphasis role="comment">; For Non-realtime ouput leave only the line below:</emphasis>
 
8
 -o modmatrix.wav -W <emphasis role="comment">;;; for file output any platform</emphasis>
 
9
<emphasis role="csdtag">&lt;/CsOptions&gt;</emphasis>
 
10
<emphasis role="csdtag">&lt;CsInstruments&gt;</emphasis>
 
11
 
 
12
        <emphasis role="ohdr">sr</emphasis>     <emphasis role="op">=</emphasis>        44100
 
13
        <emphasis role="ohdr">kr</emphasis>     <emphasis role="op">=</emphasis>        441
 
14
        <emphasis role="ohdr">ksmps</emphasis>  <emphasis role="op">=</emphasis>        100
 
15
        <emphasis role="ohdr">nchnls</emphasis> <emphasis role="op">=</emphasis>        2
 
16
        <emphasis role="ohdr">0dbfs</emphasis>  <emphasis role="op">=</emphasis>        1
 
17
 
 
18
<emphasis role="comment">; basic waveforms</emphasis>
 
19
giSine  <emphasis role="ohdr">ftgen</emphasis>  0, 0, 65537, 10, 1      <emphasis role="comment">; sine wave</emphasis>
 
20
giSaw   <emphasis role="ohdr">ftgen</emphasis>  0, 0, 4097, 7, 1, 4096, <emphasis role="op">-</emphasis>1       <emphasis role="comment">; saw (linear)</emphasis>
 
21
giSoftSaw <emphasis role="ohdr">ftgen</emphasis>        0, 0, 65537, 30, giSaw, 1, 10   <emphasis role="comment">; soft saw (only 10 first harmonics)</emphasis>
 
22
 
 
23
<emphasis role="comment">; modmatrix tables</emphasis>
 
24
giMaxNumParam   <emphasis role="op">=</emphasis> 128
 
25
giMaxNumMod     <emphasis role="op">=</emphasis> 32
 
26
giParam_In <emphasis role="ohdr">ftgen</emphasis> 0, 0, giMaxNumParam, 2, 0     <emphasis role="comment">; input parameters table</emphasis>
 
27
<emphasis role="comment">; output parameters table (parameter values with added modulators)</emphasis>
 
28
giParam_Out <emphasis role="ohdr">ftgen</emphasis> 0, 0, giMaxNumParam, 2, 0    
 
29
giModulators <emphasis role="ohdr">ftgen</emphasis> 0, 0, giMaxNumMod, 2, 0      <emphasis role="comment">; modulators table</emphasis>
 
30
<emphasis role="comment">; modulation scaling and routing (mod matrix) table, start with empty table</emphasis>
 
31
giModScale <emphasis role="ohdr">ftgen</emphasis> 0, 0, giMaxNumParam<emphasis role="op">*</emphasis>giMaxNumMod, <emphasis role="op">-</emphasis>2, 0          
 
32
 
 
33
<emphasis role="comment">;********************************************</emphasis>
 
34
<emphasis role="comment">; generate the modulator signals</emphasis>
 
35
<emphasis role="comment">;********************************************</emphasis>
 
36
        <emphasis role="oblock">instr</emphasis> 1
 
37
 
 
38
<emphasis role="comment">; LFO1, 1.5 Hz, normalized range (0.0 to 1.0)</emphasis>
 
39
kLFO1   <emphasis role="opc">oscil</emphasis>   0.5, 1.5, giSine                <emphasis role="comment">; generate LFO signal</emphasis>
 
40
kLFO1   <emphasis role="op">=</emphasis> kLFO1<emphasis role="op">+</emphasis>0.5                               <emphasis role="comment">; offset</emphasis>
 
41
 
 
42
<emphasis role="comment">; LFO2, 0.4 Hz, normalized range (0.0 to 1.0)</emphasis>
 
43
kLFO2   <emphasis role="opc">oscil</emphasis>   0.5, 0.4, giSine                <emphasis role="comment">; generate LFO signal</emphasis>
 
44
kLFO2   <emphasis role="op">=</emphasis> kLFO2<emphasis role="op">+</emphasis>0.5                               <emphasis role="comment">; offset</emphasis>
 
45
 
 
46
 
 
47
<emphasis role="comment">; write modulators to table</emphasis>
 
48
        <emphasis role="opc">tablew</emphasis>  kLFO1, 0, giModulators
 
49
        <emphasis role="opc">tablew</emphasis>  kLFO2, 1, giModulators
 
50
 
 
51
        <emphasis role="oblock">endin</emphasis>
 
52
 
 
53
<emphasis role="comment">;********************************************</emphasis>
 
54
<emphasis role="comment">; set parameter values</emphasis>
 
55
<emphasis role="comment">;********************************************</emphasis>
 
56
        <emphasis role="oblock">instr</emphasis> 2
 
57
 
 
58
<emphasis role="comment">; Here we can set the parameter values</emphasis>
 
59
icps1   <emphasis role="op">=</emphasis> p4
 
60
icps2   <emphasis role="op">=</emphasis> p5
 
61
icutoff <emphasis role="op">=</emphasis> p6
 
62
        
 
63
<emphasis role="comment">; write parameters to table</emphasis>
 
64
        <emphasis role="opc">tableiw</emphasis> icps1, 0, giParam_In
 
65
        <emphasis role="opc">tableiw</emphasis> icps2, 1, giParam_In
 
66
        <emphasis role="opc">tableiw</emphasis> icutoff, 2, giParam_In
 
67
 
 
68
        <emphasis role="oblock">endin</emphasis>
 
69
 
 
70
<emphasis role="comment">;********************************************</emphasis>
 
71
<emphasis role="comment">; mod matrix edit</emphasis>
 
72
<emphasis role="comment">;********************************************</emphasis>
 
73
        <emphasis role="oblock">instr</emphasis> 3
 
74
 
 
75
<emphasis role="comment">; Here we can write to the modmatrix table by using tablew or tableiw</emphasis>
 
76
 
 
77
iLfo1ToCps1     <emphasis role="op">=</emphasis> p4
 
78
iLfo1ToCps2     <emphasis role="op">=</emphasis> p5
 
79
iLfo1ToCutoff   <emphasis role="op">=</emphasis> p6
 
80
iLfo2ToCps1     <emphasis role="op">=</emphasis> p7
 
81
iLfo2ToCps2     <emphasis role="op">=</emphasis> p8
 
82
iLfo2ToCutoff   <emphasis role="op">=</emphasis> p9
 
83
 
 
84
        <emphasis role="opc">tableiw</emphasis> iLfo1ToCps1, 0, giModScale
 
85
        <emphasis role="opc">tableiw</emphasis> iLfo1ToCps2, 1, giModScale
 
86
        <emphasis role="opc">tableiw</emphasis> iLfo1ToCutoff, 2, giModScale
 
87
        <emphasis role="opc">tableiw</emphasis> iLfo2ToCps1, 3, giModScale
 
88
        <emphasis role="opc">tableiw</emphasis> iLfo2ToCps2, 4, giModScale
 
89
        <emphasis role="opc">tableiw</emphasis> iLfo2ToCutoff, 5, giModScale
 
90
        
 
91
<emphasis role="comment">; and set the update flag for modulator matrix </emphasis>
 
92
<emphasis role="comment">; ***(must update to enable changes)</emphasis>
 
93
ktrig   <emphasis role="opc">init</emphasis> 1
 
94
        <emphasis role="opc">chnset</emphasis>  ktrig, "modulatorUpdateFlag"
 
95
ktrig   <emphasis role="op">=</emphasis> 0
 
96
 
 
97
        <emphasis role="oblock">endin</emphasis>
 
98
 
 
99
<emphasis role="comment">;********************************************</emphasis>
 
100
<emphasis role="comment">; mod matrix</emphasis>
 
101
<emphasis role="comment">;********************************************</emphasis>
 
102
        <emphasis role="oblock">instr</emphasis> 4
 
103
 
 
104
<emphasis role="comment">; get the update flag</emphasis>
 
105
kupdate <emphasis role="opc">chnget</emphasis>  "modulatorUpdateFlag"           
 
106
 
 
107
<emphasis role="comment">; run the mod matrix </emphasis>
 
108
inum_mod        <emphasis role="op">=</emphasis> 2
 
109
inum_parm       <emphasis role="op">=</emphasis> 3
 
110
        <emphasis role="opc">modmatrix</emphasis> giParam_Out, giModulators, giParam_In, \\
 
111
        giModScale, inum_mod, inum_parm, kupdate
 
112
 
 
113
<emphasis role="comment">; and reset the update flag</emphasis>
 
114
        <emphasis role="opc">chnset</emphasis>  0, "modulatorUpdateFlag"  <emphasis role="comment">; reset the update flag</emphasis>
 
115
 
 
116
        <emphasis role="oblock">endin</emphasis>
 
117
 
 
118
<emphasis role="comment">;********************************************</emphasis>
 
119
<emphasis role="comment">; audio generator to test values</emphasis>
 
120
<emphasis role="comment">;********************************************</emphasis>
 
121
        <emphasis role="oblock">instr</emphasis> 5
 
122
 
 
123
<emphasis role="comment">; basic parameters</emphasis>
 
124
        iamp    <emphasis role="op">=</emphasis> <emphasis role="opc">ampdbfs</emphasis>(<emphasis role="op">-</emphasis>5)
 
125
 
 
126
<emphasis role="comment">; read modulated parameters from table</emphasis>
 
127
        kcps1   <emphasis role="opc">table</emphasis>   0, giParam_Out
 
128
        kcps2   <emphasis role="opc">table</emphasis>   1, giParam_Out
 
129
        kcutoff <emphasis role="opc">table</emphasis>   2, giParam_Out
 
130
 
 
131
<emphasis role="comment">; set filter parameters</emphasis>
 
132
        kCF_freq1       <emphasis role="op">=</emphasis> kcps1<emphasis role="op">*</emphasis>kcutoff
 
133
        kCF_freq2       <emphasis role="op">=</emphasis> kcps2<emphasis role="op">*</emphasis>kcutoff
 
134
        kReso           <emphasis role="op">=</emphasis> 0.7
 
135
        kDist           <emphasis role="op">=</emphasis> 0.3
 
136
 
 
137
<emphasis role="comment">; oscillators and filters</emphasis>
 
138
        a1      <emphasis role="opc">oscili</emphasis>  iamp, kcps1, giSoftSaw
 
139
        a1      <emphasis role="opc">lpf18</emphasis>   a1, kCF_freq1, kReso, kDist
 
140
 
 
141
        a2      <emphasis role="opc">oscili</emphasis>  iamp, kcps2, giSoftSaw
 
142
        a2      <emphasis role="opc">lpf18</emphasis>   a2, kCF_freq2, kReso, kDist
 
143
        
 
144
                <emphasis role="opc">outs</emphasis>    a1, a2
 
145
 
 
146
        <emphasis role="oblock">endin</emphasis>
 
147
 
 
148
<emphasis role="csdtag">&lt;/CsInstruments&gt;</emphasis>
 
149
<emphasis role="csdtag">&lt;CsScore&gt;</emphasis>
 
150
 
 
151
<emphasis role="comment">;********************************************</emphasis>
 
152
<emphasis role="comment">; set initial parameters</emphasis>
 
153
<emphasis role="comment">;      cps1    cps2    cutoff</emphasis>
 
154
<emphasis role="stamnt">i</emphasis>2 0 1       400     800     3
 
155
 
 
156
<emphasis role="comment">;********************************************</emphasis>
 
157
<emphasis role="comment">; set modmatrix values</emphasis>
 
158
<emphasis role="comment">;      lfo1ToCps1 lfo1ToCps2 lfo1ToCut lfo2ToCps1 lfo2ToCps2 lfo2ToCut</emphasis>
 
159
<emphasis role="stamnt">i</emphasis>3 0 1       40         0          -2        -50        100        3
 
160
 
 
161
<emphasis role="comment">;********************************************</emphasis>
 
162
<emphasis role="comment">; start "always on" instruments</emphasis>
 
163
#define SCORELEN # 20 #  <emphasis role="comment">; set length of score</emphasis>
 
164
 
 
165
<emphasis role="stamnt">i</emphasis>1 0 $SCORELEN                       <emphasis role="comment">; start modulators</emphasis>
 
166
<emphasis role="stamnt">i</emphasis>4 0 $SCORELEN                       <emphasis role="comment">; start mod matrix</emphasis>
 
167
<emphasis role="stamnt">i</emphasis>5 0 $SCORELEN                       <emphasis role="comment">; start audio oscillator</emphasis>
 
168
 
 
169
<emphasis role="stamnt">e</emphasis>    
 
170
 
 
171
<emphasis role="csdtag">&lt;/CsScore&gt;</emphasis>
 
172
<emphasis role="csdtag">&lt;/CsoundSynthesizer&gt;</emphasis>
 
173
</programlisting>
 
 
b'\\ No newline at end of file'