PURE DATA forum~

...that deal with pure data

You are not logged in.

#1 2011-02-11 15:34:56

beerwolf
Member

keys

Hello,
I'm trying to program something to make my alph-numeric computerkeybourd work like a music-keyboard : as many keys should play different sounds. The problem I face is that the keys start toggling between key up and key down when they are pressed continously.  The left outlet of "keyname" doesn't have the toggling-problem, but reacts on any key. (As you all have noticed, I'm not a computergenius)
Any sugesstions?
Thanks.

Offline

 

#2 2011-02-11 16:05:19

Jwif
Member

Re: keys

Hi beerwolf,

Try using [key] (for key down) and [key up] (for key up).

You can look for specific values by specifying them as an argument.

For example, [key 97] will only output if 'a' is pressed down (on my keyboard anyway).

Offline

 

#3 2011-02-11 22:43:46

beerwolf
Member

Re: keys

Hello Jwif, thanks for your answer.
It might be a specific keyboard problem. If I press fi the a key shortly it gives me an "a", but if I keep it down I get "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".
When writing it's not a problem, but if I want to use it as a "musical" keyboardkey, I get a strage effect, wich can be appealing, but not in the way I want to use it.

Offline

 

#4 2011-02-17 09:22:16

mod
Administrator

Re: keys

check out [change], which stops multiple messages going through if they are not changed.

Offline

 

#5 2011-02-17 11:46:39

Jwif
Member

Re: keys

Yeah as mod mentioned you can use [change]. I think the multiple messages are an OS thing anyway. In OS X you can change the speed of the repeats and add a delay to them after holding down.

Offline

 

#6 2011-02-17 14:03:08

domien
Member

Re: keys

I believe you had to to this with [keyname] which has an outlet for the pressed status (0 or 1). You'll have to patch around it to make it work though...


|] [] |.| ][|-| -- http://soundcloud.com/domxh

Offline

 

#7 2011-02-18 14:13:00

beerwolf
Member

Re: keys

I managed to counter the problem by turning off keyrepeat in the accessibilitymenu.  This works in vista, strangly enough in xp it works for one key, but it doesn't for two or more keys together.  So it's useless to mesince I want to use the device to study microtonality and intervals. I'll try the [change] to make it work without having to change anything.  I have  been trying [keyname], but the left outlet gives me a 0/1 on any key, and the right outlet in combination with fi [select a] has the toggling problem again.

Offline

 

#8 2011-02-18 17:14:23

domien
Member

Re: keys

To make something completely generic is not possible I believe. I think you'll have to make a "key watcher" subpatch per key you want to monitor. In combination with [route] i guess one could come up with something that works. I vaguely remember that hardoff once made something like this...


|] [] |.| ][|-| -- http://soundcloud.com/domxh

Offline

 

#9 2011-02-18 17:55:52

beerwolf
Member

Re: keys

I tried the [change] but than it doesn't swith off when the key is released.
A friend soundengineer has send me something in max without togglingproblems, but unfortunately for me not enough keys.  I first tried liberty basic and scratch and now pD-ing away.  The road is the goal!!

Offline

 

#10 2011-02-18 22:29:36

domien
Member

Re: keys

Is this what you're looking for. The keyControls subpatch is a bit messy, but on my machine this works.

It's here : http://puredata.hurleur.com/sujet-5228- … eated-keys because apparently you cannot post patches in this part of the forum.

I've noticed that on xp it doesn't work for more than 4 keys at the same time.

Last edited by domien (2011-02-18 22:33:40)


|] [] |.| ][|-| -- http://soundcloud.com/domxh

Offline

 

#11 2011-02-18 23:42:28

beerwolf
Member

Re: keys

Apperently it depends on wich key you press. I can combine azeryio the same time, but when I start with t I can only add one other key, and the computer itself gives me a warning bleep.  Windows logic?
The patch I made has the same combinationlimitations. Your patch is far easier to use and I don't have to mess with accessibilaty.
Thanks a lot!!
One little question, I don't see the us of the [change], it works as well when I let it out.

Offline

 

#12 2011-02-19 11:19:29

domien
Member

Re: keys

I assumed that the keyname keeps on spitting out 1's and 0's (following the repeat rate of the keyboard), but apparently it doesn't so then indeed change is not necessary.


|] [] |.| ][|-| -- http://soundcloud.com/domxh

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson


pd.webring info