Loading...
Logo
Processing Forum
olga075's Profile
9 Posts
5 Responses
0 Followers

Activity Trend

Last 30 days
Show:
Private Message
    Hi! I have a problem with saving frames out of screencapturer. I have set up frameRate to 40 and in srenncapture too but I still get around 11 frames per second (I need not less that 25). How can get more frames? (by the way I have given to processing 8 000 mb of memore in settings)





    // screencapturer
    // info about the library and the link to download http://www.onformative.com/lab/screencapturer/



    import com.onformative.screencapturer.*;
    ScreenCapturer capturer;

    void setup() {
    size(500, 500);
    capturer = new ScreenCapturer(width, height, 30); // 30 = framerate of the capture
      frameRate(40);
    }

    void draw() {
    image(capturer.getImage(), 0, 0);
    //saveFrame("/output/seq-####.tif");

    Hi!
    There are 2 codes, one for TIME DISPLACEMENT another one is for SCREENCAPTURE. I can't mix them so there will be a time displacement for a screencapure video (not for a web camera as it is in the code now). 
    Could you help me with that?


    /**
    * Time Displacement
    * by David Muth
    *
    * Keeps a buffer of video frames in memory and displays pixel rows
    * taken from consecutive frames distributed over the y-axis
    */

    import processing.video.*;

    Capture video;
    int signal = 0;

    //the buffer for storing video frames
    ArrayList frames = new ArrayList();

    void setup() {
    size(640, 480);

    // This the default video input, see the GettingStartedCapture
    // example if it creates an error
    video = new Capture(this, width, height);

    // Start capturing the images from the camera
    video.start();
    }

    void captureEvent(Capture camera) {
    camera.read();

    // Copy the current video frame into an image, so it can be stored in the buffer
    PImage img = createImage(width, height, RGB);
    video.loadPixels();
    arrayCopy(video.pixels, img.pixels);

    frames.add(img);

    // Once there are enough frames, remove the oldest one when adding a new one
    if (frames.size() > height/4) {
    frames.remove(0);
    }
    }

    void draw() {
    // Set the image counter to 0
    int currentImage = 0;

    loadPixels();

    // Begin a loop for displaying pixel rows of 4 pixels height
    for (int y = 0; y < video.height; y+=4) {
    // Go through the frame buffer and pick an image, starting with the oldest one
    if (currentImage < frames.size()) {
    PImage img = (PImage)frames.get(currentImage);

    if (img != null) {
    img.loadPixels();

    // Put 4 rows of pixels on the screen
    for (int x = 0; x < video.width; x++) {
    pixels[x + y * width] = img.pixels[x + y * video.width];
    pixels[x + (y + 1) * width] = img.pixels[x + (y + 1) * video.width];
    pixels[x + (y + 2) * width] = img.pixels[x + (y + 2) * video.width];
    pixels[x + (y + 3) * width] = img.pixels[x + (y + 3) * video.width];
    }
    }

    // Increase the image counter
    currentImage++;

    } else {
    break;
    }
    }

    updatePixels();

    // For recording an image sequence
    if (key == 's') {saveFrame("/output/seq-####.tif");}
    //saveFrame("frame-####.jpg");

    }







    // screencapturer
    // info about the library and the link to download http://www.onformative.com/lab/screencapturer/



    import com.onformative.screencapturer.*;
    ScreenCapturer capturer;

    void setup() {
    size(500, 500);
    capturer = new ScreenCapturer(width, height, 30); // 30 = framerate of the capture
    }

    void draw() {
    image(capturer.getImage(), 0, 0);
    //saveFrame("/output/seq-####.tif");
    }


    Hello!
    This code calculate the average color of the image. I don't understand why I get code 5 error.
    And this error appears in my other programs too. Could you please explain why?

    Precisely it says:
    java.util.prefs.WindowsPreferences <init>
    WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5



    import arb.soundcipher.*;

    SoundCipher sc = new SoundCipher(this);
    PImage img = loadImage("111.jpg");

    int s=img.width*img.height;
    size(img.width, img.height);
    image(img, 0, 0);

    img.loadPixels();

    float[][] pixelss = new float[4][s];
    //
    float SumRed=0;
    float SumGreen=0;
    float SumBlue=0;

    int ij=1;
    for (int i = 0; i < img.width; i++) {
    for (int j = 0; j < img.height; j++) {
    SumRed=SumRed+red(get (i,j));
    SumGreen=SumGreen+green(get (i,j));
    SumBlue=SumBlue+blue(get (i,j));
    ij++;
    // print(red(get (i,j))+" = ");
    }
    }
    //print(SumRed);
    print("red - "+SumRed/s+"; green - "+SumGreen/s+"; blue - "+SumBlue/s);

    fill(SumRed/s,SumGreen/s,SumBlue/s);
    noStroke();
    background(255);
    rect(int(img.width/4),int(img.height/4) , int(img.width/2),int(img.height/2));

    Hi! Cound you please tell what's wrong in this small program?

    I have float variable named "t" and the float array [] pitches. I can't get it why do I get the error "can not convert from float to int"  in the last line?



    int s=100;
    float t;
    float[] pitches= new float[s];

    for (int i = 1; i< s; i++) {
    pitches[i]=random(50, 100);
    }

    for(float i=1; i< s; i++) {
    t=pitches[i];
    }
    Hi,
    Is there a way to play a note according to frequency in Hz? (Like in rotation function you can use radiance or degree)

    My program get frequency numbers and then it suppose to play it with different instruments. But the thing is that different instruments cover different range in Hz, so the same pitch for guitar and for accordion would have different frequency in Hz. So how do I play the frequency with different instruments without calculating the right pitch for every possible instrument? 
    There is midiToFreq function in SoundCipher that transfer Midi number(pitch) to the frequencies. But I need to do it vise-versa (from frequency to pitch). 

    Would appreciate any advice!
    Hello!
    I'm sorry guys this question might seem stupid to you but I can't save the sound out of this program.
    I used SoundCipher to generate random sounds and I need to save around 10 seconds of it in MIDI or wav of mp3, anything)
    I used Minim library to save sound but it's always been some kind of error ((  Could you help, please?




    import arb.soundcipher.*;
    SoundCipher sc = new SoundCipher(this);
    float[] pitches = {50, 25, 55};




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


    }



    void draw() {
    frameRate(9);

    sc.instrument(random(25));
    sc.playChord(pitches, 80, 2);


    sc.playNote(69, 100,1);
    sc.playNote(67, 100,1);
    sc.playNote(65, 100,1);

    }
    Hi!
    I made a program that draw 2 lines and they are not suppose to cross each other, but they do (if you run the program several times you'll see) and when they do it stops and there is a black circle appears))) That's funny, but what I did wrong here? 


    float x1=180;
    float y1=400;
    float x11=220;
    float y11=400;


    void setup() {
    size(400, 400);
    background(200);
    }



    void draw () {
    float x2=x1+random(-10, 10);
    float y2=y1-random(5);
    line(x1, y1, x2, y2);
    x1=x2;
    y1=y2;

    float x22=x11+random(-10,10);
    float y22=y11-random(5);
    line(x11, y11, x22, y22);
    x11=x22;
    y11=y22;

    }
    Hello,
    Is there good tutorials to learn Minim for the last Processing 2.0b8?  

    Is it possible to code a program that makes sounds(regulated with variables) using the minim library?