File: carry.html

package info (click to toggle)
csound-doc 3.47b2-2
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 1,492 kB
  • ctags: 272
  • sloc: makefile: 36
file content (218 lines) | stat: -rw-r--r-- 9,688 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<HTML>
<TITLE>CARRY</TITLE>
<CENTER><P><A NAME="Carry"></A>
<HR><B><A HREF="../REFER.html">QUICK-REF</A></B> - <B><A HREF="../TITLE.html"><FONT SIZE=+1>C</FONT>soundManual</A></B>
- <B><A HREF="./TUTORIALS.html">Top of this section</A></B> - <A HREF="./filt.html">Previous</A>
- <A HREF="../CONTENTS.html">Contents</A> - <A HREF="../INDEX.html">Index</A>
- <A HREF="./tabslabs.html">Next</A> 
<HR></P></CENTER>

<H2>Toot 11: Carry, Tempo &amp; Sort</H2>

<P>We now use a plucked string instrument to explore some of Csound's score
preprocessing capabilities. Since the focus here is on the score, the instrument
is presented without explanation.</P>

<PRE><TT>instr 11
  asig1     pluck     ampdb(p4)/2, p5, p5, 0, 1           
  asig2     pluck     ampdb(p4)/2, p5 * 1.003,  p5 * 1.003, 0, 1
            out       asig1+asig2
endin     </TT>
</PRE>

<P>The score can be divided into time-ordered sections by the <B><A HREF="./../NumScore/s-stat.html">S
statement</A>.</B> Prior to performance, each section is processed by three
routines: <A HREF="./../NumScore/proc.html">Carry,</A>
<A HREF="./../NumScore/proc.html">Tempo</A>,
and <A HREF="./../NumScore/proc.html">Sort</A>.
The score <I>toot11.sco</I> has multiple sections containing each of the
examples below, in both of the forms listed.</P>

<P>The <B><A HREF="./../NumScore/proc.html">Carry</A></B>
feature allows a dot (&quot;.&quot; ) in a p-field to indicate that the
value is the same as above, provided the instrument is the same. Thus the
following two examples are identical: </P>

<PRE><TT>;ins start dur  amp  freq   |    ; ins start dur   amp  freq
 i11    0    1   90   200   |      i11    0    1    90   200
 i11    1    .    .   300   |      i11    1    1    90   300
 i11    2    .    .   400   |      i11    2    1    90   400</TT>
</PRE>

<P>A special form of the carry feature applies to p2 only. A &quot;+&quot;
in p2 will be given the value of p2+p3 from the previous <B>i</B> statement.
The &quot;+&quot; can also be carried with a dot: </P>

<PRE><TT>;ins start dur  amp  freq   |   ;  ins start  dur  amp  freq
 i11    0    1   90   200   |      i11    0    1    90   200
 i.     +    .    .   300   |      i11    1    1    90   300
 i.     .    .    .   500   |      i11    2    1    90   500</TT>
</PRE>

<P>The carrying dot may be omitted when there are no more explicit pfields
on that line: </P>

<PRE><TT>;ins start dur  amp  freq   |   ;  ins start  dur  amp  freq 
 i11    0    1   90   200   |      i11    0    1    90   200
 i11    +    2              |      i11    1    2    90   200
 i11                        |      i11    3    2    90   200</TT>
</PRE>

<P>A variant of the carry feature is <B><A HREF="./../NumScore/ramp.html">Ramping</A></B>,
which substitutes a sequence of linearly interpolated values for a ramp
symbol ( &lt; ) spanning any two values of a pfield. Ramps work only on
consecutive calls to the same instrument, and they cannot be applied to
the first three p-fields. </P>

<PRE><TT>;ins start dur  amp  freq   |    ; ins start  dur  amp  freq
 i11    0    1   90   200   |      i11     0    1   90   200
 i .    +    .   &lt;    &lt;     |      i11     1    1   85   300
 i .    .    .   &lt;    400   |      i11     2    1   80   400
 i .    .    .   &lt;    &lt;     |      i11     3    1   75   300
 i .    .    4   70   200   |      i11     4    4   70   200</TT>

</PRE>

<P><B><A HREF="./../NumScore/t-stat.html">Tempo</A></B>. The unit of
time in a Csound score is the beat - normally one beat per second. This
can be modified by a<A HREF="./../NumScore/t-stat.html"> Tempo Statement,</A>
which enables the score to be arbitrarily time-warped. Beats are converted
to their equivalent in seconds during score pre-processing of each Section.
In the absence of a Tempo statement in any Section, the following tempo
statement is inserted:</P>

<PRE><TT>     t   0   60 </TT>
</PRE>

<P>It means that at beat 0 the tempo of the Csound beat is 60 (1 beat per
second). To hear the Section at twice the speed, we have two options: 1)
cut all p2 and p3 in half and adjust the start times, or 2) insert the
statement <B>t 0 120</B> within the Section. </P>

<P>The Tempo statement can also be used to move between different tempi
during the score, thus enabling ritardandi and accelerandi. Changes are
linear by beat size. The following statement will cause the score to begin
at tempo 120, slow to tempo 80 by beat 4, then accelerate to 220 by beat
7:</P>

<PRE><TT>     t    0   120   4   80    7   220</TT>
</PRE>

<P>The following will produce identical soundfiles:</P>

