# Android processing and Puredata communication

**URL:** <https://discourse.processing.org/t/android-processing-and-puredata-communication/23627>\
**Category:** Processing for Android\
**Created:** [September 2, 2020, 10:22am UTC](https://discourse.processing.org/t/android-processing-and-puredata-communication/23627 "2020-09-02T10:22:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Purr](https://avatars.discourse-cdn.com/v4/letter/p/73ab20/32.png) [@Purr](https://discourse.processing.org/u/Purr)\
**Post date:** [September 2, 2020, 10:22am UTC](https://discourse.processing.org/t/android-processing-and-puredata-communication/23627/1 "2020-09-02T10:22:08Z")

</div>

Hi there,

I have problem about communication between Android processing and Pure data. When I run my code in processing, I see on the back of my screen that the phone send information to my computer but definitly not to pure data. That surprise me because the code is working in java but not in android.  
I’ve already check the permission for android in my computer, the both are connect on the same wifi and I use to communicate with PD oscp5 for processing and mrpeach to receive in PD

Here the code :  
import oscP5._;  
import netP5._;

import controlP5.\*;  
ControlP5 controlP5;  
Knob myDial;  
Slider mySlider;

OscP5 oscP5;  
NetAddress myRemoteLocation;

int knobValue = 100;

void setup() {  
size(400,400);  
smooth();  
frameRate(25);  
// create a new instance of oscP5.  
// 12000 is the port number you are listening for incoming osc messages.  
oscP5 = new OscP5(this, 12000);  
myRemoteLocation = new NetAddress(“127.0.0.1”, 12000);  
controlP5 = new ControlP5(this);  
myDial = controlP5.addKnob(“knobValue”)  
.setPosition(100, 100)  
.setSize(200, 200);  
}

void draw() {  
background(0);  
fill(255, 0, 0);  
;  
println(knobValue);  
}  
void mousePressed() {  
/\* in the following different ways of creating osc messages are shown by example _/  
//OscMessage myMessage = new OscMessage(int(knobValue));  
 [//myMessage.add](https://myMessage.add)();  
OscMessage myMessage = new OscMessage("/test");  
myMessage.add(knobValue);  
/_ send the message \*/  
oscP5.send(myMessage, myRemoteLocation);  
}

the routing in pd :

[import mr peach] -----\> [udpreceive 127.0.0.1 12000]---------\>[unpackOSC]-------\>[routeOSC /test]----\>[number]

if someone can help me that would be great,  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [September 3, 2020, 3:10pm UTC](https://discourse.processing.org/t/android-processing-and-puredata-communication/23627/2 "2020-09-03T15:10:55Z")

</div>

> [@Purr](#):
>
> between Android processing and Pure data.

Hi.  
Can you explain a little more detailed.  
Are you using the posted code on android or PC?  
If using PD on android are you using [this](https://github.com/libpd/pd-for-android) lib?

I found also this link.

> **[libpd: Put Pure Data in Your App, On an iPhone or Android, and Everywhere,...](https://cdm.link/2010/10/libpd-put-pure-data-in-your-app-on-an-iphone-or-android-and-everywhere-free/)**
>
> What if you could make any device or any software a re-programmable musical instrument, effect, or soundmaker? Your phone could be a touch-controlled effect, your tablet a sketchpad for interactive drum sequencers. Patches assembled on your desk on a...

Also you could try to send TCP or UDP messages instead of OSC…

---

<div class="post-metadata">

**Author:** ![Purr](https://avatars.discourse-cdn.com/v4/letter/p/73ab20/32.png) [@Purr](https://discourse.processing.org/u/Purr)\
**Post date:** [September 4, 2020, 8:59am UTC](https://discourse.processing.org/t/android-processing-and-puredata-communication/23627/3 "2020-09-04T08:59:05Z")

</div>

Hi,

The processing code is on a phone and he need to communicate with the pd patch on a computer but I found the solution, it was a problem of IP adress.  
Now, I’ve just a problem with the accelerometer who does’nt want send antything. But I’m sure (and I hope) that it’s gonna work soon.

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [September 4, 2020, 9:06am UTC](https://discourse.processing.org/t/android-processing-and-puredata-communication/23627/4 "2020-09-04T09:06:04Z")

</div>

Thus you are managing to community OSC with PD successfully. (not TCP or UDP) ?

---

<div class="post-metadata">

**Author:** ![Purr](https://avatars.discourse-cdn.com/v4/letter/p/73ab20/32.png) [@Purr](https://discourse.processing.org/u/Purr)\
**Post date:** [September 4, 2020, 9:18am UTC](https://discourse.processing.org/t/android-processing-and-puredata-communication/23627/5 "2020-09-04T09:18:57Z")

</div>

I’m not sure to understand your last question,  
I’m sending with oscp5 and I’m still using a UDPreceive in PD, but I was using a wrong IP configuration in my processing code.  
And in PD you only need to give the port. Doesn’t need IP adress only where it need to listen.
