Receiving sound values in processing - status: unanswered -

Hi,

I'm trying to receive the brightness, loudness, noisiness and beat in processing. Then I'd like to assign values between certain numbers to them. 0-700 for the screen size and 0-255 for noisiness etc. and 0 or 1 for the beat. For this i'm using the oscp5 library in processing for a maxmsp patch.

here's a picture of the patch: (Don't mind the comments, they're in Dutch, if you need a translation, just ask. Of course I'd be glad to translate for anyone willing to help.) patch

And this is the code I've currently got:

import oscP5.*;
import netP5.*;

float loudness;
float noisiness;
float brightness;
int beat;


OscP5 oscP5;
NetAddress myRemoteLocation;


void setup() {
  size(700, 700);

  oscP5 = new OscP5(this, 7400);


  myRemoteLocation = new NetAddress("127.0.0.1", 7400);

  oscP5.plug(this, "brightness", "/brightness");
  oscP5.plug(this, "noisiness", "/noisiness");
  oscP5.plug(this, "loudness", "/loudness");
  oscP5.plug(this, "beat", "/beat");
}

void loudness(float loudnessValue) {
  println("loudness:"+loudnessValue);
  loudness = loudnessValue;
}

void brightness(float brightnessValue) {
  println("brightness: "+brightnessValue);
  brightness = brightnessValue;
}
void noisiness(float noisinessValue) {
  println("noisiness: "+noisinessValue);
  noisiness = noisinessValue;
}
void draw()
{
  background(0);
  fill(255);
  ellipse(noisiness*100, brightness/100, 100, 100);
}

So, again: can anyone help me assign values between certain margins (0 - 700 for the screen size and 0 - 255 for colours) to brightness etc. and a 0 or 1 value for the beat. And then I'd like to use those values to make one or several shapes moving in real time to the music. But that comes last. First I'd just like to receive usable values.

Thanks for helping in advance!

~Dread

Answers

  • edited April 2014 Answer ✓

    Is there a larger scale version of your image somewhere? It's a bit hard to read. I understand Dutch.

    Your question isn't exactly clear to me. Do you want to generate these parameters in Processing, or have you managed to do that somewhere else and want to send them to Processing using OscP5?

  • Sure, here's a larger image: http://i.imgur.com/oqm6XRx.png

    And I'd like to assign values in processing to the data I receive from oscp5. I think the image will clarify it more than I might be able to explain.

  • Just wondering how you do the sound analysis... I'm trying to do something similar.

    Your code looks fine to me. Doesn't it work? I noticed you can't use two sketches with an OscP5 listening to the same port at the same time though. Maybe that's the problem? Also, you are looking for floats, but if you send integers, it won't work. If you don't know what the program is sending, try adding this to your sketch:

    void brightness(int brightnessValue) {
      println("brightness as integer: "+brightnessValue);
      brightness = brightnessValue;
    }
    
  • Not too sure about your question (particularly "So, again: can anyone help me assign values between certain margins (0 - 700 for the screen size and 0 - 255 for colours) to brightness etc. and a 0 or 1 value for the beat.") as it seems to be answered by the map() function of Processing. Is that what you want?

    I tentatively moved the topic to the Libraries category, although it can be in the How To category as well...

  • Thanks for your replies, as for the values I want to assign ranges to them and the map function can do that, thanks PhilLo.

    But the problem is that I'm receiving the information but I have no idea within what range the data is being received so I can remap it.

    Also I believe that I'm not getting a real-time feed of the data that's being transmitted but rather one value that I'm receiving. I think this is the case because when I assign noisiness and/or loudness to the size values of an ellipse it just takes one shape.

    And to colouredmirrorball: What do you mean? Should I create one void that encompasses all the values separately in it?

    I'm sorry for my lack of processing lingo, I'm not that great at it yet. Trying to get there though.

Sign In or Register to comment.