Skip to main content

Command Palette

Search for a command to run...

Mathober2025_MinorSawTooth

Musical Scaling

Updated
1 min read
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

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

IllestPreacha · SawToothNoise

Code

#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

Mathober2025

Part 16 of 31

Explorations during Mathober2025

Up next

Mathober2025_Central

More Raccoons