# WCCC_Knotwork

# KnottedTwirls

For this week's Creative Code challenge by @[@sableRaph](@sableRalph)[:](https://hashnode.com/@sableRalph)***"Knot Work",* KnottedTwirls** is coded in ***LiveCodeLab & SonicPi,***

## Knotted Elements

* Shapes are knotted within each other to make the structures seen on the screen
    
* Follows the mathematical knots shape especially the knot for 7
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1718411809849/52c85c0e-c629-4edf-85ba-7bb01fded499.png align="center")

\-[https://en.wikipedia.org/wiki/Knot\_theory#/media/File:Knot\_table.svg](https://en.wikipedia.org/wiki/Knot_theory#/media/File:Knot_table.svg)

## Sound Design

**For the 13th day of #MinaCoding2024 : "Fluid" , *HoneyMerlot*** takes the **Colorscape: \[**[**https://colorscape.illestpreacha.com/dipincode-sonification**\] of turning food into colour then into sound by turning the fluids of](https://colorscape.illestpreacha.com/dipincode-sonification) Honey & Merlot into a sonification. The sounds are supposed to take into the labour that is done to make these fluids.

Link to Audio: [https://blog.illestpreacha.com/mina2024fluidhoney](https://blog.illestpreacha.com/mina2024fluidhoney)

## Poem

```ocaml
Knotted Laces
Knot in Places
Knotting phases
That knot by pacing
And release by spacing
```

## Video - [https://youtu.be/m0Kzni\_r8jU](https://youtu.be/m0Kzni_r8jU)

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

## Code

### LiveCodeLab

```javascript
turns = time % 7  + 4
detail = (time % 33 + 1) * 12
speed = 0.4

simpleGradient maroon,orange,yellow
scale 1 / ( time % 8 + 3)
rotate 15 - (time % 6) ,3 * (time % 4 + 1), 1

time % 5 + 2 times with i
	rotate Math.cbrt(time % 17), 
	time % 3 + 2 times with i
		move i , i , i * 2
			detail times with i
				rotate 0, 0, (2 * pi) / detail
				move tan(time), cos(time), sin(time)
					rotate (turns * i * pi) / detail + (time * speed), 0, 0
					if time % 30 < 10
						animationStyle motionBlur 
						fill red
						stroke black
							peg 0.25, Math.sqrt(Math.cbrt(0.25 * i)), 0.25
					else if time % 30 > 20
							rect 0.25, Math.sqrt(Math.cbrt(0.25 * i)), 0.25
					else
						fill red
						stroke white
						box 0.25, Math.sqrt(Math.cbrt(0.25 * i)), 0.25
```

### SonicPi

```ruby
#reading of the DipInCodeFirstService
#for csvs larger than 10 mbs use the for reach


require 'csv'

#naming the Dataset DipInCode and going to read the file
Dip = CSV.parse(File.read("C:/Colorscape/DipInCode/SonicPi_CodeBase/Model/DipInCode_FirstService.csv"), headers: true)

#Getting the Ingredients
Honey = Dip[3]
Merlot = Dip[24]

#Dip[foodname][column].to_f , need to.f as it is to float

if Time.now.to_i % 2 == 0


  with_fx :vowel do
    live_loop :Merlot1 do
      use_random_seed Time.now.to_i / 2
      use_bpm Merlot["Red"].to_f
      sample :sn_dub, rate: dice(Merlot["Yellow"].to_f/Merlot["Key"].to_f)  if spread(Merlot["Blue%"].to_f,Merlot["Green%"].to_f).tick
      sample :ambi_dark_woosh,rate: rrand(Merlot["y2"].to_f,Merlot["Red"].to_f/Merlot["Blue"].to_f)  if spread(Merlot["H-Lab1"].to_f,Merlot["CIE-L"].to_f).reverse.mirror
      sleep [Merlot["x2"].to_f,Merlot["Yellow"].to_f/Merlot["Mangeta"].to_f,Merlot["Saturation2"].to_f/Merlot["Lightness"].to_f].choose
    end
  end

  with_fx :ixi_techno do
    live_loop :Honey do
      use_random_seed Time.now.to_i
      use_bpm Honey["Red"].to_f
      with_fx :reverb do
        sample [:perc_bell,:elec_bell,:loop_electric].choose, rate: rrand(Honey["y2"].to_f,Merlot["Red"].to_f/Merlot["Blue"].to_f) if spread(Merlot["H-Lab1"].to_f,Merlot["CIE-L"].to_f).reverse.mirror
        sleep [Honey["Red%"].to_f,Honey["Green%"].to_f/Honey["Red%"].to_f].choose
      end
    end
  end
end

if Time.now.to_i % 3 == 0

  with_fx :gverb do
    live_loop :Merlot3 do
      use_random_seed Time.now.to_i / 4
      use_bpm Merlot["Green"].to_f
      sample :elec_blip, rate: dice(Merlot["Yellow"].to_f/Merlot["Key"].to_f)  if spread(Merlot["Blue%"].to_f,Merlot["Green%"].to_f).tick
      sample :ambi_dark_woosh,rate: rrand(Honey["y2"].to_f,Merlot["Red"].to_f/Merlot["Blue"].to_f)  if spread(Merlot["H-Lab1"].to_f,Merlot["CIE-L"].to_f).reverse.mirror
      sleep [Merlot["x2"].to_f,Merlot["Yellow"].to_f/Merlot["Mangeta"].to_f,Merlot["Saturation2"].to_f/Merlot["Lightness"].to_f].choose
    end
  end

  with_fx :distortion do
    live_loop :Honey2 do
      use_random_seed Time.now.to_i / 5
      use_bpm Honey["Red"].to_f
      with_fx :reverb do
        sample [:drum_bass_soft,:elec_chime,:glitch_robot,:perc_snap2,:perc_till].choose, rate: rrand(Honey["y2"].to_f,Merlot["Red"].to_f/Merlot["Blue"].to_f) if spread(Merlot["H-Lab1"].to_f,Merlot["CIE-L"].to_f).reverse.mirror
        sleep [Merlot["x2"].to_f,Merlot["Green%"].to_f/Merlot["Blue%"].to_f].choose
      end
    end
  end
end
```
