Skip to content

Instantly share code, notes, and snippets.

@czue
Created January 3, 2020 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save czue/13232d575595c1516ce41d2424de88d9 to your computer and use it in GitHub Desktop.
Save czue/13232d575595c1516ce41d2424de88d9 to your computer and use it in GitHub Desktop.
SonicPi code for the first few bars of Ratatat's El Pico
use_bpm 95
# main guitar riff
mini_riff_1 = [:b4, :e4, :g4, :b4]
mini_riff_2 = [:g4, :b3, :e4, :g4]
mini_riff_3 = [:a4, :c4, :gb4, :a4]
mini_riff_4 = [:gb4, :b3, :d4, :gb4]
mini_riff_5 = [:c5, :gb4, :a4, :c5]
main_riff_1 = mini_riff_1 + mini_riff_2 + mini_riff_3 + mini_riff_4
main_riff_2 = mini_riff_1 + mini_riff_5 + mini_riff_1 + mini_riff_3
main_riff = main_riff_1 + main_riff_2
main_riff_synth_opts = {
release: 0.8,
amp: 0.8,
}
main_riff_synth = :saw
define :play_main_riff do
use_synth main_riff_synth
play_pattern_timed main_riff, [0.50], main_riff_synth_opts
end
# initial bassline
subtle_bassline = [:e3, :g3, :a3, :e3, :d3, :g3, :d3].ring
subtle_bassline_synth_opts = {
sustain: 1.0,
release: 1.0,
amp: 1,
}
subtle_bassline_synth = :fm
define :play_background_bass do
use_synth subtle_bassline_synth
play subtle_bassline.tick, sustain: 3.75, release: 0.5
sleep 4
6.times do
play subtle_bassline.tick, sustain: 1.75, release: 0.5
sleep 2
end
end
# main bassline
main_bassline = [
:e3, :c4, :b3, :c4, :b3, :b3, :d3].ring
main_bassline_synth = :fm
define :play_main_bass do
use_synth main_bassline_synth
play :e3, sustain: 2.25, release: 0.5
sleep 2.5
play :c4
sleep 0.5
play :b3
sleep 0.25
play :c4
sleep 0.25
play :b3
sleep 0.5
play :a3, sustain: 1.25, release: 0.5
sleep 1.5
play :a3
sleep 0.5
play :b3, sustain: 1.75, release: 0.5
sleep 2
# second half
play :e3, sustain: 1.25, release: 0.5
sleep 1.5
play :e3
sleep 0.5
play :gb3, sustain: 1.25, release: 0.5
sleep 1.5
play :gb3
sleep 0.5
play :g3, sustain: 1.25, release: 0.5
sleep 1.5
play :g3
sleep 0.5
play :d3, sustain: 1.25, release: 0.5
sleep 1.5
play :d3
sleep 0.5
end
# initial claps
clap_synth = :cnoise
clap_synth_opts = {
release: 0.08,
amp: 0.3,
}
define :play_clap do
use_synth clap_synth
play 50, clap_synth_opts
sleep 0.25
end
define :play_three_claps do
3.times do
play_clap
end
sleep 0.25
end
define :play_two_claps do
2.times do
play_clap
end
sleep 0.5
end
define :four_bars_claps do
3.times do
play_three_claps
end
play_two_claps
end
define :intro_claps do
# first claps are weird because they're missing a beat
2.times do
play_clap
end
sleep 0.25
2.times do
play_three_claps
end
play_two_claps
4.times do
play_three_claps
end
four_bars_claps
four_bars_claps
sleep 0.25
end
# drums (second verse onwards)
define :play_drums do
2.times do
sample :drum_bass_hard, amp: 2
sleep 0.25
end
sleep 0.5
use_synth :cnoise
play 50, release: 0.3
sleep 0.75
play 50, release: 0.3
sleep 0.25
sample :drum_bass_hard
sleep 0.25
play 50, release: 0.3
sleep 0.25
sample :drum_bass_hard
sleep 0.5
play 50, release: 0.3
sleep 0.75
play 50, release: 0.3
sleep 0.25
end
# actual song starts here
in_thread(name: :main_riff) do
2.times do
play_main_riff
end
end
in_thread(name: :initial_bassline) do
play_background_bass
play_main_bass
end
in_thread(name: :initial_claps) do
2.times do
intro_claps
end
end
in_thread(name: :drums, delay: 16) do
4.times do
play_drums
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment