Quantcast
Viewing all 1768 articles
Browse latest View live

Where do I find reference to frame. properties

Where do I find reference to frame. properties

My search here does not show anything useful

Thanks

Re : Where do I find reference to frame. properties

Found some info in the wiki, under windows.

Still missing info on what can be used with frame.xxxx

Re : Where do I find reference to frame. properties

Adding background music that autostarts with application

I am trying to add background music that auto-starts when i run the processing sketch 
i followed a simple instruction online   and i added codes at line 6 , 26, 27,40,46 ,48, and from 75 to 82 
but i keep getting the error  "duplicate field name.player" at line 26 .

that said, can i use any mp3 file by specifying the file or does it have to be at a  specific bitrate ?

here's my code ,what am i doing wrong 

  1. import processing.serial.*;
  2. import processing.opengl.*;

  3. import ddf.minim.*;


  4. Serial serial;
  5. int serialPort = 1;   // << Set this to be the serial port of your Arduino - ie if you have 3 ports : COM1, COM2, COM3 
  6.                       // and your Arduino is on COM2 you should set this to '1' - since the array is 0 based
  7.               
  8. int sen = 3; // sensors
  9. int div = 3; // board sub divisions

  10. Normalize n[] = new Normalize[sen];
  11. MomentumAverage cama[] = new MomentumAverage[sen];
  12. MomentumAverage axyz[] = new MomentumAverage[sen];
  13. float[] nxyz = new float[sen];
  14. int[] ixyz = new int[sen];

  15. float w = 256; // board size
  16. boolean[] flip = {
  17.   false, true, false};
  18.   
  19. AudioPlayer player;
  20. Minim minim;

  21. int player = 0;
  22. boolean moves[][][][];

  23. PFont font;
  24. PImage b;


  25. void setup() {
  26.   size(1026, 770, P3D);
  27.   frameRate(25);
  28.   
  29.   minim = new Minim(this);
  30.   
  31.   // load a file, give the AudioPlayer buffers that are 1024 samples long
  32.   // player = minim.loadFile("groove.mp3");
  33.   
  34.   // load a file, give the AudioPlayer buffers that are 2048 samples long
  35.   player = minim.loadFile("groove.mp3", 2048);
  36.   // play the file
  37.   player.play();
  38.   
  39.   
  40.   b = loadImage("data/3.jpg");
  41.   font = loadFont("TrebuchetMS-Italic-20.vlw");
  42.   textFont(font);
  43.   textMode(SCREEN);
  44.   
  45.   println(Serial.list());
  46.   serial = new Serial(this, Serial.list()[serialPort], 115200);
  47.   
  48.   for(int i = 0; i < sen; i++) {
  49.     n[i] = new Normalize();
  50.     cama[i] = new MomentumAverage(.01);
  51.     axyz[i] = new MomentumAverage(.15);
  52.   }
  53.   
  54.   reset();
  55. }

  56. void draw() {
  57.   background(b);
  58.   
  59.   updateSerial();
  60.   drawBoard();
  61. }

  62. void stop()
  63. {
  64.   
  65.   player.close();
  66.   minim.stop();
  67.   
  68.   super.stop();
  69. }


...........continues 

any form of help would be much appreciated 

Re : Serial readString problem

  1. void serialEvent(Serial s){
  2.   String datastring = s.readString();
  3.   
  4.   if(datastring.contains("data:")){
  5.         print("found data");
  6.   }
  7.   print(datastring);
  8.   print(datastring.length()); 
  9.   datastring=null;
  10. }
This leaves printed in the terminal in the terminal 
  1. some data: dt:19.90 tp:22.0 wa:0
  2. 111111111111111111111111111111111

audio file as input

Hi,
I'm wondering how to use a .wav/mp3 file as an input, for example replacing the mouse input in this example: 
processing-2.0b7\modes\java\examples\Basics\Input\Mouse2D

