The Alternative Csound Reference Manual
Previous |  | Next

# readk2

readk2 -- Periodically reads two orchestra control-signal values from an external file.

## Description

Periodically reads two orchestra control-signal values from an external file.

## Syntax

kr1, kr2 readk2 ifilname, iformat, ipol [, interp]

## Initialization

ifilname -- character string (in double quotes, spaces permitted) denoting the external file name. May either be a full path name with target directory specified or a simple filename to be created within the current directory

iformat -- specifies the output data format:

- 1 = 8-bit signed char(high order 8 bits of a 16-bit integer

- 4 = 16-bit short integers

- 5 = 32-bit long integers

- 6 = 32-bit floats, 7=ASCII long integers

- 8 = ASCII floats (2 decimal places)

Note that A-law and U-law output are not available, and that all formats except the lsat two are binary. The output file contains no header information.

iprd -- the period of ksig output i seconds, rounded to the nearest orchestra control period. A value of 0 implies one control period (the enforced minimum), which will create an output file sampled at the orchestra control rate.

ipol -- if non-zero, and iprd implies more than one control period, interpolate the k- signals between the periodic reads from the external file. If the value is 0, repeat each signal between frames. Currently not supported.

## Performance

kr1, kr2 -- control-rate signals

This opcode allows two generated control signal values to be read from a named external file. The file contains no self-defining header information. But it contains a regularly sampled time series, suitable for later input or analysis. There may be any number of readk2 opcodes in an instrument or orchestra and they may read from the same or different files.

## Examples

    knum    =         knum+1                                               ; at each k-period
    ktemp   tempest   krms, .02, .1, 3, 2, 800, .005, 0, 60, 4, .1, .995   ;estimate the tempo
    koct    specptrk  wsig, 6, .9, 0                                       ;and the pitch
            dumpk3    knum, ktemp, cpsoct(koct), "what happened when", 8 0 ;& save them

## See Also

dumpk, dumpk2, dumpk3, dumpk4, readk, readk3, readk4

Previous | Home | Next
readk | Up | readk3