| sensor exit event key pitchName pitchValue triggerName | "This code interprets computer key presses as triggers and pitch values for aSound with !PseudoPch nn as its Frequency value and !Trig as its trigger parameter. SpaceBar breaks out of the loop. First play your Kyma Sound. Then selectAll and evaluate this program using ctrl-y (make sure there are no nils at the end left over from previous evaluations of the code). It will run in a loop waiting for computer keyboard input and posting event values to the SignalProcessor depending on the value of the keys pressed. PRESS SPACE BAR to break out of the loop. Erase the nil that appears at the bottom of this window as the result of the evaluation." pitchName := #PseudoPch. pitchValue := 4 c removeUnits. triggerName := #Trig. sensor := ScheduledControllers activeController sensor. exit := false. [exit] whileFalse: [ SignalProcessor poll. event := sensor getNextEvent. event isNullEvent ifFalse: [ event isKeyboardEvent ifTrue: [ key := event keyValue. key == Character space ifTrue: [exit := true] ifFalse: [ "Depending on the value of the key, choose the continuous controller event value to emit." (key == $a) ifTrue: [pitchValue := 4 c removeUnits]. (key == $w) ifTrue: [pitchValue := 4 c sharp removeUnits]. (key == $s) ifTrue: [pitchValue := 4 d removeUnits]. (key == $e) ifTrue: [pitchValue := 4 d sharp removeUnits]. (key == $d) ifTrue: [pitchValue := 4 e removeUnits]. "Send the event values" SignalProcessor postEventValueNamed: triggerName value: 0. SignalProcessor postEventValueNamed: pitchName value: pitchValue. SignalProcessor postEventValueNamed: triggerName value: -1. (Delay forMilliseconds: 2) wait. SignalProcessor postEventValueNamed: triggerName value: 1. ]] ifFalse: [ sensor putBackEvent: event; dispatchNextEventBefore: Time millisecondClockValue + 25]]].