# WCCC_Draggable

# DraggableBuilds

For this week's Creative Code challenge by @sableRaph:***"Draggable”,* DraggableBuilds** is coded in ***Desmos, ChuCk, LiveCodingYoutube,SonicPi & Hydra***

## Draggable Design

Using draggable sliders in ***Desmos*** allowed the 3d mathematical equations to take life in the sketch. Which were later remixed, ***altered & layered*** through in ***Hydra & LiveCodingYoutube***

For the audio, a previous coded composition in ***ChuCK*** was remixed in ***SonicPi***. To fit the theme of draggable, there was an inclusion of the functions: *beat\_stretch & rate* to **"drag"** the sounds around

ChuCK: [https://chuck.cs.princeton.edu/webchuck/](https://chuck.cs.princeton.edu/webchuck/)

Desmos: [https://www.desmos.com/](https://www.desmos.com/)

## Poetry

```ocaml
Draggable entities
Emerging quickly
Deflecting swiftly
As they weave
As they cross
At corners, they floss
In the middle, they breathe
Draggable entities
Flexible mentalities
Choosing and deuceing
Moving, infusing and producing
```

%[https://youtu.be/nl2V8ypStVI] 

## Code

### Desmos Equations

Link : [https://www.desmos.com/3d/xx87q8wsov](https://www.desmos.com/3d/xx87q8wsov)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1721571478177/5a8e2e38-ee39-4d31-bf7a-d2d5fb3f6928.png align="center")

### LiveCodingYoutube

```javascript
drags = '5jXSHDxG614'
//drags = '-hkIN5pWV5Y'

create(1,3,drags)

speed([0,2],2)
speed(1,-2)

play(all)

create(1,3,drags)

speed([0,2],2)
speed(1,-2)

play(all)
```

### Hydra

```javascript

s0.initScreen()

src(s0).colorama(()=> (time %20)/30 + 0.5).out()
```

### ChuCK (Audio)

```haskell
SinOsc s => dac;
Phasor p => dac;
500::ms => dur tempo;

// PhoneDial.ck , a retake of a tutorial of https://github.com/bonniee/chuck-workshop/blob/gh-pages/code/pitchdrop.ck
//Transform the sounds into more of a rapid Phone Dialing with Interference
Phasor osc => Envelope e1 =>  dac; //envelopes are transitional, output to speakers
SinOsc sin => Envelope e2 =>  dac;
50::ms => dur delay; //setting the duration to 50 millisecond

while(true) //loop forever
{
    
tempo => now;
Math.random2(50,2000) => s.freq;
    
tempo / 100 => now;

slower();
}


fun void slower()
{
2*tempo => now;
Std.rand2f(30.0,1000.0) => p.freq;   
    
}

//Phone Call Element 
fun void PhoneCall()
{

for (200 => int i; i > 40; i--)
{
Math.random2(1,15) => float vol1;
Math.random2(3,11) => float vol2;
    
  osc.freq(i);
  osc.gain(vol1); // setting the first volume
  <<<vol1>>>; // printing volume 
    
delay => now; //time being used discretely
    
 //changing the frequency and gain of the sound
 sin.freq(200-i);
 sin.gain(vol2); 
 <<<vol2>>>; 
  
  e1.keyOn();
  Math.random2(100,175)::ms => now; //wait between 100 & 175 ms
  e1.keyOff();
  Math.random2(40,80)::ms => now; //wait between 40 & 80 ms
    
  e2.keyOn();
  Math.random2(100,175)::ms => now; //wait between 100 & 175 ms
  e2.keyOff();
  Math.random2(40,80)::ms => now; //wait between 40 & 80 ms  
}
}
2::second => now;

 PhoneCall();
```

### SonicPi (Audio)

```ruby
live_loop :rollback2 do
  #making true random as it goes with the actual time
  #then using the Math.cbrt to make it a different seed ratio then the above function
  use_random_seed Math.cbrt(Time.now.to_i)
  use_bpm 30
  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:/Creatuve Code Challenges/Draggable/7d4fd925-a091-494d-b090-06ec44b2d03f.wav",beat_stretch: dice(12) * 3, rate: Math.sqrt(dice(25) + 1)/3
      sleep [8,16,32].choose
    end
  end
  sleep [0.5,1,2].choose
end
```
