object KeyState extends ProductReader[KeyState] with Serializable
A UGen that detects a specific keyboard stroke. When the given key is not
pressed, the lo
value is output, while the key is pressed the hi
value is
output. If lag
is greater than zero, a Lag
-type operation is applied for a
smoother transition between lo
and hi
.
Examples
// determine codes play { val code = Phasor.kr(lo = 0, hi = 127) val k = KeyState.kr(code, lag = 0) val x = Gate.kr(code, k) val ch = x sig_!= Delay1.kr(x) // when a code change is detected, print it x.poll(ch, "code") () }
// gate sound using the 'A' key play { // on Linux, key-code 38 denotes the 'A' key SinOsc.ar(800) * KeyState.kr(38, 0, 0.1) }
- See also
- Alphabetic
- By Inheritance
- KeyState
- Serializable
- ProductReader
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def kr(keyCode: GE, lo: GE = 0.0f, hi: GE = 1.0f, lag: GE = 0.2f): KeyState
- keyCode
hardware code for the key to monitor. This is likely platform dependent. For example, on Linux, key-codes 24 to 29 correspond to 'Q', 'W', 'E', 'R', 'T', 'Y'.
- lo
value output when the currently pressed does not match the code
- hi
value output when the currently pressed does match the code
- lag
60 dB lag time in seconds.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def read(in: RefMapIn, key: String, arity: Int): KeyState
- Definition Classes
- KeyState → ProductReader
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated