Triggering sound using my computer's keyboard

Jul 12, 2011 at 9:50pm

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.

#57995
Jul 12, 2011 at 10:05pm

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

#208173
Jul 12, 2011 at 10:22pm

http://www.cycling74.com/forums/topic.php?id=18502#post-98082

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.

#208174
Jul 12, 2011 at 10:27pm

Also available as part of my MaxMSP Library download available here in the Code section. It comes with some other abstractions you might find useful and updated help files.

#208175
Jul 12, 2011 at 11:16pm

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/

Attachments:
  1. maxmsp.jpg
#208176
Jul 12, 2011 at 11:24pm

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.

– Pasted Max Patch, click to expand. –
#208177
Jul 12, 2011 at 11:59pm

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.

#208178
Jul 13, 2011 at 12:55am

Like this:
(copy all the text below, and go File/New From Clipboard; then go here:
http://cycling74.com/forums/topic.php?id=26095
and here:

http://cycling74.com/docs/max5/tutorials/max-tut/maxindex.html

– Pasted Max Patch, click to expand. –
#208179

You must be logged in to reply to this topic.