puts
Prev | Orchestra Opcodes and Operators | Next

## puts

puts — Print a string constant or variable

## Description

puts prints a string with an optional newline at the end whenever the trigger signal is positive and changes.

## Syntax

    puts Sstr, ktrig[, inonl]

## Initialization

Sstr -- string to be printed

inonl (optional, defaults to 0) -- if non-zero, disables the default printing of a newline character at the end of the string

## Performance

ktrig -- trigger signal, should be valid at i-time. The string is printed at initialization time if ktrig is positive, and at performance time whenever ktrig is both positive and different from the previous value. Use a constant value of 1 to print once at note initialization.

## Examples

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

Example 664. Example of the puts opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

    <CsoundSynthesizer>
    <CsOptions>
    ; Select audio/midi flags here according to platform
    -odac     ;;;realtime audio out
    ;-iadc    ;;;uncomment -iadc if RT audio input is needed too
    ; For Non-realtime ouput leave only the line below:
    ; -o puts.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    sr = 44100
    ksmps = 32
    nchnls = 2
    0dbfs  = 1

    instr	1

    kcount init 440
    ktrig  metro 10
    kcount = kcount + ktrig
    String sprintfk "frequency in Hertz : %d \n", kcount
           puts	String, kcount
           asig poscil .7, kcount, 1
           outs asig, asig

    endin
    </CsInstruments>
    <CsScore>
    f1 0 16384 10 1

    i 1 0 10
    e
    </CsScore>
    </CsoundSynthesizer>

Its output should include lines like these:

    frequency in Hertz : 440
    frequency in Hertz : 441
    frequency in Hertz : 442
    ....
    frequency in Hertz : 459
    frequency in Hertz : 460

## Credits

Author: Istvan Varga
2005

Prev | Up | Next
ptrack | Home | pvadd