You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/intro/whats-new-in-csound-7.md
+85-4Lines changed: 85 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
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
@@ -18,6 +18,9 @@ endin
18
18
schedule(1,0,2)
19
19
```
20
20
21
+
In addition, a number of new variable types have been introduced.
22
+
23
+
21
24
## New UDO Syntax and Pass-by-reference
22
25
23
26
User Defined Opcodes now follow the syntax `opcode name(inargs):(outargs)`.
@@ -38,9 +41,24 @@ endin
38
41
schedule(1, 0, 0)
39
42
```
40
43
41
-
<spanstyle="color:red">Give example for pass-by-reference ...</span>
44
+
When the new opcode syntax is used, the default call semantics is by
45
+
reference, instead of copy. The exceptions are when local sampling
46
+
rate or local ksmps are used, when pass-by-copy is used. In
47
+
pass-by-reference semantics all arguments data are shared between the
48
+
caller and the UDO.
49
+
50
+
The classic opcode syntax always implies pass-by-copy.
51
+
52
+
## Local Sampling Rate for UDOs
42
53
43
-
## Removed Limitations for Functional Style
54
+
UDOs can now be set to a local sampling rate, which may be higher
55
+
or lower than the calling environment. The opcodes `oversample` and
56
+
`undersample` are used to set the local sampling rate. The limitations
57
+
are that the sampling rate always needs to be an integer multiple or
58
+
divisor of the caller sampling rate and local ksmps are not allowed
59
+
together with local sampling rates.
60
+
61
+
## Functional Style Enhancements
44
62
45
63
Multiple output arguments can now be used in functional style, e.g.
46
64
@@ -54,12 +72,21 @@ endin
54
72
schedule(1, 0, 1)
55
73
```
56
74
57
-
## For-Loop
75
+
Additionally, the new parser makes functional expressions behave
76
+
exactly as the classic syntax, with no penalties.
58
77
78
+
<!--
79
+
For-Loop
59
80
<span style="color:red">Is it going to happen??</span>
81
+
-->
60
82
61
83
## User-Defined Types
62
84
85
+
The type system in Csound 7 is very sophisticated and it allows new
86
+
types to be added using Csound code (similarly to user-defined
87
+
opcodes). Once created, these types are available to define new
88
+
variables, arguments etc.
89
+
63
90
```csound-orc
64
91
struct MyType val0:i, val1:i
65
92
@@ -70,3 +97,57 @@ print(testVal.val1)
70
97
endin
71
98
schedule(1, 0, 0)
72
99
```
100
+
101
+
## Instrument Definition Type
102
+
103
+
Csound 7 introduces a new type `InstrDef` to hold instrument
104
+
definitions. The _name_ of an instrument becomes a global constant of
105
+
that type, which may be referred directly in the code,
106
+
107
+
```
108
+
instr Ping
109
+
out(oscili(expon(p4,p3,0.001), p5))
110
+
schedule(Ping,0.1,0.2,rnd(0.5),500+rnd(100))
111
+
endin
112
+
schedule(Ping,0,0.2,0.5,500)
113
+
```
114
+
115
+
Furthermore, instrument definitions can be created directly from
116
+
Csound code. If the `InstrDef` var is not yet available, we
117
+
can use the self-reference `this_instr`. The following
0 commit comments