I could work at 5 fps and sample the amplitude out of the file, left and right channels - I'm not sure what else would be easy to get if anything. Or offline render and use a much higher fps to more accurately track the rhythm of the music.

Thanks!

rendering to video file

Hi,

I am trying to create a "music video" with processing, but my computer can only display this at 7 fps: processing-2.0b7\modes\java\examples\Demos\Performance\CubicGridImmediate

I would like to bump it up to 1280*720 and ~25fps. Since the length of the processing would be finite (determined by length of audio file or set as a constant) I am wondering how to "render"/output to a video format file (mpeg/avi/mov/?).

Thanks!

Re : rendering to video file

Usual way is to save each frame as an image file, then to use the Movie Maker tool (or another external tool, like ffmpeg) to transform this sequence of images to a movie. Audio can be added as well.

problem with minim

Hello! 

I have a problem with minim library, and I' m just on my very first steps on learning it. I use the quickstart guide here: http://code.compartmental.net/tools/minim/quickstart/ , to learn how to play a .wav file. I copy the code, insert a .wav file into my data, and change the word "mysong" to my file's name, just as I do with my images. I have installed and moved the library in the folder of my sketchbook, but when I run the program, it writes an error saying "unexpected char: '\'", and showing the line that I load my file, in yellow. What am I doing wrong? 

I'd be grateful, for any help,  since I am very disappointed from my abilities on processing. :(

P.S. sorry for any language mistake :)

Thanks in advance,
Dora.

Re : problem with minim

"and showing the line that I load my file"
Well, show it yourself, so we can see what was wrong. Perhaps you have put a Windows path in it, or something.

"I have installed and moved the library in the folder of my sketchbook"
Minim is shipped with Processing, so this shouldn't have been necessary, unless you need the latest version.

Re : problem with minim

import ddf.minim.*;

Minim minim;
AudioPlayer song;

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

minim = new Minim(this);

 // below is the problem line
 song = minim.loadFile(“dog.wav”);
song.play();
}

void draw()
{
background(0);
}

void stop()
{
song.close();
minim.stop();

super.stop();
}

This is my code, I have dragged and dropped the dog.wav file, into processing. About the route of the folders, I have the sketchbook on my desktop, which involves the "data" and the "libraries" folders. In the data, folder is the dog.wav file, so I am sure that I did this well. About the "libraries" folder, i followed the instructions, I didn't know it was not necessary.
I am sending an image of the result of my program, hoping it will be helpful. Image may be NSFW.
Clik here to view.

Re : rendering to video file

Good thing it wont be an hour long - is there a nice programmatic way to save each frame as it plays back?

Re : audio file as input

Re : problem with minim

Funny, lot of people do the same error recently. Probably a copy & paste error from some word processor.
Anyway, you have curvy double quotes, instead of the straight one used in programming:
minim.loadFile(dog.wav);
should be:
minim.loadFile("dog.wav");


Re : rendering to video file


Re : problem with minim

oh! I couldn't ever found it! It's just how I read it from the site! Thank you very much! Image may be NSFW.
Clik here to view.

glViewport is acting strange on latest version of processing 2b7 and version in repo

In Processing 1.5 I can do something like this:

  1. void draw() {
  2.   
  3.       gl = ((PGraphicsOpenGL) g).gl; 

  4.       gl.glEnable(gl.GL_SCISSOR_TEST);
  5.       gl.glEnable(gl.GL_BLEND);

  6.       //Render left viewport
  7.       gl.glViewport(0,0,width/2,height);
  8.       gl.glScissor(0,0,width/2,height);
  9.       gl.glClearColor(0.0,1.0,0.0,0.5);
  10.       gl.glClear(gl.GL_COLOR_BUFFER_BIT);

  11.       render1(gl); //set projection + modelview + draw
  12.      
  13.       //Render right viewport    
  14.       gl.glViewport(width/2,0,width/2,height);
  15.       gl.glScissor(width/2,0,width/2,height);
  16.       gl.glClearColor(0.0,0.0,1.0,0.5);
  17.       gl.glClear(gl.GL_COLOR_BUFFER_BIT);

  18.       render2(gl); //set projection + modelview + draw 
  19. }

