Noise

   Noise in general is an undesirable [1]signal that's mixed in with useful
   signal and which we usually try to filter out, even though it can also be
   useful, especially e.g. in [2]procedural generation. Typical example of
   noise is flickering or static in video and audio signals, but it can also
   take a form of e.g. random errors in transferred texts, irrelevant links
   in web search results or imperfections in measuring of economic data. In
   measurements we often talk about [3]signal to noise ratio (SNR) -- the
   ratio that tells us how much noise there is in our data. While in
   engineering and scientific measurements noise is almost always something
   that's burdening us (e.g. [4]cosmic microwave background, the noise left
   over from the [5]Big Bang, may interfere with our radio communication), in
   some fields such as [6]computer graphics (and other computer [7]art) or
   [8]cryptography we sometimes try to purposefully generate artificial noise
   -- e.g. in [9]procedural generation noise is used to generate naturally
   looking terrain, clouds, textures etc.

 ##### ####   # ## ####   # # # #  ## ### #   ## #
 #  ####  ### # # ### # # ###    ##  #   # ##
 #  ##  ##  #######    #   ## #  # ## ##    # # ##
  #  # # ##  ## # ###     #   # # # ##    # ## #
     # # ### #  ####      ## #    ### #   #  ######
 # ## #    # ## #######    # #        #    # # #  #
 # #     ##   # ## ## #  #  # ###    # # # ##     #
    #    ## ##### ## # # #  ## ##### ##### ## #####
   #   # #### # # #  #   ##       #    # ##  #####
 #   ## # ## ##     ####     #     ##  ##    # ##
 #### ####  #  ##    # ##  #    ##  ##  # ### ###
   #  #   #    # #  ####  #  #   # ## ### ## #   #
    #  # # # #  ##  ##  #    #   # # #### #### # ##
 ## ## #  #    ## ## ##   #      ###   #   # #
  # #  ##   ### #  ####  # # ## # #    # #   ##  #
  ##  # # # # # # # # # ### #####   ## ##   #######
 ### ##   ## ## ##  #### # # ## ## ####### ### #
 # # ##    # # #  ##  #  # #   #  ####  # ### #   #
      # ### #### ###  # #  ## # ###   # #   ##  ##
 #  #    #####    #     ##      ## ### #  ###  ##
   ## ## ## ## ### #      ### #    #   #### #####
  #  ##     # ####  #   #     #    ## ##   ###  # #
    #  ###    ###   ### # # # # ##  ##  # #  #  #
      #  #####  #  #####  ### ###  # #    ## ### #
  #  # ### #####    #  #   #  # ##   ######## ###

   2D binary white noise

