Spanish Trap #2

Check out @mrbombmusic’s trap rhythms:

youtu.be/y-KPSGTKUeg

6 Likes

Sounds pretty good!!

Awesome!!! Here’s a function I made for trap hats.

use_bpm 42
define :trap_hats do |smp, div, s_rate, e_rate|
  use_sample_defaults sustain: 0.015, release: 0.015
  rate_div = (s_rate - e_rate) / div.to_f
  div.times do
    sample smp, sustain: 0.02, amp: rrand(0.5, 0.9), rate: s_rate
    sleep 0.5/div
    s_rate = s_rate - rate_div
  end
end

live_loop :drums do
  sample :bd_fat
  sleep 0.5
  sample :sn_dolf
  sleep 0.5
end

live_loop :hats do
  trap_hats(:drum_cymbal_closed, [1, 2, 3, 4, 6, 8, 12, 16].choose, rrand(0.7, 1.3), rrand(0.7, 1.3))
end
1 Like

@kniknoo - lovely stuff!

One tip is to use with_* methods over use_* equivalents in functions. That way you can easily re-use them without them modifying the rest of the music.

The use_* fns will modify the settings in the current thread. If called within a function, these modifications will persist after the function body has completed. Therefore, any future call to sample after trap_hats has been called will have the modified defaults (short sustain and release times).

The with_* fns only modify the settings for the supplied do/end block. This means that the previous settings will be restored and unmodified.

In the case of your code, it’s only a simple change:

use_bpm 42
define :trap_hats do |smp, div, s_rate, e_rate|
  with_sample_defaults sustain: 0.015, release: 0.015 do
    rate_div = (s_rate - e_rate) / div.to_f
    div.times do
      sample smp, sustain: 0.02, amp: rrand(0.5, 0.9), rate: s_rate
      sleep 0.5/div
      s_rate = s_rate - rate_div
    end
  end
end

live_loop :drums do
  sample :bd_fat
  sleep 0.5
  sample :sn_dolf
  sleep 0.5
end

live_loop :hats do
  trap_hats(:drum_cymbal_closed, [1, 2, 3, 4, 6, 8, 12, 16].choose, rrand(0.7, 1.3), rrand(0.7, 1.3))
end
3 Likes

Wow, thank you! That had eluded me completely.

2 Likes

I’d like to say I knew that, but being honest, I didn’t, I just
use with_* because everyone else does… :slight_smile:
Eli…

Also… I have no idea where this came from… its not my normal
soulful sound…

@samaaron How do I make use of this trap hat code for imported samples? I can’t seem to figure it out.

You can just put the file path for the imported sample into a variable name at the top of your code and then put that variable as the first argument when you call the trap_hats function.

If your sample is coming from a multiple sample directory, you would to provide both the file directory and the number file it is in the directory.

Obviously you will need to replace the file directory for this code to work.

#Variable name for imported sample directory and number file in the directory
hat = "/Users/admin/Music/SAmples/808_drum_kit/hihats/", 20

use_bpm 42
define :trap_hats do |smp, div, s_rate, e_rate| #This function is written for the first argument to be the sample used
  with_sample_defaults sustain: 0.015, release: 0.015 do
    rate_div = (s_rate - e_rate) / div.to_f
    div.times do
      sample smp, sustain: 0.02, amp: rrand(0.5, 0.9), rate: s_rate
      sleep 0.5/div
      s_rate = s_rate - rate_div
    end
  end
end

live_loop :drums do
  sample :bd_fat
  sleep 0.5
  sample :sn_dolf
  sleep 0.5
end

#See the 'hat' variable entered as the first argument in the function
live_loop :hats do
  trap_hats(hat, [1, 2, 3, 4, 6, 8, 12, 16].choose, rrand(0.7, 1.3), rrand(0.7, 1.3))
end

Okay perfect I got it working now, thank you!

1 Like

I look forward to hearing how you use it. I’m about to use mine for the first time in front of people next weekend, I’ll share the tune soon.

1 Like

Awesome! Yeah I’m getting ready to perform some shows here in Japan but I have to build up a set list. I’ve been resampling a lot of my old songs and putting them into Sonic Pi so I can chop and arrange them on the fly.

I ended up doubling up the trap beat so it alternates between 2 samples. I made a basic song. I can share soon once I get time to record it. I think it still needs bass and I have to practice my buildups.

1 Like

@kniknoo

Here’s a quick loop I exported from the project I’m using the trap hat code for. The song is far from complete and still needs structure. I’ll upload a proper video when I’m finished.

Sakura Loop

*I also noticed some other people have embedded audio clips in the forum. How do I do that?

1 Like

Hi Knik,

If you use Soundcloud, you simply copy the URL of the song over into
the editor…

Something like:
https://soundcloud.com/just-eli-139271289/tearsintherain

If you use Dropbox, right click the track in Dropbox and then
‘Copy Dropbox link’ and paste into the editor… make sure you
change the dl=0 to dl=1 to allow playing in the editor…

Something like:
https://www.dropbox.com/s/xhz05qmczw74n2p/sad_anime_one_final.wav?dl=1

Eli…

1 Like

Heh… if you replace the sample with SP’s cowbell, its a giggle.

Eli,

@Eli It’s not enough cowbell…

There is never enough cowbell.