New to Sonic pi so every little helps

Hey

Im looking to make rap, trap, grime, drill lofi and afrobeats type music. So far i’ve gone through the tutorials and have got a grasp of a lot of the language.

I guess I want to know if there are any resources out or if you have any advice to get me going in the right direction.

Cheers

3 Likes

Hi @Dwardz,

welcome to the Sonic Pi Community!

Some of us have collections of snippets, scripts and sounds online (e. g. David Fiddle’s or mine, much smaller, collection). I’d recommend also to browse through this forum … Hope that helps.

Let us know here as soon as you built something!

2 Likes

Hi @Dwardz,

Ive played a bit with making some simple trap beats in Sonic Pi.
Here’s a playlist of s few of them: https://www.youtube.com/playlist?list=PLIsdHp2z9wFmJAp-CXuqZ_YDBR9P6doc4

My methods have evolved from some of the code featured in those beats.

One tip I can give in regards to making hi hats is to utilize the density function. You can check it out in the Lang section of the help window.

Basically it will subdivide the sleep value in the number you give as an argument and play the sound that many times in the duration of the sleep value.

``````#Plays sample 2 times in one beat
density 2 do
sample :drum_cymbal_closed
sleep 1
end
#Plays sample 4 times in one beat
density 4 do
sample :drum_cymbal_closed
sleep 1
end
#Plays sample 8 times in one beat
density 8 do
sample :drum_cymbal_closed
sleep 1
end
#Plays sample 16 times in one beat
density 16 do
sample :drum_cymbal_closed
sleep 1
end
``````

To simplify the code in a live loop, you can put the different density values into a ring and tick through it.

``````live_loop :hats do
density (ring, 2, 4, 8, 16).tick do #cycles thru playing sample 2, 4, 8 and 16 times per beat
sample :drum_cymbal_closed
sleep 1
end
end
``````

I like to make a function for these types of hi hats so I can make it look more simple inside of the live loop

``````define :hats do |d|
density d do
sample :drum_cymbal_closed
sleep 1
end
end

live_loop :trapHats do
hats(ring, 4, 4, 3, 8, 4, 6, 4, 16).tick
end
``````

Here’s quick example of using it with a kick and snare(although I would def use my own drum sound samples)

``````define :hats do |d|
density d do
sample :drum_cymbal_closed
sleep 1
end
end

live_loop :trapHats do
hats(ring, 4, 4, 3, 8, 4, 6, 4, 16).tick
end

n = [1, 0, 1, 0, 2, 0, 0, 0, 1, 1, 0, 1, 2, 0, 1, 0]
live_loop :trapBeat do
n.each.with_index do |i|
sample :bd_haus if i == 1
sample :drum_snare_hard if i == 2
sleep 0.25
end
end
``````

Good luck! Hope this is helpful. Would love to see what you come up with.

4 Likes

Thanks @Martin I’ll experiment and see what I can come up with

Hi MrB,

Thats such a neat little beat generator I had to play.

I dont know if ‘trap’ allows silences, but I modded it to
do so, and it works well for my tastes in music.

Eli…

``````use_bpm 100

notes = [ [:C2, :Ef3,:C4], [:Af2, :Ef3, :Af3,:C4],[:F2, :F3, :Af3,:C4],[:C2, :G3,:C4],
[:G2, :D3, :G3,:B3],[:C2, :Ef3, :G3,:C4] ,[:Af2, :F3, :B3,:Df4],[:C2, :G3,:C4],
[:G2, :F3, :B3,:D4],[:F2, :F3, :Af3,:Df4],[:C2, :Ef3, :Af3,:C4],[:C2, :G3,:C4]].ring

beats = [1, 0, 1, 0, 2, 0, 0, 0, 1, 1, 0, 1, 2, 0, 1, 0]

define :hatter do |d|
if d == :r then
sleep 1
else
density d do
sample :drum_cymbal_closed
sleep 1
end
end
end

live_loop :Hats do
#hatter(ring, 4, 4, 3, 8,:r,:r, 4, 6, 4, 16,:r,:r).tick
hatter(ring, 1,1,2,1,1,4,:r,:r).tick
end

live_loop :Beat do
beats.each.with_index do |i|
sample :bd_haus if i == 1
sample :drum_snare_hard if i == 2
sleep 0.25
end
end

live_loop :Piano do
use_synth :piano
3.times do
play notes.tick ,decay: 2 ,hard: 0.3

sleep 2
end
play notes.tick ,decay: 4 ,hard: 0.4
sleep 4
end

live_loop :Background do
notes = (ring :d3) + (scale :d4, :minor, num_octaves: 2).shuffle
s = synth :supersaw, note: :e5, sustain: 4, note_slide: 0.1, amp: 0.2

control s, note: notes.tick, note_slide: (line 0, 0.1, steps: 2).look
sleep (ring 1, 1, 1, 1, 0.5, 0.5, 1, 2).look
#sleep (ring 1,1,2).look
end

``````
2 Likes