# Genuary2024_Flocking

# NoisyTales

The prompt for **Genuary 2024 Day19 is Flocking** and for this, I used an audio library called **FlockingJs** alongside **SonicPi** for the composition

## Poem

```ocaml
The noise
The tunes
The rhythm
As it reaches the rooms
Hidden
To find its voice
```

## Audio

<iframe width="100%" height="300" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/1731387918&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true"></iframe>

[IllestPreacha](https://soundcloud.com/llestreacha) · [NoisyTales](https://soundcloud.com/llestreacha/noisytales1)

## Code

### FlockingJs

```javascript

flock.synth({
    synthDef: {
        ugen: "flock.ugen.lfNoise",
freq: 150, //switched between 150, 300, 900
        mult: {
            id: "env",
            ugen: "flock.ugen.asr",
            attack: 0.25,
            sustain: 1.0,
            release: 0.5
        },

        sub: {
            ugen:"flock.ugen.mouse.cursor",

           options: {
               freq: 350,
                axis: 3 * ("height" / "width"),
                interpolation: "exponential",
                target: ".CodeMirror"
    }
        },
    	add: {
            ugen: "flock.ugen.asr",
            attack: 0.25,
            sustain: 0.25,
            release: 0.5,
            gate: {
                ugen: "flock.ugen.mouse.click"
            }

            }
    }
    
});
```

### SonicPi

```ruby

live_loop :noisytale1 do
  #making true random as it goes with the actual time
  
  use_random_seed Time.now.to_i
  use_bpm [90,45,15].choose
  puts Time.now.to_i
  with_fx [:echo,:whammy,:ixi_techno].choose, mix: rrand(0.1,0.6) do
    with_fx :ping_pong, mix: rrand(0.1,0.9) do
      sample"E:/Genuary/genuary2024/Day 19 - Flocking/NoisyTales_Pre.WAV",rate: Math.sqrt(dice(25) + 1)/3
      sleep [15,30,45,7.5].choose
    end
  end
  sleep [0.5,1,2].choose
end
```

```ruby
live_loop :noisytale2 do
  
  use_bpm 45
  
  use_random_seed Time.now.to_i
  
  with_fx :whammy, mix: rrand(0.4,0.7) do
    with_fx [:wobble,:ping_pong].choose, mix: rrand(0.2,0.6) do
      sample :bd_gas, rate: 0.5, decay: 3.5, amp: dice(4)
      sample "E:/Genuary/genuary2024/Day 19 - Flocking/NoisyTales_Pre.WAV", rate: 0.5, decay: 3.5,sustain: 7, amp: dice(4)
      sleep [0.5,2,4,8].choose
    end
  end
end
```
