puts — Print a string constant or variable


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


puts Sstr, ktrig[, inonl]


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


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.


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

Example 642. Example of the puts opcode.

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

; 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

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
f1 0 16384 10 1

i 1 0 10

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 


Author: Istvan Varga