-
kc6800
Hello all,
I have just started experimenting with puredata and I have been trying to solve this little problem. Basically, I am trying to add two numbers, but my code is broken down into two separate pd files.
The first file "Add_Two_Numbers_Client.pd" is as follows. It generates a number (in this case a value of 100) every second and called the second file "Add_Two_Numbers.pd" which adds the value of 100 to a number obtained from a hslider and outputs the result back to "Add_Two_Numbers_Client.pd".
Code for Add_Two_Numbers_Client.pd
[toggle]
|
[metro 1000]
|
[100]
|
[Add_Two_Numbers]
|
[print "Sum"]Code for Add_Two_Numbers.pd
[inlet] [hslider]
| |
| |0\
| /
| /
| /
| /
| /
| /
| ||
[unpack f f]
| |
[+ 0 ]
|
[outlet]-----End of code ----
The code doesnt work. I always get the following output irrespective of how the hslider is changed:
"Sum": 100
"Sum": 100
"Sum": 100
"Sum": 100
"Sum": 100
"Sum": 100
"Sum": 100
"Sum": 100
"Sum": 100What am I doing wrong? Can someone help me out? From a design standpoint, I have to keep the second number (coming from the hslider) in the second file. This is part of a bigger program.
Any help to fix this will be highly appreciated. Thanks.
-
kc6800
Ok. I added the [t b f] as suggested by Jwif earlier to my code and now it works fine.
Thanks to everyone for the help! This should get me on my way....until the next road-block
Here is the modified code:
Code for Add_Two_Numbers.pd
[inlet] [hslider]
| |
| |0\
| /
| /
| /
| /
| [t b f]
| / /
| / /
| / /
| / /
|/ ||
[unpack f f]
| |
[+ 0 ]
|
[outlet]- kc6800
-
kc6800
Hi Jwif,
It still doesn't work for me. I am using pd-0.43-2 on a mac mini. Are there any quirks or issues associated with this configuration?
I am completely confused now. Any suggestions/comments?
Thanks!
-
-
kc6800
Hi Jwif,
It is an unnecessary way to sum two numbers. I am working on a larger application involving many separate PD files and I was just abstracting out a common problem that I was facing in several places in this application.
Here are the two patches that I am working with. I am posting the first one here. I will eply to my message and post the second one shortly.
Thanks to everyone for responding to my question.
http://www.pdpatchrepo.info/hurleur/Add_Two_Numbers_Client.pd