Skip to content

prints

Prints at init-time using a printf() style syntax.

Syntax

prints "string" [, xval1] [, xval2] [...]

Initialization

"string" -- the text string to be printed. Can be up to 8192 characters and must be in double quotes.

Performance

xval1, xval2, ... (optional) -- The k-rate values or strings to be printed. These are specified in “string” with the standard C value specifier (%f, %d, %s etc.) in the order given.

prints is similar to the printks opcode except it operates at init-time instead of k-rate. For more information about output formatting, please look at printks's documentation.

Examples

Here is an example of the prints opcode. It uses the file prints.csd.

Example of the prints opcode.
<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
; Audio out   Audio in
-odac           -iadc    ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o prints.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

/* Written by Matt Ingalls, edited by Kevin Conder. */
; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

; Instrument #1.
instr 1
  ; Init-time print.
  prints "%2.3f\\t%!%!%!%!%!%!semicolons! %%\\n", 1234.56789
endin


</CsInstruments>
<CsScore>

/* Written by Matt Ingalls, edited by Kevin Conder. */
; Play instrument #1.
i 1 0 0.004


</CsScore>
</CsoundSynthesizer>

Its output should include a line like this:

1234.568        ;;;;;;semicolons!

See also

Printing and Display

Credits

Author: Matt Ingalls
January 2003