tis 2007-12-04 klockan 07:59 -0800 skrev Alpha Core:
hello Ive been working on triggering Osc by the use of the keyboard and im still a having trouble I read the kb.ck file in the hid folder to figure out how it triggered and output the keys so i came up with the below syntax.
// setting up the keyboard to trigger Osc // this should trigger a middle c tone when A key is pressed { if (msg.is ButtonDown()) and if (msg.my_keynumber = 65 then SinOsc s => Dac; 261 => s.freq; 1::second => now }
it still giving me errors ? even when i running the kb.ck file in chuck any help would be great thanks
The syntax should look like this (I've made some notes): // if followed an expression in brackets. if there are mutliple, use // "and" followed by a new expression between brackets (you can also use // "or" instead of "and". // The curly brackets come after the whole if-statement. // No "then". if (msg.isButtonDown()) and (msg.my_keynumber = 65) { SinOsc s => dac; <-- dac is in written in small letters 261 => s.freq; 1::second => now; <-- should have a ";" at the end } That should - at least - work better. I'm a bit unsure about "msg.my_keynumber = 65", shouldn't it be "msg.key == 65" (note the double equal-signs)? Also, instead of doing raw frequencies, try Std.mtof instead. that will convert a midi-note number to a frequency. In your case the line 261 => s.freq; would be: Std.mtof(60) => s.freq; Hope that helps, Gasten