Hi, I'm Sunk! I like to make noise and I code

Hello everyone.

I go by “Sunk” for music/sound stuff. I am a professional creative technologist at MIT. I have seen Sonic Pi around while tinkering with Raspberry Pis and then an intro course was announced on BlueSky, so I took the course.

I make guitar pedals for funsies and I code.

I’m only one day in using the software, but I like where this is going.

Here is my first “song” where I create a BOSS HM-2 workalike and a simple auto-stomp bypass to see how hard it crushes.

Looking forward to exploring more circuits and sounds.

## make it easy to swap samples

## sample  :bd_haus - only here for the as-you-type context menu

loop = :loop_amen
loop2 = :bass_dnb_f
hit = :bd_haus

## beat stretch/release length

length = 2


## "knobs"

low = 15  ## assumes the db is true and 15 means +15db, like the HM-2
high = 15
gain = 0.99 ## the HM-2 is known for its "high gain" so we max it out, however, we also cascade gain like the HM-2 does

## preset "gyrator" frequencies

## lows
lowf = 41 ## ~82 hz

## the highs are actually 2 narrow band freqencies controlled at once and are upper-mids, not treble
highf1 = 81.5 ##~900hz
highf2 = 88 ##~1300hz

## you can perform a popular "mids" mod by simply messing with these parameters
## when set to -15 you get a "deep scooped low mids" sound, up and you get overly boomy bass
scoop = -15
scoopf = 57 ## knock out low mids ~220hz, making for a more modern sound

## clipping filters
hpf = 43 # ~100hz, standard "tight" guitar pedal input HPF
lpf = 119 # ~5.5khz, removes a lot of the fuzzies in the treble frequencies

## auto bypass switch
switcharoo = 0

live_loop :drone do
  ## if the switch is "on" then make it metal
  if switcharoo == 1
    
    ## the drummer has a heavy foot on the 1
    sample hit, amp: 1
    
    ## This is a mid scoop control, a dip in low midrange frequencies is often added to these types of pedals
    with_fx :band_eq, res: 0.1, freq: scoopf, db: scoop do
      
      ## this is the low-pass filter that knocks out harsh frequencies
      with_fx :lpf, cutoff: lpf, mix: 1 do
        
        ##this is the "low" filter
        with_fx :band_eq, res: 0.5, freq: lowf, db: low, mix: 1 do
          
          ## this is the "high" filter dual gyrator emulation
          with_fx :band_eq, res: 0.9, freq: highf1, db: high * 0.5, mix: 1 do
            with_fx :band_eq, res: 0.9, freq: highf2, db: high * 0.5, mix: 1 do
              
              ## cascading gain stages with simulated feedback loops
              
              with_fx :distortion, distort: gain * 0.9, amp: 0.25, mix: 0.5 do
                with_fx :distortion, distort: gain * 0.66, amp: 0.66, mix: 0.25 do
                  with_fx :distortion, distort: gain * 0.66, amp: 0.66, mix: 0.25 do
                    
                    ## this is the initial high-pass filter to get low frequencies out of the signal
                    ## we mix a little bass back in because analog cannot really knock it out all the way
                    with_fx :hpf, cutoff: hpf, mix: 0.25 do
                      
                      ## play the samples and boost them into the circuit
                      sample loop2, beat_stretch: length * 0.66, amp: 3, attack: 0.3 ## pseudo side-chain attack
                      sample loop, beat_stretch: length, amp: 3, attack: 0.3 ## pseudo side-chain attack
                      
                      ## not the band Sleep, but close
                      sleep length
                      
                    end
                  end
                end
              end
            end
          end
        end
      end
    end
    
    ## turn off the "pedal"
    switcharoo = 0
    
  else
    
    ## set the pedal to turn on next time
    switcharoo = 1
    
    ## this is my "clean" tone
    sample loop, beat_stretch: length, amp: 1
    sample loop2, beat_stretch: length * 0.33, amp: 1
    sleep length / 2
    sample loop2, beat_stretch: length * 0.33, amp: 1
    sleep length / 2
    
  end
end