# "Noise colored TV" style?

**URL:** <https://discourse.processing.org/t/noise-colored-tv-style/36359>\
**Category:** Libraries\
**Created:** [April 15, 2022, 5:48pm UTC](https://discourse.processing.org/t/noise-colored-tv-style/36359 "2022-04-15T17:48:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lorangeverte](https://avatars.discourse-cdn.com/v4/letter/l/67e7ee/32.png) [@Lorangeverte](https://discourse.processing.org/u/Lorangeverte)\
**Post date:** [April 15, 2022, 5:48pm UTC](https://discourse.processing.org/t/noise-colored-tv-style/36359/1 "2022-04-15T17:48:45Z")

</div>

Hello all,

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.

````auto
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!
````

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [April 15, 2022, 6:40pm UTC](https://discourse.processing.org/t/noise-colored-tv-style/36359/2 "2022-04-15T18:40:24Z")

</div>

> [@Lorangeverte](#):
>
> ` pixels[x+y*width] = color(bright1);`

**replace with**

` pixels[x+y*width] = color(random(256),random(256),random(256));`

---

<div class="post-metadata">

**Author:** ![Lorangeverte](https://avatars.discourse-cdn.com/v4/letter/l/67e7ee/32.png) [@Lorangeverte](https://discourse.processing.org/u/Lorangeverte)\
**Post date:** [April 15, 2022, 6:46pm UTC](https://discourse.processing.org/t/noise-colored-tv-style/36359/3 "2022-04-15T18:46:55Z")

</div>

Many thanks, it’s works 🙂

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [April 15, 2022, 10:32pm UTC](https://discourse.processing.org/t/noise-colored-tv-style/36359/4 "2022-04-15T22:32:26Z")

</div>

Hello,

For your example you can update the pixels array in one loop:

```auto
  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:

> **[Welcome to Processing!](https://processing.org/)**
>
> Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts. Since 2001, Processing has promoted software literacy within the visual arts…

References:

- [https://processing.org/reference/pixels.html](https://processing.org/reference/pixels.html)
- [https://processing.org/reference/color\_datatype.html](https://processing.org/reference/color_datatype.html)
- [https://processing.org/reference/random\_.html](https://processing.org/reference/random_.html)
- [https://processing.org/reference/bitwiseOR.html](https://processing.org/reference/bitwiseOR.html)
- [https://processing.org/tutorials/color](https://processing.org/tutorials/color)
- [https://processing.org/tutorials/pixels](https://processing.org/tutorials/pixels)

This will work also:

`int(random(0xFF000000, 0)); //0xFFFFFFFF+1 = 0`

`:)`

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [April 15, 2022, 11:10pm UTC](https://discourse.processing.org/t/noise-colored-tv-style/36359/5 "2022-04-15T23:10:40Z")

</div>

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.

SO TV just show’s white noise

This code like @Chrisir said

```auto

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();
}

```

---

<div class="post-metadata">

**Author:** ![Lorangeverte](https://avatars.discourse-cdn.com/v4/letter/l/67e7ee/32.png) [@Lorangeverte](https://discourse.processing.org/u/Lorangeverte)\
**Post date:** [April 16, 2022, 1:51pm UTC](https://discourse.processing.org/t/noise-colored-tv-style/36359/6 "2022-04-16T13:51:57Z")

</div>

Thanks all, for code and help 🙂
