We are about to switch to a new forum software. Until then we have removed the registration on this forum.
How would I take the average brightness of a video file and whilst its playing back use that brightness level to control another part of the program e.g. the frequency of a sine wave? This is something that I managed to create in Max but I want to recreate it in Processing as I cannot afford to buy max. I know that I would have to add all the values of the pixels and divide by the amount of pixels, but I cannot get it to work. Any help would be greatly appreciated.
Answers
https://forum.Processing.org/two/discussion/15050/errors-when-cycling-through-pixels
post code. without it we can only guess what your problem is.
that said, if you are adding pixel values you have to take into account the format of the pixels, ie 8 bits each of A, R, G and B data. you can't just treat them as a single int as that won't make sense.
read the color tutorials on the processing website.
here is my attempt at the code, i am new to java and processing so excuse any stupid mistakes
ok, the summing looks ok but i see no averaging. and i see you doing nothing with the average.
when i got to this point the application spotted even opening so I didn't add anything else. saying that, here it is with averaging and a sine wave
ok, line 32 is a problem...
it's using the sum of the brightnesses so far.
you only work out the average on line 36 (which you then never use)
you can use the average so far by changing that to
sine.freq(framebright / i);
and it'll change as you progress.also, do yourself a favour and use ctrl-t in the editor to indent the code properly because it's a bit messy at the moment.
sounds bad. but you don't explain the problem any further so...
thank you so much for your help, i'm new to this forum and processing in general and appreciate the help.
I have been out of action the past couple of days and haven't had much progress, this is where I am. When I open the program I here a high pitch beep and then it changes to a low pitch beep that plays indefinatly
println(frameBright); after line 33
what are you expecting?
and what's that on line 26?
i < (width*height/2)-width/2
???ok I have finally got it to work, I had a few days away from it and realised I made some really dumb mistakes! Thanks for your help again