PerformanceAPI: Low-level Csound API functions

Description Usage Arguments Details Value Note

Description

Many functions that provide a low-level interface to Csound functionality, often called for their side effects on a running instance of Csound.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
  csoundCreate()

  csoundCompile(csInstance, args)

  csoundCleanup(csInstance)

  csoundDestroy(csInstance)

  csoundPerform(csInstance)

  csoundPerformKsmps(csInstance)

  csoundPreCompile(csInstance)

  csoundScoreEvent(csInstance, type = c("a", "i", "q", "f",
  "e"), pfields)

Arguments

csInstance

an instance of Csound created by csoundCreate

args

A character vector of command-line arguments to pass to csound. See The Csound Manual's page on the Csound command-line options.

type

The type of score event; only a, i, q, f, and e are supported in the API:

‘a’: Advance score time by a specified amount. ‘i’: Makes an instrument active at a specific time and for a certain duration ‘q’: Used to quiet an instrument ‘f’: Causes a GEN subroutine to place values in a stored function table ‘e’: Marks the end of the last section of the score. (In practice I've had trouble making ‘e’ statements work as I've expected they would.)

pfields

The pfields (Parameter Fields) for the given score event. See the Csound manual links for parameter type for more information on the parameters that each of these objects take

Details

Order is important (see note!). These should be called in roughly the following order.

1. csoundCreate() is where it all starts, returning a pointer to a running instance of Csound that the others can then manipulate.

2. csoundPreCompile() performs a few steps to prepare Csound for compiling the instruments

3. csoundCompile() compiles the orchestra (and the score if provided) and processes any command-line arguments.

4. Performance (csoundPerformKsmps()) can be intermingled with sending score events to the instance (csoundScoreEvent().

5. After performance completes, use csoundCleanup() to do exactly that.

6. You need to explicitly destroy the Csound instance with csoundDestroy().

Value

csoundCreate returns a Csound instance that is an argument to most of the other API functions.

csoundPerform returns an integer, which is positive number if it reaches the end of the score, or zero if it is stopped by another thread.

Note

Using these functions in the wrong order can cause a crash! Other functions in this package provide safer interfaces to Csound, though this is the most direct interaction


csound documentation built on May 2, 2019, 5:46 p.m.