Triggering sound using my computer's keyboard
Hi,
Relatively new user. I'm a little lost as to how I can play sounds (like a simple sine wave using the cycle~ function) using different keys on my keyboard. I used the key function to figure out the number of the keys (ex: B is 98, A is 97) but I'm not sure how to connect them so they play the sound. I know the select function has something to do with this too as I was looking at some built-in tutorials.
Thanks.
Hi
you're almost there, but you don't specify exactly what you wish to do with the keystrokes. To control frequency, for example, use [key] to identify ascii numbers, then send its left outlet to [* 10]. Send the result to the [cycle~] left inlet. Now you're controlling frequency with the keys. [select] will issue bangs depending on the arguments you specify, so [select 49 50] will give a bang for keys "1" and "2".
Right/ctrl clicking on any object in edit mode brings up a helpfile patcher.
Brendan
The last post has a QWERTY keyboard MIDI controller. Put the pitch output from the patcher into a mtof and feed it into a cycle~. Not sure if thats what yr after but - it's handy and will do something like what you want one way or another.
Thanks everyone. I'm getting there, slowly. I connected the key to the B and when I hit B on my keyboard, the button goes yellow so that means it's working. But I'm having troubles attaching or getting sound out of it.
Check attachment please.
edit: Sorry, the attachments don't seem to be working. One moment...
edit 2: See here - http://imageshack.us/f/829/maxmsp.jpg/
Download the library I just linked to, pop it somewhere in your max search path (or add it under Options > File Preferences) and then try this super simple patch. The object basically makes your computer keyboard mimic a MIDI keyboard. The example patch turns the MIDI notes to frequency values with [mtof], generates a sine wave at this pitch with [cycle~] and finally sends it to your speakers.
Is there a simpler way? I just want different sounds to be produced (of sine waves) when I press certain keys on my keyboard. I was getting sound before but wasn't sure how to connect it to the button so the keys would trigger it. Yeah, I'm struggling. Sorry to be a pain.
Here's what I have right now - http://cl.ly/8OSq. But I don't know how to make it so the sound triggers only when those keys are pressed. And I need to product different sounds (sine wave) for each key.
Like this:
(copy all the text below, and go File/New From Clipboard; then go here:
https://cycling74.com/forums/common-max-arcana
and here:
https://cycling74.com/docs/max5/tutorials/max-tut/maxindex.html