Hello.
As stated in the header, i need to send a file .wav (but i think any method is suitable for any file) from a processing client to a python server which processes the file and sends it back to the processing client.
Up to now this is my very simple code which i took from a demo found on the processing website:
import processing.net.*;
import java.io.FilenameFilter;
String[] filenames;
String fullPath = "C:\\Users/aless/Desktop/client_server_prova/Client_processing/client_processing/file_audio";
Client myClient;
void setup() {
size(200, 200);
filenames = loadFilenames(fullPath);
/* Connect to the local machine at port 50007
* (or whichever port you choose to run the
* server on).
* This example will not run if you haven't
* previously started a server on this port.
*/
myClient = new Client(this, "127.0.0.1", 50007);
myClient.write(filenames[0]);
// DEBUG
//myClient.write("Paging Python!");
//print(filenames[0]);
// FINE DEBUG
}
void draw() {
//myClient.write("Paging Python!"); // send whatever you need to send here
}
String[] loadFilenames(String path) {
File folder = new File(path);
FilenameFilter filenameFilter = new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".wav");//|| name.toLowerCase().endsWith(".mp4"); // change this to any extension you want
}
};
return folder.list(filenameFilter);
}
the “filenames” stuff is a failed attempt i made.
If anyone could help me i would be very grateful.
Thank you very much.