| 1 | |
| 2 | <section id = "ScorePreproc"> |
| 3 | <title>Preprocessing of Standard Scores</title> |
| 4 | |
| 5 | <para> |
| 6 | A <emphasis>Score</emphasis> (a collection of score statements) is divided into time-ordered |
| 7 | sections by the <link linkend="s"><citetitle>s statement</citetitle></link>. Before being |
| 8 | read by the orchestra, a score is preprocessed one section at a time. Each section is |
| 9 | normally processed by 3 routines: <link |
| 10 | linkend="ScoreCarry"><citetitle>Carry</citetitle></link>, <link |
| 11 | linkend="ScoreTempo"><citetitle>Tempo</citetitle></link>, and <link |
| 12 | linkend="ScoreSort"><citetitle>Sort</citetitle></link>. |
| 13 | </para> |
| 14 | |
| 15 | <section id="ScoreCarry"> |
| 16 | <title>Carry</title> |
| 17 | <para> |
| 18 | Within a group of consecutive <link linkend="i"><citetitle>i statements</citetitle></link> |
| 19 | whose p1 whole numbers correspond, any pfield left empty will take its value from the same |
| 20 | pfield of the preceding statement. An empty pfield can be denoted by a single point (.) |
| 21 | delimited by spaces. No point is required after the last nonempty pfield. The output of |
| 22 | Carry preprocessing will show the carried values explicitly. The Carry Feature is not |
| 23 | affected by intervening comments or blank lines; it is turned off only by a non- <link |
| 24 | linkend="i"><citetitle>i statement</citetitle></link> or by an <emphasis>i |
| 25 | statement</emphasis> with unlike p1 whole number. <indexterm |
| 26 | id="IndexScoreCarry"><primary>score</primary><secondary>carry</secondary></indexterm> |
| 27 | </para> |
| 28 | |
| 29 | <note> |
| 30 | <para> |
| 31 | It is possible to switch automatic carrying off. This can be done with the score |
| 32 | statement <emphasis>"C 0"</emphasis>, and can be restored with <emphasis>"C |
| 33 | 1"</emphasis>. Carrying is always active for pfields p1, p2 and p3. |
| 34 | </para> |
| 35 | </note> |
| 36 | |
| 37 | <para> |
| 38 | Three additional features are available for p2 alone: +, ^+<emphasis>x</emphasis>, and |
| 39 | ^-<emphasis>x</emphasis>. The symbol + in p2 will be given the value of p2 + p3 from the |
| 40 | preceding i statement. This enables note action times to be automatically determined from |
| 41 | the sum of preceding durations. The + symbol can itself be carried. It is legal only in |
| 42 | p2. E.g.: the statements |
| 43 | |
| 44 | <informalexample> |
| 45 | <programlisting> |
| 46 | <emphasis role="stamnt">i</emphasis>1 0 .5 100 |
| 47 | <emphasis role="stamnt">i</emphasis> . + |
| 48 | <emphasis role="stamnt">i</emphasis></programlisting> |
| 49 | </informalexample> |
| 50 | |
| 51 | will result in |
| 52 | |
| 53 | <informalexample> |
| 54 | <programlisting> |
| 55 | <emphasis role="stamnt">i</emphasis>1 0 .5 100 |
| 56 | <emphasis role="stamnt">i</emphasis>1 .5 .5 100 |
| 57 | <emphasis role="stamnt">i</emphasis>1 1 .5 100</programlisting> |
| 58 | </informalexample> |
| 59 | </para> |
| 60 | |
| 61 | <para> |
| 62 | The symbols ^+<emphasis>x</emphasis> and ^-<emphasis>x</emphasis> determine the current |
| 63 | p2 by adding or subtracting, respectively, the value of <emphasis>x</emphasis> from the |
| 64 | preceding p2. These may be used in p2 only and are <emphasis>not</emphasis> carried like |
| 65 | the + symbol. Note also that there should be no spaces following the ^, the +, or the - |
| 66 | parts of these symbols -- the number must come directly after as in ^+2.3. If the example |
| 67 | above had been |
| 68 | |
| 69 | <informalexample> |
| 70 | <programlisting> |
| 71 | <emphasis role="stamnt">i</emphasis>1 0 .5 100 |
| 72 | <emphasis role="stamnt">i</emphasis> . ^+1 |
| 73 | <emphasis role="stamnt">i</emphasis> . ^+1</programlisting> |
| 74 | </informalexample> |
| 75 | |
| 76 | the result would instead be |
| 77 | |
| 78 | <informalexample> |
| 79 | <programlisting> |
| 80 | <emphasis role="stamnt">i</emphasis>1 0 .5 100 |
| 81 | <emphasis role="stamnt">i</emphasis>1 1 .5 100 |
| 82 | <emphasis role="stamnt">i</emphasis>1 2 .5 100</programlisting> |
| 83 | </informalexample> |
| 84 | </para> |
| 85 | |
| 86 | <para> |
| 87 | The Carry feature should be used liberally. Its use, especially in large scores, can |
| 88 | greatly reduce input typing and will simplify later changes. |
| 89 | </para> |
| 90 | |
| 91 | <para> |
| 92 | There can sometimes be circumstances where you do not want "missing" pfields after the |
| 93 | last one entered to be implicitly carried. An example would be an instrument that is |
| 94 | designed to take a variable number of pfields. Beginning with Csound 5.08, you can |
| 95 | prevent the implicit carrying of pfields at the end of an i statement by using the symbol |
| 96 | <emphasis>!</emphasis> (called the "no-carry symbol"). The <emphasis>!</emphasis> must |
| 97 | appear at the end of an i statement and it cannot be used in p1, p2, or p3, since these |
| 98 | pfields are required. Here is an example: |
| 99 | |
| 100 | <informalexample> |
| 101 | <programlisting> |
| 102 | <emphasis role="stamnt">i</emphasis>1 0 .5 100 |
| 103 | <emphasis role="stamnt">i</emphasis> . + |
| 104 | <emphasis role="stamnt">i</emphasis> . . . ! |
| 105 | <emphasis role="stamnt">i</emphasis></programlisting> |
| 106 | </informalexample> |
| 107 | |
| 108 | This score would be interpreted as |
| 109 | |
| 110 | <informalexample> |
| 111 | <programlisting> |
| 112 | <emphasis role="stamnt">i</emphasis>1 0 .5 100 |
| 113 | <emphasis role="stamnt">i</emphasis>1 .5 .5 100 |
| 114 | <emphasis role="stamnt">i</emphasis>1 1 .5 ; no p4 |
| 115 | <emphasis role="stamnt">i</emphasis>1 1.5 .5 ; only p1 to p3 are carried here</programlisting> |
| 116 | </informalexample> |
| 117 | </para> |
| 118 | |
| 119 | <para> |
| 120 | An alternative to using ! is to switch automatic carrying off |
| 121 | apart from p1, p2 and p3. This can be done with the score |
| 122 | opcode statement "C 0", and can be restored with "C 1". |
| 123 | </para> |
| 124 | </section> |
| 125 | |
| 126 | <section id="ScoreTempo"> |
| 127 | <title>Tempo</title> |
| 128 | <para> |
| 129 | This operation time warps a score section according to the information in a <link |
| 130 | linkend="t"><citetitle>t statement</citetitle></link>. The tempo operation converts p2 |
| 131 | (and, for <link linkend="i"><citetitle>i statements</citetitle></link>, p3) from original |
| 132 | beats into real seconds, since those are the units required by the orchestra. After time |
| 133 | warping, score files will be seen to have orchestra-readable format demonstrated by the |
| 134 | following: <programlisting><emphasis role="stamnt">i</emphasis> p1 p2beats p2seconds |
| 135 | p3beats p3seconds p4 p5 ....</programlisting> <indexterm |
| 136 | id="IndexScoreTempo"><primary>score</primary><secondary>tempo</secondary></indexterm> |
| 137 | </para> |
| 138 | </section> |
| 139 | |
| 140 | <section id="ScoreSort"> |
| 141 | <title>Sort</title> |
| 142 | <para> |
| 143 | This routine sorts all action-time statements into chronological order by p2 value. It |
| 144 | also sorts coincident events into precedence order. Whenever an <link |
| 145 | linkend="f"><citetitle>f statement</citetitle></link> and an <link |
| 146 | linkend="i"><citetitle>i statement</citetitle></link> have the same p2 value, the |
| 147 | <emphasis>f statement</emphasis> will precede. Whenever two or more <emphasis>i |
| 148 | statements</emphasis> have the same p2 value, they will be sorted into ascending p1 value |
| 149 | order. If they also have the same p1 value, they will be sorted into ascending p3 value |
| 150 | order. Score sorting is done section by section (see <link linkend="s"><citetitle>s |
| 151 | statement</citetitle></link>). Automatic sorting implies that score statements may appear |
| 152 | in any order within a section. <indexterm |
| 153 | id="IndexScoreSort"><primary>score</primary><secondary>sort</secondary></indexterm> |
| 154 | </para> |
| 155 | <note> |
| 156 | <para> |
| 157 | The operations Carry, Tempo and Sort are combined in a 3-phase single pass over a score |
| 158 | file, to produce a new file in orchestra-readable format (see the Tempo example). |
| 159 | Processing can be invoked either explicitly by the <emphasis>Scsort</emphasis> command, |
| 160 | or implicitly by Csound which processes the score before calling the orchestra. |
| 161 | Source-format files and orchestra-readable files are both in ASCII character form, and |
| 162 | may be either perused or further modified by standard text editors. User-written |
| 163 | routines can be used to modify score files before or after the above processes, provided |
| 164 | the final orchestra-readable statement format is not violated. Sections of different |
| 165 | formats can be sequentially batched; and sections of like format can be merged for |
| 166 | automatic sorting. |
| 167 | </para> |
| 168 | </note> |
| 169 | </section> |
| 170 | </section> |