# MinaCoding2023_NewFunctions

# WaveringDotsAround

For the MinaCoding Prompt: **New Function.** I will be coding: **WaveringDotsAround** with **Tixyland & SonicPi. T**he new functions that I have introduced to my workflow are the following:

* ***Math.imul() :*** Returns the result of the 32-bit integer multiplication of x and y.
    
* [***Math.sinh(***](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sinh)***):*** Returns the hyperbolic sine of x.
    
* [**Math.cbrt()**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cbrt)**:** Returns the cube root of x.
    
* [***Math.hypot()***](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/hypot)***:*** Returns the square root of the sum of squares of its arguments.
    
* ***lgamma(x)*** → \[float, -1 or 1\]click to toggle source Calculates the logarithmic gamma of x and the sign of gamma of x. (Ruby)
    
* ***gamma(x)*** *→ Float*\*\*:\*\* Calculates the gamma function of x.
    

## Video

<iframe width="560" height="315" src="https://www.youtube.com/embed/M9fn6bu1eyI"></iframe>

## Design Process

* Used the above-mentioned functions in both the audio and visuals
    
* The dots are overlayed sketches done by [TixyLand](https://tixy.land/)
    
* The sounds are coded in SonicPi using a concept of shadow maths and colour shuffling, where in this case the sounds are made through the values of different reds. As well as their shadow/shuffle counterparts to add variance to the soundscape. So when watching, you are experiencing both red as a colour and a sound. With the addition of new math functions, the shadows have been reimagined
    

## Code

### Tixyland

```javascript
imul(t,y)/(sinh(t/i)+tan(t/y^3)+cos(t/x))/sqrt(i/t) + cbrt(y/t)
```

### SonicPi

```ruby
#Color +Shadows
#RGB Values + XYZ

#Shadeofred [R,G,B, X, Y, Z]

# Crimson : 157,34,53
# Darkred : 139, 0, 0
# Firebrick : 178,34,34

#shadow length equation is Length = height / tan(angle)


#Creating Arrays
Crimson = [157,34,53,30.5810,16.0422,5.7596]
DarkRed = [139,0,0,10.6475,5.4890,0.4983]
FireBrick = [178,34,34,    19.2209,10.7245,2.5704]



with_fx :ixi_techno do
  live_loop :reds do
    i = 0
    
    with_fx :whammy, mix: rrand(0.25,0.7) do
      use_synth :pretty_bell
      play (Crimson[i] + DarkRed[i])/5 ,release: 3
      play Crimson[i] ,release: 3
    end
    
    
    with_fx :ping_pong, mix: rrand(0.3,0.75) do
      use_synth :chiplead
      play (FireBrick[i] + DarkRed[i])/5 ,release: 3, decay: dice(4)
    end
    
    sleep [0.5,1,2].choose
    if i < 7
      i+= 1
    end
  end
end

live_loop :redshuffle do
  
  CrimsonShuffle = Crimson.shuffle()
  DarkRedShuffle = DarkRed.shuffle()
  FireBrickShuffle = FireBrick.shuffle()
  
  i = 0
  
  with_fx :ixi_techno , mix: rrand(0.2,0.5) do
    use_synth :pretty_bell
    play (CrimsonShuffle[i] + DarkRedShuffle[i])/4 ,release: 3
    play Math.lgamma(CrimsonShuffle[i]/5 + 2),release: 3
  end
  
  with_fx :gverb, amp: dice(4), mix: rrand(0.2,0.6) do
    with_fx :ping_pong, mix: rrand(0.3,0.75) do
      use_synth :piano
      play (FireBrickShuffle[i] + DarkRedShuffle[i])/5 ,release: 3, decay: dice(4)
    end
  end
  
  
  sleep [0.5,1,2,Math.cbrt(CrimsonShuffle[i])].choose
  if i < 7
    i+= 1
  end
end


#shadow length component
with_fx :ixi_techno do
  live_loop :redsshadow do
    i = 0
    
    with_fx :pitch_shift, mix: rrand(0.2,0.3) do
      use_synth :piano
      play (Crimson[i]/Math.cbrt(70)).abs + (DarkRed[i]/Math.hypot(70,10)).abs/30  - 15,release: 3, sustain: 8
      sleep [0.25,0.5,1,2,4].choose
    end
    
    
    
    if i < 7
      i+= 1
    end
  end
end
```
