I want to create a program to send an audio with server and receive like discord but on LAN.
Here is the code who is for start
import processing.net.*;
import processing.sound.*;
Server server;
Client client;
String input;
int data[];
int port;
String stat;
int v;
AudioIn in;
void setup() {
stat ="online";
size(800,100);
port = 8670;
background(204);
stroke(0);
frameRate(3); // Slow it down a little
server = new Server(this, port); // Start a simple server on a port
in = new AudioIn(this, 0);
server.write(in);
}
void draw() {
text(stat,0,20);
// Receive data from client
client = server.available();
if (client != null) {
input = client.readString();
input = input.substring(0, input.indexOf("\n")); // Only up to the newline
data = int(split(input, ' ')); // Split values into an array
// Draw line using received coords
stroke(0);
line(data[0], data[1], data[2], data[3]);
}
}
void keyPressed()
{
if(keyCode==UP){v = v+1;}
}