1
- - # What's new in Csound 7
1
+ # What's new in Csound 7
2
2
3
3
Csound 7 brings major changes which offer new possibilities for users and modernize coding. Nevertheless Csound 7 keeps backwards compatibility: Despite new syntax features any valid Csound code from the past can be run without any code change.
4
4
@@ -117,7 +117,7 @@ Csound code. If the `InstrDef` var is not yet available, we
117
117
can use the self-reference ` this_instr ` . The following
118
118
code demonstrates this,
119
119
120
- ```
120
+ ``` csound-orc
121
121
Ping:InstrDef = create({{
122
122
out(oscili(expon(p4,p3,0.001),p5))
123
123
schedule(this_instr,0.1,0.2,rnd(0.5),500+rnd(100))
@@ -131,18 +131,96 @@ number is assigned dynamically.
131
131
132
132
## Instrument Instance Type
133
133
134
+ Csound 7 introduces a new type for instrument instances, ` Instr ` .
134
135
Instrument instances can be assigned to variables and manipulated
135
- by opcodes.
136
+ by various opcodes. For example,
137
+
138
+ ``` csound-orc
139
+ instr Container
140
+ myInstr:InstrDef = create({{ out Osci(p4,k(p5)) }})
141
+ myInstance:Instr = create(myInstr)
142
+ err1:i = init(myInstance,0.5,440)
143
+ err2:k = perf(myInstance)
144
+ delete(myInstance)
145
+ delete(myInstr)
146
+ endin
147
+ ```
136
148
149
+ In addition to these, several other opcodes can be used to
150
+ manipulate instances in Csound code.
137
151
138
152
## Opcode Reference and Opcode Types
139
153
140
154
References to opcodes can be assigned to variables and instantiated
141
- as Opcode-type objects.
155
+ as Opcode-type objects, for example
156
+
157
+ ``` csound-orc
158
+ instr 1
159
+ obj:Opcode = create(oscili)
160
+ sig:a = run(obj, p4, p5)
161
+ out(sig)
162
+ endin
163
+ ```
164
+
165
+ Opcode objects may be invoked in loops, passed as parameters, have
166
+ their init and perf functions executed, etc.
142
167
143
168
## Complex Type
144
169
145
- Complex numbers are supported natively in the language now.
170
+ Complex numbers are supported natively in the language now. All
171
+ basic complex arithmetic operations and functions are supported
172
+ for both scalars and arrays. For example, the following code
173
+ implements single-sideband modulation using ` Complex ` arrays
174
+
175
+ ``` csound-orc
176
+ instr 1
177
+ sig:Complex[] = hilbert(oscili(p4,p5))
178
+ mod:Complex[] = oscili(0.5,100,-1,0.25), oscili(0.5,100)
179
+ ssb:Complex[] = mod * sig
180
+ out real(ssb)
181
+ endin
182
+ ```
183
+
184
+ ## UDP Server OSC message support
185
+
186
+ The UDP server now has builtin support for OSC messages. It also
187
+ includes message addresses for channels and events. To
188
+ access these messages a new overload of ` OSClisten ` is provided,
189
+ taking the message address and type only and returning the message
190
+ data,
191
+
192
+ ``` csound-orc
193
+ instr 1
194
+ freq:k = chnget("freq")
195
+ amp:k = chnget("amp")
196
+ out oscili(0dbfs*amp, p4*freq)
197
+ status:k, f:k, mess:S, n:k = OSClisten("/in", "fsi")
198
+ puts mess, status
199
+ printk2 n
200
+ printk2 f
201
+ status, nums:k[] = OSClisten("/ina", "fi")
202
+ printk2 nums[0]
203
+ printk2 nums[1]
204
+ endin
205
+ ```
206
+
207
+ which can be controlled by the following messages,
208
+
209
+ ```
210
+ instr 2
211
+ OSCsend 0, "localhost", 7000, "/csound/event/instr", "ffff", 1, 0, 1, 300
212
+ OSCsend 1, "localhost", 7000, "/csound/channel/freq/amp", "ff", p4, p5
213
+ OSCsend 2, "localhost", 7000, "/in", "fsi", p5, "hello", p4
214
+ OSCsend 3, "localhost", 7000, "/ina", "fi", p5, p4
215
+ OSCsend 4, "localhost", 7000, "/csound/event", "s", "i3 4 1"
216
+ OSCsend 5, "localhost", 7000, "/csound/compile", "s", "schedule 1,2,2,500"
217
+ endin
218
+ ```
219
+
220
+ ## MIDI File Input Opcodes
221
+
222
+ Support for multiple MIDI input files with port mapping has been
223
+ added. Opcodes for opening files and transport control are available.
146
224
147
225
## Limitations Removed
148
226
0 commit comments