The Alternative Csound Reference Manual
Previous |  | Next

# sensekey

sensekey -- Returns the ASCII code of a key that has been pressed.

## Description

Returns the ASCII code of a key that has been pressed, or -1 if no key has been pressed.

## Syntax

kr sensekey

## Performance

At release, this has not been properly verified, and seems not to work at all on Windows.

| Note
| This opcode can also be written as sense.

## Examples

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

Example 1. Example of the sensekey opcode.

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

    ; Instrument #1.
    instr 1
      k1 sensekey
      printk2 k1
    endin
    /* sensekey.orc */

    /* sensekey.sco */
    ; Play Instrument #1 for thirty seconds.
    i 1 0 30
    e
    /* sensekey.sco */

Here is what the output should look like when the "q" button is pressed...

    q i1 357967744.00000

## Credits

Author: John ffitch
University of Bath, Codemist. Ltd.
Bath, UK
October 2000

Example written by Kevin Conder.

New in Csound version 4.09. Renamed in Csound version 4.10.

Previous | Home | Next
sense | Up | seqtime