Breakcore Code Share

Hello! It’s been a while since I shared anything. I made this song just about a year ago, right before I started spending more time on Sonic Pi using MIDI. I’ve recently come back to the synth/sample stuff I was working on to render it out in multiple tracks and mix it in Ardour.

This is more or less all Sonic Pi with some EQ and wave edit cleanup, the one exception being a different Amen sample. I was looking at the sample that comes with Sonic Pi and noticed that it’s clipped, and while there may be some tradition to a highly overdriven version, I wanted a clean Amen so that the bit crusher posed an even greater contrast to the cleaner break.

So I went to my trusty massive stash of old school breaks and sought out the Winstons. There are some differences between the original full Amen and the one most commonly used in music production. First thing is that the original version starts with a note stab, so most versions use the second measure twice to start out. Also it’s been typically quantized to make it friendlier to note choppers. That would be Detrimental to the likes of Tom Jenkinson, but the average human does better with some quantization. I used Ardour and split the beats by hand, shrinking by overlap, but stretching up to 10% on short hits when absolutely necessary. So it’s not a sample perfect recreation, but at most it phases beside the original. Only the most hardcore junglist tweaker should be able to hear the quantization difference when used for DnB tempos or above. Also, because the hats are a lot quieter than the kick and snare, I gave it a little bit of compression. If I give it enough to sound the right volume in the chopper, it’s sounds unnatural as a loop, so I compromised in the middle. Compress it another 3-6 dB to taste if you like, as I have provided this sample along with the Recording of the song. You can find both here. https://drive.google.com/open?id=15xvyJEdbut-DYOkTMKn4mn_g-hwtj5G8

It wouldn’t be sonic pi if I didn’t share the code. Right now I want to just focus on sharing the drum code with y’all and let you try whatever you like with it. Once I get my album out (I’m in the recording and mixing stage), I will release full, annotated source to accompany it with a link back to Sonic Pi and this community.

use_bpm 100
use_random_seed 12345

#If you want to use the sample I provided, fill this in and uncomment, otherwise ignore

#amen = " ---path to sample--- /loop_amen_full_Quant_Mono.wav"

live_loop :amen_break do
  
  #First we set up the sample and bit rate for the bitcrusher with CD quality settings
  #Once we hit tick 256 in the pattern, the drums start to go crazy,choosing a random
  #sample rate noticeably under CD quality, and occasional drops in the bit rate
  #The drums end at half CD settings, 22.05k and 8 bits. This is really the heart of the drums.
  #This is how I commonly set up different sections of songs
  
  sr = 44100
  sr = rrand_i(100, 40000) if tick > 256
  sr = 22050 if look > 900
  bit = 16
  bit = [2, 4, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16].choose if look > 256
  bit = 8 if look > 900
  with_fx :bitcrusher, sample_rate: sr, bits: bit, mix: 0.75, pre_amp: 1.5, amp: 0.75, pre_mix: 1 do
    
    #This is a different "sample rate", the rate parameter of the sample.
    #During the wild part, it will play the sample backwards half the time.
    
    s_rate = 1
    s_rate = [-1, 1].choose if look > 275
    s_rate = 1 if look > 700
    
    #This is where we quickly make it sound different
    
    use_sample_defaults beat_stretch: 8, num_slices: 32, release: 0.25,
      sustain: 0.125, sustain_level: 0.65, rate: s_rate, amp: 0.75,
      attack: 0.005, decay: 0.05, decay_level: 0.65
    
    #Finally done with setup and ready to play a sample. I put the array in-line here because
    #I want it to progress along the tick alternating the "even" slices, with a randomly
    #selected "odd" slice repeated a number of times. Picking out the evens and odds works
    #out great. Because of the Amen pattern itself, this will give occasional variations
    #on an alternating kick and snare.
    
    sample :loop_amen_full, slice: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30].ring.tick
   
    #If using the sample I provided, replace the above with this
    #sample amen, slice: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30].ring.tick
    
    #I believe when I made this r stood for repeated. For lack of a better name I'll leave it
    #I set them up here because I want the same cut to repeat itself in the loop below.
    #Yes, using range would be way more efficient, but I didn't think about that then.
    
    r = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]
    sleep 0.25
    
    #This is where we simulate the complex time signatures of breakcore. This is a variation
    #on a technique I use at low speed to generate a pseudo-random series of time signatures.
    
    (line, 2, 6).choose.times do
      
      #This will occasionally skip a hit once in the repeated pattern during the wild part of the song
      
      skip_hit = false
      skip_hit = one_in(13) if look > 375
      skip_hit = false if look > 570
      
      #The slight and random beat stretch provided the tone that felt right to me
      #as well as humanizing the output a bit so it doesn't sound too robotic.
      
      sample :loop_amen_full, slice: r.choose, beat_stretch: rrand(8.05, 8.1) unless skip_hit
      
      #If using the sample I provided, replace the above with
      #sample amen, slice: r.choose, beat_stretch: rrand(8.05, 8.1) unless skip_hit
      
      sleep 0.25
    end
  end
end

…And yes it’s so intentionally a Venetian Snares style homage that I accidentally call it Detrimentalist sometimes :smiley: Hope someone finds this useful!

5 Likes

So, I really like this idea, because it allows me to shape noise in really cool ways!

x = sl + "DonkeyKong64.wav"

use_bpm 100
use_random_seed 89746

live_loop :amen_break do
  
  
  bit = [16, 4, 8, 8, 8, 16, 16, 8, 16, 8, 16, 4, 9].choose if look > 256
 
    sample x, slice: [0, 2, 29, 6, 8, 0, 12, 14, 8, 18, 20, 12, 24, 20, 28, 0].ring.tick
    
    r = [8, 3, 0.2, 7, 0.5, 11, 0.8, 8, 17, 19, 21, 8, 25, 7, 29, 11]
    sleep 0.25

All I did is set the sample to my own side file, and made some random numbers up, and it makes a cool little beat. I can see myself using this in a noise beat sometime soon

Didn’t post the whole code, just the bits I changed.

1 Like