newbie on Processing, I check this code on the web and I would to know how could I make a “random colored noise as TV style” ? Not just black an white pixels, but random colored pixels.
import com.hamoid.*;
void setup()
{
size(1000, 500);
background(152,190,100);
frameRate(60);
}
void draw()
{
loadPixels();
for(int x = 0; x<width; x++)
{
for(int y =0; y<height; y++)
{
float bright1 = random(255);
pixels[x+y*width] = color(bright1);
}
}
updatePixels();
}```
Thank you for your help!
For your example you can update the pixels array in one loop:
for(int i = 0; i<pixels.length; i++)
{
//fast and may reach 60 fps
pixels[i] = int(random(0x00FFFFFF+1)) | 0xFF000000; // 0xFF000000 to OxFFFFFFFF
//slow and may not reach 60 fps
//pixels[i] = color(random(256), random(256), random(256));
}
As a newbie I encourage you to peruse the tutorials, references and examples here:
Hi @Lorangeverte and welcome
This is short idea about TV
White noise is only white and earned the name because it is white
The source of the white noise in analogue televisions is the local oscillator signal that mixes with the received signal. There is no color noise
In the past, the color signal carrier used several systems, such as PAL, SECAM, etc. The color system on the TV does not work unless it receives a color signals containing RGB data.
void setup() {
size(500, 400);
}
void draw() {
loadPixels();
for (int i = 0; i < pixels.length; i = i+25) {
int j = int (random (pixels.length ));
float R = random(255);
float G = random (255);
float B = random (255);
// pixels[j] = color( random(255));
pixels[j] = color( R,G,B);
}
updatePixels();
}