[Name] [Synopsis] [Description] [Options] [Files] [License] [Author]

Scheme Score

Name

scmscore - transform Csound score files using Scheme

Synopsis

scmscore [option] [ input-file [ output-file ]]

Description

Csound is a versatile sound synthesis system written in C. Its inputs are usually an orchestra file and a score file. The score file specifies a list of notes to be played by instruments in the orchestra.

Scheme Score is a Csound score preprocessor. Scheme Score translates a score file augmented with Scheme code into a Scheme program. When the generated program is executed by a Scheme interpreter, it produces a processed score file for input to Csound.

Score transformations in Scheme Score are defined using Scheme, a statically scoped and properly tail-recursive dialect of the Lisp programming language. The best way to learn about the use of Scheme Score is by reading the example source file example.ssc and applying the preprocessor to it.

Score Processing

A Scheme Score source file contains both Scheme lists and Csound standard numeric score statements. A line of text that starts with a parenthesis is interpreted as a Scheme list and the list is copied to the output unchanged. A line of text that starts with a letter is interpreted as standard numeric score statement. Let L be the letter, and P1, P2, ..., Pn be the statement's parameters. The statement

L P1 P2 ... Pn

is translated into the following Scheme expression.

(apply L `(P1 P2 ... Pn))

For example, the i-statement

i 1 2 3 4 ,(+ 2 3) 6 "file.ext" 8

is translated as follows.

(apply i `((1 2 3 4 ,(+ 2 3) 6 "file.ext" 8))

The standard Scheme Score prolog includes the equivalent of the following definition.

(define (i . args)
  (display 'i)
  (do ((args args (cdr args)))
      ((null? args))
    (display " ")
    (write (car args)))
  (newline))

As a result, when the generated Scheme program is executed by an interpreter, the following i-statement is produced.

i 1 2 3 4 5 6 "file.ext" 8

Adding Statement Types

A Scheme Score file can define its own Csound statement types. The following Scheme definition and x-statement

(define (x a b c d)
  (do ((b b (1+ b)))
      ((>= b c))
    (i a b d 84.0)))
x99 3 7 <

generate this output.

i 99 3 < 84.0
i 99 4 < 84.0
i 99 5 < 84.0
i 99 6 < 84.0

Options

-x, --exclude
exclude standard Scheme Score prolog
-v, --version
print Scheme Score version information
-h, --help
print help message

Files

example.ssc
a Scheme Score source file that displays various features of the preprocessor
Makefile
a Unix makefile that shows how to convert a Scheme Score source file into a Csound score file
scmscore.c
the source file for the Scheme Score program
scmscore.scm
the Scheme Score program written in Scheme

License

This is the MIT License from OpenSource.Org.

Copyright 2001 John D. Ramsdell.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Author

John D. Ramsdell

Last modified: 2003 October 31

[Top]