# CodeJourney_NoiseJam3

# DotsToNoise

For **NoiseJam3, *DotsToNoise*** is an *Audio Reactive* sketch that blends various concepts of noise **(Audio, Visual and Textual)**.

Using audio from ***SonicPi & Strudel*** to provide an ambience when the mouse is clicked. While P5.js blends text, the noisy visuals obscure it, leaving the user to decipher what it is that they are reading.

## Game Link

[https://illestpreacha.itch.io/dotstonoise](https://illestpreacha.itch.io/dotstonoise)

## Video

%[https://youtu.be/MaXADC-f724] 

## Code

### p5js

```javascript
let song,song2;


function setup() {
  createCanvas(800, 800);

  listColor = ["red", "orange", "blue", "white", "black", "yellow", "green",'navy','aqua','teal','lime','gold'];
  

  
 // listColor3 = ['black','white','grey','blue','maroon','brown','lime']
  
  
    song = loadSound('NoisySounds.mp3');
    song2 = loadSound('NoisySounds3.mp3');
}

function draw() {
  
    background(220);
  
    frameRate(((second() % 8) + 3) * 2);

  
word_1 = [
    "fleet",
    "cheat",
    "complete",
    "defeat",
    "feat",
    "sheet",
    "streets",
    "conceit",
    "feet",
    "treat",
    "beat",
    "repeat",
    "drumbeat",
    "excrete",
    "athlete",
    "backseat",
  ];

  rhymes = shuffle(word_1);


  shuff(rhymes[0], 0);
  shuff(rhymes[1], 1);
  shuff(rhymes[2], 2);
  shuff(rhymes[3], 3);
  shuff(rhymes[3], 4);
  shuff(rhymes[2], 5);
  shuff(rhymes[1], 6);
  shuff(rhymes[0], 7);
  
  
  for (let i = 0; i < 800; i = i + 16) {
    for (let j = 0; j < 800; j = j + 16) {
      
      y = shuffle(listColor);
      z = shuffle(listColor);
      a = shuffle(listColor);
    
      if (second() % 15 < 5) strokeWeight(random(6, 12));
        stroke(y[i % 12]);
      if (second() % 15 > 10) strokeWeight(random(10, 15));
        stroke(z[j % 12]);
      
      if (second() % 15 < 10 && second() % 15 > 5) 
        strokeWeight(random(14, 27));
        stroke(a[i % 12]);
      
      point(i - random(-2,2), j + random(3,5));
    }
  }

  if (second() % 8 > 6)
    filter(DILATE);
 if (second() % 6 < 2)
    filter(BLUR, 3);
}

function shuff(x, y) {
  
  textAlign(CENTER);
  textSize(height / 9);
  
  // turn the tring into a char array and then shuffled back into a string

  mixed_str = x.split("");
  word = shuffle(mixed_str);
  flipped = word.join("");

  if (flipped == x) {
    fill("red");
  }
  //this checks if the first 3 letters of the flipped and orginal matches
  else if (flipped.substring(0, 2) == x.substring(0, 3)) {
    fill("green");
  }
  //checking if the word ends with t
  else if (flipped.endsWith("t")) {
    fill("blue");
  } else {
    fill("black");
  }
  text(flipped, width / 2, height / 6 + y * (height / 9));
}

function mousePressed()
{
  
  if (second() % 16 > 8) {
   if (song.isPlaying()) {
    // .isPlaying() returns a boolean
    song.stop();
  } else {
    song.play();
  }
  } else {
    if (song2.isPlaying()) {
    // .isPlaying() returns a boolean
    song2.stop();
  } else {
    song2.play();
  }
}
}

```

### SonicPi - Audio

```ruby
live_loop :swsh do
  use_bpm 4
  use_random_seed Time.now.to_i / 5
  with_fx :ping_pong, mix: (dice(8) + 1)/9 do
    with_fx :echo, decay: dice(6) do
      use_bpm [160,320].choose
      sample [:guit_em9,:ambi_piano].choose, rate: [-1,1,0.5,1.2].tick, beat_stretch: dice(4) + 34
      sleep [20,40,60].choose
    end
  end
end


live_loop :beat do
  use_bpm 2
  use_random_seed Time.now.to_i / 4
  with_fx :whammy,mix: [0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1].tick do
    sample :guit_e_slide, rate: 0.5, attack: dice(4), decay: dice(2),beat_stretch: [4,12,24,36].choose
    sleep [4,12,40].choose
  end
end


live_loop :beat1 do
  use_bpm 5
  use_random_seed Time.now.to_i / 4
  with_fx :whammy,mix: [0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1].tick do
    sample :ambi_piano, attack: dice(4), decay: dice(2),beat_stretch: [8,16,32].choose, amp: 1
    
    sleep [0.5,1,2,4,8,12].choose
  end
end

```

### Strudel - Audio

```javascript
setcpm(17.5)

$: sound("cp*3 rim*2 rim cp/3 hh*3 bd [- sn:2 tb:3 hh*2]*3 rim cb*2").room("<0 .2 .4 .6 .8 .6 .4 .2 .1>")
  .phaser("<4 3 2 1 2 3 4>").gain(perlin.range(.1, .9)).jux(rev).speed("0.5 1 2 2 2.5 1.2 0.3 1 1 1").color("cyan red aqua white black white white blue orange purple")._spectrum()

$:sound("piano agogo:3 piano/2 xylophone_soft_ff:4").room(.5).adsr("[.1 0 .3]:.3:[1 0]").scale("C7:minor E5:major A4:major A2:major").release("<.7 .9 .1 .2>").sound("gm_xylophone").room(.5).phaser("<4 3 2 1 2 3 4>").color("cyan red orange purple")._pianoroll()._punchcard()


$:s("bd [~ bd/2 rim] rim,casio rhythmace_sd:2 gm_electric_guitar_clean bd bd").scale("E:minor C:minor").coarse("<1 3 4 8 6 12>") .phaser("<4 3 2 1 2 3 4>").gain(perlin.range(.1, .9)).speed("1 2 -2 3 4 1 -2 -2")._punchcard().color("cyan orange blue violet green lime red yellow aqua")._spectrum()
```
