Score Entry Shortcuts

Let’s face it: Writing out a musical score in the form of text, most of it consisting of long lines of numbers, is not fun and not a process that necessarily lends itself to an intuitive or inspirational way of working, at least not for more than a tiny segment of the populace. Fortunately, Csound provides some tools that can speed up score entry while also making your scores easier to read and more musically flexible.

Carry Symbols

The most useful shortcuts are probably the dot (.) and plus (+) symbols. These are both used in lists of note events that are all to be played by the same instrument. The dot tells Csound to use the same data you entered previously for that p-field. Here’s a simple example. First, we’ll write out all of the values by hand:


  ;     dur amp pitch
  i1 0  1   0.7  7.00
  i1 1  1   0.7  7.04
  i1 2  1   0.7  7.07
  i1 3  1   0.7  7.09
  i1 4  1   0.7  8.00

Next, we’ll replace the repeating values with dots:


  ;     dur  amp  pitch
  i1 0  1    0.7  7.00
  i1 1  .    .    7.04
  i1 2  .    .    7.07
  i1 3  .    .    7.09
  i1 4  .    .    8.00

The dots tell Csound to repeat the previously stated values of 1 for p3 and 0.7 for p4. The result will be the same as before. One advantage of using dots, besides saving on typing keystrokes, is that if you later need to change the value of a p-field such as the amplitude value in the example above, you only need to retype it once.

The plus symbol can be used only in p2. It tells Csound, in effect, to create a legato line by adding the value of the previous p3 to the previous p2. Here is the previous example again, using plus symbols. The sound will be exactly the same as before, because the duration value in p3 is the same (one beat) as the amount by which each note follows the previous note.


  ;     dur  amp   pitch
  i1 0  1    0.7   7.00
  i1 +  .    .     7.04
  i1 +  .    .     7.07
  i1 +  .    .     7.09
  i1 +  .    .     8.00

But what if we want a little separation between notes? In that case, a simple plus sign won’t work, because the duration value of the first note will be too short. Instead, we can use the notation ^+x in p2, like this:


  ;       dur  amp  pitch
  i1 0    0.3  0.7  7.00
  i1 ^+1  .    .    7.04
  i1 ^+1  .    .    7.07
  i1 ^+1  .    .    7.09
  i1 ^+1  .    .    8.00

The notation ^+1 tells the score preprocessor to take the value of the previous p2 and add 1 beat to it.

This type of shorthand is often useful when passages need to be block-copied. The code above could be copied and used in several passages, and only the p2 value of the first i-statement would need to be changed.


image

Note The + symbol itself can be carried using a dot symbol. However, the ^+x shorthand cannot be carried.


When the values to be carried from one i-statement to the next are at the end of the text line, the dot can be omitted. Csound will understand that it’s to carry the previously stated values for those p-fields. Let’s add a few more p-fields to the example above to see how that looks:


  ;      dur  amp  pitch  atk   rel   pan
  i1 0   1    0.7  7.00   0.01  0.05  0.6
  i1 +   .    .    7.04
  i1 +   .    .    7.07
  i1 +   .    .    7.09
  i1 +   .    .    8.00

In this example, we don’t need to put dots in the last three columns for the attack, release, and pan p-fields because our musical concept calls for all of the values to be the same. Csound will pretend that it sees dots, translate the dots into numbers, and all will be well.

Ramping and Randomness

The symbol < can be used in a score to create an ascending or descending ramp between values. This symbol can also be carried using the dot symbol. Ramps are handy for programming crescendi and diminuendi, for example, and for moving a series of notes across the stereo field by changing a p-field that controls pan position. Here is a score that plays an ascending and descending scale while smoothly changing amplitude from loud to soft and back to loud:



  ;     dur  amp   pitch
  i1 0  1    0.9   7.00
  i1 +  .    <     7.02
  i1 .  .    .     7.04
  i1 .  .    .     7.05
  i1 .  .    .     7.07
  i1 .  .    .     7.09
  i1 .  .    .     7.11
  i1 .  .    0.05  8.00
  i1 .  .    <     7.11
  i1 .  .    .     7.09
  i1 .  .    .     7.07
  i1 .  .    .     7.05
  i1 .  .    .     7.04
  i1 .  .    .     7.02
  i1 .  .    0.9   7.00

The tilde (~) symbol, used in a similar way, produces a random value between the two actual numbers given above and below it in the same p-field in the score. This is perhaps less useful than the ramp, because random values can easily be generated in the instrument itself.

Score Macros

A macro is an abbreviation. To use a macro in a score, you define the abbreviation and also the text that the abbreviation will be replaced with when the score is being processed. Macros are created using the #define symbol. The text that will be used to replace the macro as the score is processed is placed between # symbols. Here is a simple macro definition:


  #define PLUCK #i11#

To call a macro within the score, use the symbol you’ve defined, preceded by the dollar sign ($). Having defined the macro above, we could replace this score line:


  i11 0 2 0.8 7.00

with this one:


  $PLUCK 0 2 0.8 7.00

