timeinstk
Prev | Orchestra Opcodes and Operators | Next

## timeinstk

timeinstk — Read absolute time in k-rate cycles.

## Description

Read absolute time, in k-rate cycles, since the start of an instance of an instrument. Called at both i-time as well as k-time.

## Syntax

    kres timeinstk

    kres timeinsts

## Performance

timeinstk is for time in k-rate cycles. So with:

      sr    = 44100
      kr    = 6300
      ksmps = 7

then after half a second, the timek opcode would report 3150. It will always report an integer.

timeinstk produces a k-rate variable for output. There are no input parameters.

timeinstk is similar to timek except it returns the time since the start of this instance of the instrument.

## Examples

Here is an example of the timeinstk opcode. It uses the files timeinstk.orc and timeinstk.sco.

Example 376. Example of the timeinstk opcode.

    /* timeinstk.orc */
    ; Initialize the global variables.
    sr = 44100
    kr = 4410
    ksmps = 10
    nchnls = 1

    ; Instrument #1.
    instr 1
      ; Print out the value from timeinstk every half-second.
      k1 timeinstk
      printks "k1 = %f samples\\n", 0.5, k1
    endin
    /* timeinstk.orc */

    /* timeinstk.sco */
    ; Play Instrument #1 for two seconds.
    i 1 0 2
    e
    /* timeinstk.sco */

Its output should include lines like this:

    k1 = 1.000000 samples
    k1 = 2205.000000 samples
    k1 = 4410.000000 samples
    k1 = 6615.000000 samples
    k1 = 8820.000000 samples

## See Also

timeinsts, timek, times

## Credits

Author: Robin Whittle
Australia
May 1997

Example written by Kevin Conder.

Prev | Up | Next
tigoto | Home | timeinsts