Artificial Noise

   In [10]computer science, especially e.g. in [11]computer graphics or audio
   generation, we often want to generate artificial noise that looks like
   real noise, in order to be able to generate data that look like real world
   data. Noise may serve as a basis (first step, random initial state) for
   generating something or it may be used to distort or modulate other data,
   for example when drawing geometrical shapes we may want them to look as if
   written by hand in which case we want to make them imperfect, add a bit of
   noise to an otherwise perfect shape a computer would create. Adding noise
   can help make rendered pictures look more natural, it can help us model
   human speech that arises from noise created by our vocal cords, it can
   help AI train itself to filter out real life noise etc.

   Normally we don't want our noise to be completely [12]random but rather
   [13]pseudorandom so that our programs stay [14]deterministic. Imagine for
   example we are generating terrain [15]heightmap based on a 2D noise -- if
   such function was truly random, the terrain in a certain place would be
   different every time we returned to that place again, but if the noise is
   pseudorandom ([16]seeded by the position coordinates), the terrain
   generated at any given coordinate will be always the same.

   There are different types of noise characterized by their properties such
   as number of dimensions, [17]frequencies they contain, [18]probability
   distribution of the values they contain etc. Basic division of noises may
   be this:

     * by type/[19]algorithm:
          * value noises: The simplest type of noise, it arises by generating
            a (pseudo)random value at each node of the spatial grid. Values
            in between grid nodes are obtained by [20]interpolation.
          * gradient noises: More sophisticated than value noise, rather than
            a simple value it generates a [21]gradient at each grid point.
            Specific algorithms/types of gradient noise are:
               * [22]Perlin noise: One of the most common and basic gradient
                 noises, which however suffers from some [23]artifacts.
               * [24]simplex noise: A more sophisticated noise than Perlin
                 noise, improves some of its properties, works with a
                 [25]simplex lattice of points rather than orthogonal grid.
               * ...
          * spectral noises: Noises that are generated in the [26]spectral
            domain (see [27]Fourier transform):
               * [28]anisotropic noise: Noise that has a specific
                 orientation, can be used e.g. for water waves that go in one
                 direction.
               * ...
          * [29]convolution noises: Noises that use [30]convolution of given
            kernel with some simpler noise to create a larger texture.
               * [31]Gabor noise
               * ...
          * other:
               * [32]Voronoi noise: Noise that looks like a "honeycomb" or
                 structures created by living cells, it is created by
                 generating random point coordinates and then assigning each
                 space point (e.g. each pixel) a [33]distance to its closest
                 point. Different random [34]point sampling methods or
                 distance functions can help change the look of the noise.
                 Worley Noise is one type of Voronoi noise.
               * Combinations and modifications of standard noises: we may
                 e.g. blend or [35]modulate two noise functions to create a
                 new complex type of noise.
               * [36]midpoint displacement/[37]diamond square: Relatively
                 simple [38]algorithms for generating [39]fractal heightmaps,
                 working on the principle of repeatedly subdividing a line
                 (or in higher dimensions a square, cube etc.) and
                 (pseudo)randomly displacing the generated point.
               * [40]wavelet noise: Noise further improving some
                 characteristics of Perlin noise.
               * unorthodox noises created e.g. by [41]cellular automata, AI
                 etc.
               * ...
     * by frequencies:
          * [42]fractal noise: Very important type of noise that similarly to
            [43]fractals is composed of differently scaled versions of itself
            -- this noise looks like (and can be used to simulate) clouds,
            mountains and other structures found in nature. It is created by
            taking some basic noise function (e.g. Perlin noise or simplex
            noise) and overlaying (adding) multiple versions of it that
            differ by frequency and amplitude (just as e.g. mountains are
            composed of big and tall hills that have on them progressively
            smaller and less tall hills up to the microscopic level). These
            different individual layers are called octaves: ith octave has
            the amplitude p^i (where p is a constant from 0 to 1 called a
            persistence) and frequency of 2^i.
          * [44]white noise: Noise containing "same amount of all
            frequencies" -- this is basically the simplest kind of noise we
            get when we generate a sequence of independent ([45]uncorrelated)
            (pseudo)random numbers with uniform probability distribution.
          * [46]pink noise: Energy density of frequencies decreases
            proportionally with 1/frequency, i.e. it basically has strong
            high frequencies and weak low frequencies.
          * [47]blue noise
          * ...
     * by other properties:
          * symmetry/invariance and other function properties: A noise may or
            may not be invariant against various operations such as shifting,
            rotation or scaling, i.e. when we apply this operation it will
            look basically the same. For example Perlin noise outputs value 0
            at each grid point and is non-zero only between the grid point,
            so it is NOT invariant towards shifting. Noise functions are just
            mathematical [48]functions, so we may examine noises just as we
            examine functions (they may be continuous, bounded etc.).
          * explicit vs implicit: Values of an implicit noise can relatively
            simply and quickly be computed at any given point in space
            whereas explicit noises require processing as a whole and
            therefore storage of the whole generated noise in memory.
          * tiling: Similarly to [49]procedural [50]textures, a noise
            generated by an algorithm may be tiling, i.e. not having visible
            seams when repeated in certain dimensions.
          * ...

            ..----.. 
         .''        ''. 
     ..''              '.                      .....
 ''''                    '                 ..''     '''--..   
                          '.            .''                ''..   
                            '.       ..'                       '''    
                              ''...''                          

                              octave1
                                 +
        ....                                    ...
 ..--'''    ''.        ..'''...              .''   ''-..    ..--''
               ''---'''        '''''---...-''           ''''

                              octave2
                                 +

 ''-....----'''-...-'''-...-'''''''-----...-'''--..-'''-....---'''

                              octave3
                                 =
            ..
         .''  '.      
       -'       ''.-'-. 
 ... ..                '                      -'''--...
    '                   ''                   '         .      
                          '-.              -'           -.. ..  .'  
                             -.          -'                '  ''     
                               '...-.--''                       
                                  
                            fractal noise



   1D fractal noise composed of 3 octaves

Code

   A super simple "poor man's noise" that can be of use sometimes is coin
   flip noise which works simply like this: start with value 0, in each step
   output current value and randomly change it by +1 or -1. It's basically a
   [51]random walk, a next best thing to the simplest [52]white noise, so
   watch out, it will only work for most basic things, generalizing to a 2D
   noise will be awkward, you won't know how high or low the values will
   actually go, also the frequency properties probably won't be ideal. { Not
   sure actually what spectrum to expect, have to check that out, TODO.
   ~drummyfish } You may at least try to play around with changing the value
   even by more than one using e.g. [53]normal probability distribution.

   TODO: code for the above, maybe even a one liner for white noise

   TODO: actual Perlin noise etc., also some nice noise that's just adding
   some random sine waves in a fractal fashion, like a one line formula

Links:
1. signal.md
2. procgen.md
3. snr.md
4. cmb.md
5. big_bang.md
6. graphics.md
7. art.md
8. cryptography.md
9. procgen.md
10. compsci.md
11. graphics.md
12. randomness.md
13. pseudorandomness.md
14. determinism.md
15. heightmap.md
16. seed.md
17. frequency.md
18. probability.md
19. algorithm.md
20. interpolation.md
21. gradient.md
22. perlin_noise.md
23. artifact.md
24. simplex_noise.md
25. simplex.md
26. spectrum.md
27. fourier_transform.md
28. anisotropic_noise.md
29. convolution.md
30. convolution.md
31. gabor_noise.md
32. voronoi.md
33. distance.md
34. point_sampling.md
35. modulation.md
36. midpoint_displacement.md
37. diamond_square.md
38. algorithm.md
39. fractal.md
40. wavelet_noise.md
41. cellular_automaton.md
42. fractal_noise.md
43. fractal.md
44. white_noise
45. correlation.md
46. pink_noise.md
47. blue_noise.md
48. function.md
49. procgen.md
50. texture.md
51. random_walk.md
52. white_noise.md
53. normal_distribution.md