These two lines will produce exactly the same processed score, because Csound will replace the text $PLUCK with the text i11. This hardly seems like an improvement, since we’re doing more typing than before. But in a large score with dozens of instruments, it may be easier and less error-prone to define the names of the instruments than to remember their numbers.

As a side note, Csound also allows you to name your instruments in the orchestra and then refer to them in the score using double-quoted strings. The code above referred to instr 11. We could, instead, create this instrument using the line:


  instr PLUCK

and then refer to it in the score like this:


  “PLUCK” 0 2 0.8 7.00

In this case, no macro definition would be needed. Which system you prefer is a matter of taste. (For further details, see the page “Named Instruments” in the section of The Canonical Csound Reference Manual on “Syntax of the Orchestra.”)

This type of basic replacement macro can also be useful if you have instruments that repeatedly use the same values for several p-fields. In place of this score code, which has repeating values for p5, p6, and p7, but different values for p8:


  i1 0  1  8.00  0.6  2.5  0.7  3
  i1 +  .  8.02  0.6  2.5  0.7  1
  i1 +  .  8.04  0.6  2.5  0.7  1.4
  i1 +  .  8.06  0.6  2.5  0.7  3
  i1 +  .  8.07  0.6  2.5  0.7  0.9

we could use the following:


  #define PARAMS # 0.6 2.5 0.7 #
  i1 0  1  8.00  $PARAMS  3
  i1 +  .  8.02  $PARAMS  1
  i1 +  .  8.04  $PARAMS  1.4
  i1 +  .  8.06  $PARAMS  3
  i1 +  .  8.07  $PARAMS  0.9

If we later need to replace the values in p5, p6, and p7, we only need to do it once, by changing the macro definition, rather than dozens of times throughout the score.

A more useful macro is one that takes arguments. Up to five arguments can be used. The manual gives a simple example, which we may as well repeat here:


  #define ARG(A) # 2.345 1.03 $A 234.9#
  i1 0 1 8.00 1000 $ARG(2.0)
  i1 + 1 8.01 1200 $ARG(3.0)

The macro called ARG has one argument, which is called A. This is referenced in the macro definition using the dollar-sign symbol ($). When the macro is used, the value of the argument A is added in parentheses. The preceding code is expanded by the score processor into this:


  i1 0 1 8.00 1000 2.345 1.03 2.0 234.9
  i1 + 1 8.01 1200 2.345 1.03 3.0 234.9

As you can see, the value symbolized by $A in the macro definition has been replaced by 2.0 in the first line and by 3.0 in the second line.

Computing Values in p-fields

The macro feature really comes into its own when combined with another handy shortcut. In place of a constant numerical value, a p-field in a score can contain an equation surrounded by square brackets. The “Evaluation of Expressions” page in the manual gives details.

By itself, the ability to evaluate equations in a score isn’t much of a shortcut, though it can be useful if you’re writing music in just intonation. Pitches in just intonation are defined using ratios of integers, so you could define a series of pitches (assuming your instrument is set up to use the data) using p-fields in this manner:


  ;      dur  octave  ratio
  i21 0  1    3       [10/9]
  i21 +  .    .       [6/5]
  i21 +  .    .       [4/3]

Using a macro with an equation opens up new ways to handle the score while keeping it readable:


  #define BASEDUR #2#
  i21 0   [$BASEDUR + 0.3]
  i21 ^+3 [$BASEDUR + 0.7]
  i21 ^+3 [$BASEDUR]

Here, the p3 values of the three notes will evaluate to 2.3, 2.7, and 2.0. If we later decide that all of the notes in the passage need to be a little shorter, we can redefine BASEDUR to be 1.9 or 1.7, and all of the note durations will be adjusted accordingly.

This feature is well-nigh essential when the score contains looped phrases, as discussed in the section “Looping Score Sections,” later in this chapter.

Using a Spreadsheet

The idea of using a spreadsheet program, such as Microsoft Excel or OpenOffice Calc, to create a piece of music may seem at first glance to be no more than a joke. But with certain types of Csound scores, a spreadsheet can be a definite improvement over a text editor as a user interface.

You’re most likely to turn to a spreadsheet when your piece contains hundreds or even thousands of notes, and when each note event requires a large number of p-fields.

A spreadsheet offers at least two advantages in such cases. First, the p-fields are automatically aligned in vertical columns—no need to add or remove tab characters, as you would in a text editor, when you add extra digits to numbers or remove digits. This makes it easier to see what you’re doing and to avoid mistakes. Second, in a spreadsheet you can easily edit vertical columns. If you need to subtract .1 from the amplitude p-fields in a long phrase, for instance, in order to avoid clipping, you can do it quickly with a few mouse-clicks, rather than having to type lots of numbers.

Once you’ve created a score in a spreadsheet, it’s a trivial matter to select the cells containing your score, copy them, and paste them into your .csd or .sco file.

In a spreadsheet program, you can keep several versions of a score on separate sheets to keep backups and do quick comparisons. You can enter formulas into certain cells, and when you’re ready to transfer the data to Csound the spreadsheet will write the result of the formula rather than the formula itself into the copy-paste buffer. This eliminates the need to use some of Csound’s score language syntax.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.137.59