We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi,
I will soon have to make interactive video. As I know a little bit of Processing language, think I should use it for my project.
I have been searching for inspiration and found one of ideas (that might not be as complex for me as a beginer).
So the main question is this:
Is it possible in Processing to code smth like this:
The main idea is to make some black&white background "come to life" with the sounds. The input sounds make random different blurry color splashes that stays for a while, but doesn't disappear very fast.
Would like to make it a bit complex by having those colorful flashes on top of some video.
Any tuts/videos on mind, where I could learn something similar?
Answers
This is totally doable. For the sound effect, you could use either amplitude over time or frequency over time. The latter requires using FFT function to extract the frequency components of each sound buffer which is concurrently being played.
If you are a beginner, i will stick to the amplitude vs. time concept as it is easier to implement. I dunno how much experience you have in processing. So I encourage you to write your first sketch and demonstrate what can you do and show what parts you require some guidance.
For this project, you need to use:
Check the reference for those key terms and don't forget to check the provided examples accessible through the PDE.
Kf
Huge thanks, kfrajer! Will look up your tips. After a week I will start my project, then will update how it went.
So I tried to stick together two codes - one for webcam input --> black&white output, other from library - the Audio Input, that draws colorful circle depending on the sound input.
Its not the main idea, but I just wanted to sea wether it will work - making something colorful on to an video with the sound. And no surprise, the code didn't work. What should I change? Or isn't it even possible to draw over a video that is capturing at the same time?
So this is it (I bolded the parts of sound input, without them the code is working fine )
import processing.video.*; **import processing.sound.*;
AudioIn input; Amplitude rms; int scale=1;**
color black = color(0); color white = color(255); int numPixels; Capture video;
void setup() { size(640, 480); // Change size to 320 x 240 if too slow at 640 x 480 strokeWeight(5);
// 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();
numPixels = video.width * video.height; noCursor(); smooth();
**// FOR SOUND //Create an Audio input and grab the 1st channel input = new AudioIn(this, 0);
}
void draw() { if (video.available()) { video.read(); video.loadPixels(); int threshold = 120; // Set the threshold value float pixelBrightness; // Declare variable to store a pixel's color // Turn each pixel in the video frame black or white depending on its brightness loadPixels(); for (int i = 0; i < numPixels; i++) { pixelBrightness = brightness(video.pixels[i]); if (pixelBrightness > threshold) { // If the pixel is brighter than the pixels[i] = white; // threshold value, make it white } else { // Otherwise, pixels[i] = black; // make it black } } updatePixels();
**// FOR SOUND // adjust the volume of the audio input input.amp(map(mouseY, 0, height, 0.0, 1.0));
}
edit post, highlight code, press ctrl-o to format.
you cannot have the code looking like code AND parts of the code in bold. however, when it's formatted as code then you can refer to it using the line numbers.
Ha, finally smth is going! Had to study long time to realize that sound library doesn't work, I had to download minim as you said. But yet I haven't figured out how to make those colorful circles. Now I just put the monitoring sound on top of the video to see if it actually works. Somehow the video isn't looping. Even though I take of video.jump. Any advice, examples how to put some colorful low opacity color splashes as making sound into microphone? :)
Please don't post duplicates. Or triplicates.
https://forum.processing.org/two/discussion/24357/is-it-possible-to-adjust-tint-on-a-movie
https://forum.processing.org/two/discussion/17803/how-to-control-tint-of-image-in-processing-with-audio-output-volume
Task 1: Can you draw ellipses on top of your movie and those ellipses to shift from right to left over time?
Task 2: Can you at read the amplitude of the current sound detected by your mic?
Task 3: Can you map this sound amplitude to the height of the screen?
Task 4: Can you generate ellipses every 5 frames (for example) and assign it the current Y position mapped from the detected sound amplitude?
Extra: Paly with the alpha field in color to get some fading effects, or change colors using lerpColor.
Kf
Kf