# Mathober2025_MinorSawTooth

# SawToothNoise

For my 16th sketch of Mathober2025 coded in ***SonicPi,* SawToothNoise** takes the 21st Prompt of **“Sawtooth”** & 30th Prompt of **“Minor”** and uses it to code and manipulate the audio through a minor scale and having sawtooth adjust the rate.

## Poetry

```ocaml
Even Though the sound is in stereo
The relationship of the lines go
From most to least
But doesnt mean
That this scene
Ends with an ease
Audio
```

## Audio

<iframe width="100%" height="300" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/soundcloud%253Atracks%253A2189438287&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) · [SawToothNoise](https://soundcloud.com/llestreacha/sawtoothnoise)

## Code

```ruby
#sawtooth
def sawtooth(x)
  (x % 1.0) * 2.0 - 1.0
end

#possible ranges
def range1(num)
  use_random_seed Time.now.to_i / 4
  y = rrand(0,num) + 0.0001 #to avoid zero
  puts y
  return y
end

#sound mixing
def sawwing(x,x2,looping,sample1,sample2)
  
  use_random_seed Time.now.to_i / 3
  phase1 = sawtooth(x)
  phase2 = sawtooth(x2)
  
  
  live_loop looping do
    sample sample1, rate: phase1
    sample sample2, rate: phase2
    sleep [0.5,1,2].choose
    
    puts phase1
    puts phase2
  end
  
end

live_loop :repeat do
  use_random_seed Time.now.to_i / 2
  sawwing(range1(40),range1(35),:sawwmix,:elec_beep,:perc_snap2)
  sawwing(range1(rrand(0,30)),range1(rrand(10,35)),:sawwmix2,:tabla_ghe2,:perc_till)
  sleep [2,4].choose
end

#minor scale
live_loop :noise2 do
  use_random_seed Time.now.to_i / 2
  with_fx [:ixi_techno,:flanger].choose, mix: 0.95, phase: 2 do
    with_fx :distortion, distort: rrand(0.2,0.7) do
      with_synth :piano do
        notes = (scale :e7, :minor_pentatonic, num_octaves: 3)
        play notes.choose, release: dice(6), cutoff: 90, amp: 4, pitch: dice(2), pan: rrand(-0.5,0.5)
        sleep [0.5,0.25,1].choose
      end
    end
  end
end

```