And it draws my two viewports and scissors correctly. But in the 2.0 betas (I tried b7 and the snapshot from github, the above code (using the GL2 via PGL class) to draw multiple viewports is super weird. It seems to overlay the orignal viewport onto the second one. Anyhow, using a single viewport works fine. But the use of a second viewport causes problems.

Any ideas on how to correctly set up multiple viewports for new versions of Processing?

updatePixels method for Capture object

Hi all,
I am very new to processing and even more to Object Oriented Programming so probably the answer to the question is quite simple but is a conceptual one and I´d better ask.
I am doing some type of research about the video capabilities for computer vision of some processing libraries. I have started with the Core Library (processing.video.*) and after reading the description of the Capture object in the processing.org help here it seemed to me it was not quite powerful because it defines very few methods, to be more specific:
list() 
read() 
available()
start()
stop()
Nevertheless I came across some examples where another method is used: updatePixels() that provides much more options to play with but I am not able to find any information about it. I know it is used (and defined) as a method for the PImage but (and here comes the question) shouldn´t it be defined also under the Capture class?, perhaps I am missing a well documentation of the Capture class where it is defined but I didn´t find it in the web, is there any other methods for this class that I am missing? where can I find them?
Thanks in advance and brgds,

array of audio files - failed

Hi! 

I am trying to create an array of 6 audio files, in order to use them random, when mouse is clicked on an image. Here is code:  

import ddf.minim.*;

Minim minim;

AudioPlayer song1;
AudioPlayer song2;
AudioPlayer song3;
AudioPlayer song4;
AudioPlayer song5;
AudioPlayer song6;
AudioPlayer[] test;

PImage img1;
PImage img2;
PImage img3;
PImage img4;
PImage img5;
PImage img6;
PImage img7;

void setup() {
size(1000,600);
background(169, 244, 120);
minim = new Minim(this);

img1 = loadImage("dog.jpg");
img2 = loadImage("horse.jpg");
img3 = loadImage("frog.jpg");
img4 = loadImage("rooster.jpg");
img5 = loadImage("cat.jpg");
img6 = loadImage("duck.jpg");
img7 = loadImage("ear.jpg");

test = new AudioPlayer[6];
test[0] = Minim.loadFile("dog.wav");
test[1] = Minim.loadFile("horse.wav");
test[2] = Minim.loadFile("frog.wav");
test[3] = Minim.loadFile("rooster.wav");
test[4] = Minim.loadFile("cat.wav");
test[5] = Minim.loadFile("duck.wav");

}

void draw() {
image(img1, 100, 100);
image(img2, 400, 100);
image(img3, 700, 100);
image(img4, 100, 350);
image(img5, 400, 350);
image(img6, 700, 350);
image(img7, 475, 25);

}

void mousePressed(){
if (mouseX > 475 &&
mouseX < 525 &&
mouseY > 25 &&
mouseY < 75) {
int index = int( random(0,5) );
test[index].trigger();
}
}

void stop()
{
song1.close();
minim.stop();

super.stop();
}

As you see, it is a little game, that (so far) when the player clicks on the "ear" image, should hear one random sound of six animals. From all the sites I read to help me understand how to write it, I concluded that this is the best way, although I am always getting an error message saying: "cannot make a static reference to the non-static method loadFile(String) from the type Minim."  I knew that the array was wrong, so i named it "test". Any advice? I've run out of references..! :(

Re : array of audio files - failed

Change this and similar lines from
test[0] = Minim.loadFile("dog.wav");
to
test[0] = minim.loadFile("dog.wav");

In the first Minim is the name of a class so this is called a 'static refrence' in the second line minim is an actual object of type Minin and in this case you should be using the object.

The object was created with this
minim = new Minim(this);

Viewing all 1768 articles
Browse latest View live