printsk
Prev | Orchestra Opcodes and Operators | Next

## printsk

printks — Prints at k-rate using a printf() style syntax.

## Description

Prints at k-rate using a printf() style syntax. This opcode prints at every cycle, possibly multiple times per cycle. Used inside an if-block it can behave like printf, printks (when used together with metro) or printks2 (when used with changed).

## Syntax

    printsk "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 to be printed. These are specified in “string” with the standard C value specifier (%f, %d, %s etc.) in the order given.

## Print Output Formatting

All standard C language printf() control characters may be used. For example, if kval1 = 153.26789 then some common formatting options are:

1. %f prints with full precision: 153.26789

2. %5.2f prints: 153.26

3. %d prints integers-only: 153

4. %c treats kval1 as an ascii character code.

For more information about printf() formatting, consult any C language documentation.

## Examples

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

Example 760. Example of the printsk opcode.

    <CsoundSynthesizer>
    <CsOptions>
    </CsOptions>
    <CsInstruments>

    sr = 44100
    ksmps = 64
    nchnls = 1

    instr 1
      ; printsk is executed at k-time, possibly multiples times per cycle.
      k0 = 0
      while k0 < 20 do
        if k0 % 2 == 0 then
          printsk "k0 = %d\n", k0
        endif
        k0 += 1
      od
    endin

    instr 2
      ; println is similar to printsk but appends a new line
      k0 = 0
      while k0 < 20 do
        if k0 % 2 == 0 then
          println "k0 = %d", k0
        endif
        k0 += 1
      od
    endin

    </CsInstruments>
    <CsScore>

    i 1 0 0.1
    i 2 0.1 0.1
    e

    </CsScore>
    </CsoundSynthesizer>

## See Also

printks, printf, println

## Credits

By: Eduardo Moguillansky 2020

New plugin in version 6.15

Prev | Up | Next
prints | Home | printarray