• ### Creating a large number combining several numbers

Hi everyone! This is my first post here, be kind

I don't know if this is in front of me and I'm blind but I cant find a solution for this without using externals, and other stuff (even though). I've tried lists, pack, etc... and I prefer not to use any external, just core pd 0.51

Problem: I cant generate a number, let's say 101 from three separate numbers: 1 0 1.

Situation:
I need to take three numbers (boolean states from 3 toggles: 0 or 1) and create a "3 bit" number so a [select] object can decide accordingly: If number is 100 do X, if 101, do Y, if 110 do F, if 001 do K, and so on...

I, knowing a little bit of other programming languages, though it was as easy as "combine all integers from a list creating a string and then apply something like string.ToInteger"... but looks like is not that simple.

I appreciate any input!

• Posts 23 | Views 2202
• This works better:

keyupdown.pd

• @ingox Thank you for the reply and your post. The number box (at the end of the patch ) from 1-6 works fine. But to transfer it to the right sound is still tricky for me.
Press d = c1 ,
Press s= d1
Press ds= e1 (notes)
is what I want. but as soon I press ds together it reads as well each key individual and change the sound back to c1 or d1 and is not staying on e1.
I am trying around with a metro which is triggered by "ds" and with a Spigot object, blocks d + s to function.
As soon I am a functional step further I will post it here. Tricky control situation + I am quite new with Pure data.
Thanks again

• @atk90x @Tilman You can also you message arguments to combine numbers

Edit: Should mention that this can create a great number of symbols quickly, which can fill up the hash table and slow down pd. In cases like OP it is not much of an issue, just a few symbols are being created and it will have no real negative impact on speed, but in some situations you could quickly create thousands of unique symbols and this will slow things down.

• For anyone that finds that will not work......... [f] only converts symbols since Pd 0.48.0....... and unfortunately will still not convert text 123 so it must first be defined as a symbol as @oid says.
David.

• @Tilman Using the computer keyboard will never give you the same responsiveness as a midi keyboard, as the computer keyboard produces many key down and up events when a key is pressed like aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.

So this has to be mitigated somehow. I find it surprisingly hard.

I built a buffer with [text] but it still has some fluctuations at least on my macbook + linux: keyplay.pd

• @ingox on mac you can turn repeats off in system preferences

• Here is a nicer and cleaner approach that seems mostly stable: keyplay.pd

@Tilman You can adjust the delay so that it works with your keyboard.

50 milliseconds is enough on my keyboard.

I still have some weird effects that sometimes when i hit three keys at once, the release of a single key is not detected, but it mostly works.

• @ingox A little patch to solve the problem when repeats cannot be turned off (virtual keyboard midi chord debounce)..... chord_debounce.zip
I am pretty sure it has no ill effects....... you get the chord immediately.......
It doesn't use [delay].
You asked me once whether [clone] was necessary for this. Probably not as it can probably be done with lists but this is a simple solution (I am not the @list-master).
The number of clones could be reduced to 128 I think but this allows for clumsy fingers.
David.

• Wow that is an incredible help. Thank you all so much. What a joy.

I will need a bit more time to go though all different objects to have a max. learning input.

Very great:)

• @whale-av I can't get it to work...

If i do
[chord_debounce]
|
[print]
i still get key ups and downs for pressed keys.

How should it be implemented and what should it do?

• @ingox Yes...... but it suppresses all repeats generated by the OS from key presses held down........ your "aaaaaaaaaaaaaaaaaaa" problem...... while still outputting the intended events instantaneously.
You would need to compare it to the actual outputs of [key] and [keyup] to see it work.
I suppose that if repeats are turned off in system preferences you would see no difference.
I don't think there is such a setting for widows....... but I am often wrong...... and can be again.
You can adjust the repeat rate in windows but not turn the repeats off.
Anyway its a pita to have to change such settings for different uses.
David.

• @whale-av Hm, it doesn't work on linux. Repeats are not turned off.

debounce-test.zip

Or this, shows same behavior for [chord_debounce] and [key] and [keyup] combined: debounce-test.pd.

• @ingox In windows the bang directly after [key] (right hand side in debounce_test.pd) shows bangs all the time that a key is pressed and held down.
test.pd
Does [key] suppress repeats in the Linux Pd distro? maybe.........
David.

• @whale-av On linux it is identical on both sides...

Posts 23 | Views 2202
Internal error.

Oops! Looks like something went wrong!