Input filters can occur anywhere within a p-field and can be canceled by specifying "re" (the default input -- real numbers). Below is a list of the available input methods. These can be initiated at any point within a p-field and are active for the remainder of the p-field or until a new input filter occurs.
For specific information on how "pitches" are stored internally see the note below (this affects the NO/NOX, and OP/OPX input/output filters and the OD and HZ output filters).
N.B. The algorithm used is identical to that in the Csound Canonical source code.
This new input mode forces any stored data (including those made by DDFs) to round to the nearest integer (although these are still stored internally as floats rounded to the nearest integer).
In the above example, p5 and p7 are used as scratch p-fields in order to control pitch-classes and octave numbers independently (they are processed before p5 and are not output to the printed note-list but can be drawn from in subsequent p-fields with the "ex" DDF). The "random window" data in p7 would be floating-point data between 1 and 7; the "in" input mode forces the generated values to be rounded to the nearest whole- number (e.g., 1.15 becomes 1.00) when stored in the note-list.p6(xx) se(T 1. *[0 1 2 3 4 5 6 7 8 9 10 11]) ;PCs p7(xx) in rw(T 1. [1 7] .25 4) ;Octave #s p5(op) ex(T 1. i[p25*12+p24]) ;Pitches (PCs+OCs)
Note Names: c,d,e,f,g,a,b or C,D,E,F,G,A,BOctave-Number: c4 = middle C (stored internally as 60)
If octave numbers are omitted the program defaults to the previously used octave value (if none is specified "4" is the default).Accidentals:
Accidentals are parsed recursively (you may have any number chained) and may consist of any combination of the following:
- s = sharp, ss = double sharp (this is recursive and you may have as many Ss as you like!)
- f = flat, ff = double flat (this is recursive and you may have as many Fs as you like!)
- n = natural (trivial)
- + = 1/4-tone sharp
- - = 1/4-tone flat
Miscellaneous:
Using the ":" command will cause a new event to be created in which the current p-field value will be different (i.e., a new note) but all other p-fields will be copies of the original. Thus:
- r = rest (rests are omitted from the printed note list)
- : = fuses two notes together (for chords).
c4:e:gcreates an original event with c4, then makes two new copies with the same start time (and identical previous and subsequent p-fields).
p5 nox c+4, f-5, gff+
The above example consists of a dotted-quarter followed by three eighths, a dotted-half tied to an eighth, then a single eighth.p2 rh 4. 8x3 2.,8 8
Why differentiate between NO/NOX and OP/OPX? The answer pertains mainly to the DDFs (Dynamic Data Functions -- specifically MO, RA, and RW): Suppose that you enter the following:
You'll note the following output:p5(od) no mo(T*.33 1. c4 c6) nox mo(T*.33 1. c4 c6) no mo(T*.34 1. c4 c6)
(N.B. P5 would normally be converted to OP, HZ, or OD for Csound)i1 0.000 0.250 5000 48.000 i1 0.250 0.250 5000 51.000 i1 0.500 0.250 5000 55.000 i1 0.750 0.250 5000 58.000 i1 1.000 0.250 5000 62.000 i1 1.250 0.250 5000 65.000 i1 1.500 0.250 5000 69.000 i1 1.750 0.250 5000 72.000 i1 2.000 0.250 5000 48.000 ;NOX COMMAND PRODUCES i1 2.250 0.250 5000 51.429 ;fractional values! i1 2.500 0.250 5000 54.857 ; i1 2.750 0.250 5000 58.286 ; i1 3.000 0.250 5000 61.714 ; i1 3.250 0.250 5000 65.143 ; i1 3.500 0.250 5000 68.571 ; i1 3.750 0.250 5000 72.000 ; i1 4.000 0.250 5000 48.000 i1 4.250 0.250 5000 51.000 i1 4.500 0.250 5000 55.000 i1 4.750 0.250 5000 58.000 i1 5.000 0.250 5000 62.000 i1 5.250 0.250 5000 65.000 i1 5.500 0.250 5000 69.000 i1 5.750 0.250 5000 72.000
In this example, there are three MO
commands. The first and last use NO, which rounds to the nearest
equal tempered pitch code, while the middle uses the NX command and
generates fractional values. If you will be using the
DDFs to create a stream of values, I would
suggest always using the NO or OP command for pitch input when you want
equal tempered tuning. The NOX, and OPX commands will not round.