File: scofile.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 (103 lines) | stat: -rw-r--r-- 6,056 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
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (X11; I; IRIX 6.3 IP32) [Netscape]">
   <TITLE>THE_SCORE_FILE</TITLE>
</HEAD>
<BODY>

<CENTER><A NAME="The_Score_File"></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="orcfile.html">Previous</A>
- <A HREF="../CONTENTS.html">Contents</A> - <A HREF="../INDEX.html">Index</A>
- <A HREF="commtut.html">Next</A>&nbsp;
<HR></CENTER>

<H4>
A Beginning Tutorial</H4>

<H2>
The Score File</H2>
The purpose of the score is to tell the instruments when to play and with
what parameter values. The score has a different syntax from that of the
orchestra, but similarly permits one statement per line and comments after
a semicolon. The first character of a score statement is an <B>opcode</B>,
determining an action request; the remaining data consists of numeric parameter
fields (pfields) to be used by that action.

<P>Suppose we want a sine-tone generator to play a pentatonic scale starting
at C-sharp above middle-C, with notes of 1/2 second duration. We would
create the following score:
<PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp; ;&nbsp; a sine wave function table
&nbsp;&nbsp;&nbsp;&nbsp; f1 0 256 10 1
&nbsp;&nbsp;&nbsp;&nbsp; ;&nbsp; a pentatonic scale
&nbsp;&nbsp;&nbsp;&nbsp; i1&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp; .5&nbsp;&nbsp; 0.&nbsp;&nbsp; 8.01
&nbsp;&nbsp;&nbsp;&nbsp; i1&nbsp; .5&nbsp;&nbsp;&nbsp; .&nbsp;&nbsp;&nbsp; .&nbsp;&nbsp;&nbsp; 8.03
&nbsp;&nbsp;&nbsp;&nbsp; i1 1.0&nbsp;&nbsp;&nbsp; .&nbsp;&nbsp;&nbsp; .&nbsp;&nbsp;&nbsp; 8.06
&nbsp;&nbsp;&nbsp;&nbsp; i1 1.5&nbsp;&nbsp;&nbsp; .&nbsp;&nbsp;&nbsp; .&nbsp;&nbsp;&nbsp; 8.08
&nbsp;&nbsp;&nbsp;&nbsp; i1 2.0&nbsp;&nbsp;&nbsp; .&nbsp;&nbsp;&nbsp; .&nbsp;&nbsp;&nbsp; 8.10
&nbsp;&nbsp;&nbsp;&nbsp; e</TT></PRE>
The first statement creates a stored sine table. The protocol for generating
wave tables is simple but powerful. Lines with opcode f interpret their
parameter fields as follows:
<PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp; p1 - function table <I>number</I> being created
&nbsp;&nbsp;&nbsp;&nbsp; p2 - <I>creation time</I>, or time at which the table becomes readable
&nbsp;&nbsp;&nbsp;&nbsp; p3 - table <I>size</I> (number of points), which must be a power of two or one greater
&nbsp;&nbsp;&nbsp;&nbsp; p4 - <I>generating subroutine</I>, chosen from a prescribed list.</TT></PRE>
Here the value 10 in p4 indicates a request for subroutine <B><A HREF="../Function/gen09.html">GEN10</A>
</B>to fill the table. <B>GEN10</B> mixes harmonic sinusoids in phase,
with relative strengths of consecutive partials given by the succeeding
parameter fields. Our score requests just a single sinusoid. An alternative
statement:
<PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp; f1 0 256 10 1 0 3</TT></PRE>
would produce one cycle of a waveform with a third harmonic three times
as strong as the first.

<P>The <A HREF="../NumScore/i-stat.html">i statements</A>, or note statements,
will invoke the p1 instrument at time p2, then turn it off after p3 seconds;
it will pass all of its p-fields to that instrument. Individual score parameters
are separated by any number of spaces or tabs; neat formatting of parameters
in columns is nice but unnecessary. The dots in p-fields 3 and 4 of the
last four notes invoke a <I>carry feature</I>, in which values are simply
copied from the immediately preceding note <I>of the same instrument</I>.
A score normally ends with an <A HREF="../NumScore/e-stat.html">e statement</A>.

<P>The unit of time in a <B>Csound</B> score is the beat. In the absence
of a <I><A HREF="../NumScore/t-stat.html">Tempo statement</A></I>, one
beat takes one second. To double the speed of the pentatonic scale in the
above score, we could either modify p2 and p3 for all the notes in the
score, or simply insert the line
<PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp; t 0 120</TT></PRE>
to specify a tempo of 120 beats per minute from beat 0.

<P>Two more points should be noted. First, neither the <I><A HREF="../NumScore/f-stat.html">f-statements</A></I>
nor the <I><A HREF="../NumScore/i-stat.html">i-statements</A></I> need
be typed in time order; <B>Csound</B> will sort the score automatically
before use. Second, it is permissible to play more than one note at a time
with a single instrument. To play the same notes as a three-second pentatonic
chord we would create the following:
<PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp; ;&nbsp;&nbsp;&nbsp; a sine wave function
&nbsp;&nbsp;&nbsp;&nbsp; f1&nbsp;&nbsp; 0&nbsp; 256&nbsp;&nbsp; 10&nbsp;&nbsp;&nbsp; 1
&nbsp;&nbsp;&nbsp;&nbsp; ;&nbsp;&nbsp;&nbsp; five notes at once
&nbsp;&nbsp;&nbsp;&nbsp; i1&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp; 8.01
&nbsp;&nbsp;&nbsp;&nbsp; i1&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp; .&nbsp;&nbsp;&nbsp; .&nbsp;&nbsp;&nbsp; 8.03
&nbsp;&nbsp;&nbsp;&nbsp; i1&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp; .&nbsp;&nbsp;&nbsp; .&nbsp;&nbsp;&nbsp; 8.06
&nbsp;&nbsp;&nbsp;&nbsp; i1&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp; .&nbsp;&nbsp;&nbsp; .&nbsp;&nbsp;&nbsp; 8.08
&nbsp;&nbsp;&nbsp;&nbsp; i1&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp; .&nbsp;&nbsp;&nbsp; .&nbsp;&nbsp;&nbsp; 8.10
&nbsp;&nbsp;&nbsp;&nbsp; e</TT></PRE>
Now go into the editor once more and create your own score file. Name it
"intro.sco". Tne <A HREF="commtut.html">next section</A> will describe
how to invoke a <B>Csound</B> orchestra to perform a <B>Csound</B> score.
<BR>&nbsp;
<CENTER>
<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="orcfile.html">Previous</A>
- <A HREF="../CONTENTS.html">Contents</A> - <A HREF="../INDEX.html">Index</A>
- <A HREF="commtut.html">Next</A>&nbsp;
<HR></CENTER>

<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></CENTER>

</BODY>
</HTML>