<PRE><TT>                                         t  0  120       ; Double-time via Tempo
;ins  start  dur  amp  freq       |         ; ins start  dur  amp  freq
 i11     0    .5   90   200       |           i11     0    1   90   200
 i .     +    .    &lt;    &lt;         |           i .     +    .   &lt;    &lt;
 i .     .    .    &lt;    400       |           i .     .    .   &lt;    400
 i .     .    .    &lt;    &lt;         |           i .     .    .   &lt;    &lt;
 i .     .    2    70   200       |           i .     .    4   70   200 </TT>
</PRE>

<P>The following includes an accelerando and ritard. It should be noted,
however, that the ramping feature is applied <I>after</I> time-warping,
and is thus proportional to elapsed chronological time. While this is perfect
for amplitude ramps, frequency ramps will not result in harmonically related
pitches during tempo changes. The frequencies needed here are thus made
explicit.</P>

<PRE><TT>      t     0   60   4    400  8    60   ; Time-warping via Tempo
     ;    ins start dur  amp  freq
          i11  0    1    70   200
          i .  +    .    &lt;    500
          i .  .    .    90   800
          i .  .    .    &lt;    500
          i .  .    .    70   200
          i .  .    .    90   1000
          i .  .    .    &lt;    600
          i .  .    .    70   200
          i .  .    8    90   100</TT>
</PRE>

<P>Three additional score features are extremely useful in Csound. The
<B><A HREF="./../NumScore/s-stat.html">s statement</A></B> was used
above to divide a score into Sections for individual pre-processing. Since
each s statement establishes a new relative time of 0, and all actions
within a section are relative to that, it is convenient to develop the
score one section at a time, then link the sections into a whole later.
</P>

<P>Suppose we wish to combine the six above examples (call them <I>toot11a</I>
- <I>toot11f</I>) into one score. One way is to start with <I>toot11a.sco</I>,
calculate its total duration and add that value to every starting time
of <I>toot11b.sco</I>, then add the composite duration to the start times
of <I>toot11c.sco</I>, etc. Alternatively, we could insert an s statement
between each of the sections and run the entire score. The file <I>toot11.sco</I>,
which contains a sequence of all of the above score examples, did just
that. </P>

<P>The <B>f0 statement</B>, which creates an &quot;action time&quot; with
no associated action, is useful in extending the duration of a section.
Two seconds of silence are added to the first two sections below. </P>

<PRE><TT>;    ins start dur  amp  freq           ; toot11g.sco
     i11  0    2    90   100
     f 0  4                             ; The f0 Statement
     s                                  ; The Section Statement
     i11  0    1    90   800 
     i .  +    .    .    400
     i .  .    .    .    100
     f 0  5
     s
     i11  0         4    90   50
     e</TT>
</PRE>

<P><B><A HREF="./../NumScore/s-stat.html">Sort</A></B>. During preprocessing
of a score section, all action-time statements are sorted into chronological
order by p2 value. This means that notes can be entered in any order, that
you can merge files, or work on instruments as temporarily separate sections,
then have them sorted automatically when you run Csound on the file. </P>

<P>The file below contains excerpts from this section of the rehearsal
chapter and from instr6 of the tutorial, and combines them as follows:
</P>

<PRE><TT>;   ins start dur  amp  freq           ; toot11h.sco
    i11  0    1    70   100            ; Score Sorting
    i .  +    .    &lt;    &lt;
    i .  .    .    &lt;    &lt;
    i .  .    .    90   800
    i .  .    .    &lt;    &lt;
    i .  .    .    &lt;    &lt;
    i .  .    .    70   100
    i .  .    .    90   1000
    i .  .    .    &lt;    &lt;
    i .  .    .    &lt;    &lt;
    i .  .    .    &lt;    &lt;
    i .  .    .    70   &lt;
    i .  .    8    90   50
 
   f1 0 2048 10 1                            ; Sine
   f2 0 2048 10 1 .5 .3 .25 .2 .167 .14 .125 .111      ; Sawtooth
   f3 0 2048 10 1 0  .3  0   .2  0 .14  0   .111       ; Square
   f4 0 2048 10 1 1 1 1 .7 .5 .3 .1                    ; Pulse

; ins  strt  dur   amp   frq  atk rel vibr vibdpth vibdel    waveform
   i6     0    2    86   9.00 .03  .1   6    5        .4      1
   i6     2    2    86   9.02 .03  .1   6    5        .4      2
   i6     4    2    86   9.04 .03  .1   6    5        .4      3
   i6     6    4    86   9.05 .05  .1   6    5        .4      4</TT>


</PRE>

<CENTER><P>
<HR><B><A HREF="../REFER.html">QUICK-REF</A></B> - <B><A HREF="../TITLE.html"><FONT SIZE=+1>C</FONT>soundManual</A></B>
- <B><A HREF="./TUTORIALS.html">Top of this section</A></B> - <A HREF="./filt.html">Previous</A>
- <A HREF="../CONTENTS.html">Contents</A> - <A HREF="../INDEX.html">Index</A>
- <A HREF="./tabslabs.html">Next</A> 
<HR></P></CENTER>


<P><CENTER>
<B><I><FONT COLOR="#006600">HTML Csound Manual - <FONT SIZE=-1>&copy;
Jean Pich&eacute; &amp; Peter J. Nix, 1994-97</FONT></FONT></I></B>&nbsp;
</CENTER>
</HTML>