This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#################################################################### | |
######################## CODE SECTION 1 ############################ | |
#################################################################### | |
# where we define all of our musical patterns | |
# drum patterns | |
hhpat1 = (bools 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1) | |
snpat1 = (bools 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0) | |
bdpat1 = (bools 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define :beat_1 do | |
in_thread do | |
16.times do | |
sample :drum_cymbal_closed if (bools 1, 1, 1, 0, 1, 0, 1, 1).tick(:beat1) | |
sleep 0.25 | |
end | |
end | |
end | |
define :mel_1 do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use_synth :tb303 | |
fitted_duration = 4 | |
my_mel = ((scale :a3, :minor) + (knit :a2, 8)).repeat.shuffle | |
my_alt_mel = ((scale :e3, :minor) + (knit :e2, 8)).mirror.shuffle | |
my_current_mel = my_mel | |
quantity_of_notes = my_current_mel.length |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Michael Jackson’s Billie Jean basic percussion part in Sonic Pi | |
100.times do | |
sample :drum_cymbal_closed | |
sample :drum_bass_hard | |
sleep 0.25 | |
sample :drum_cymbal_closed | |
sleep 0.25 | |
sample :drum_cymbal_closed | |
sample :drum_snare_hard | |
sleep 0.25 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# column 1 (hihat cymbal and bass drum play simultaneously and rest for 0.25 seconds) | |
sample :drum_cymbal_closed | |
sample :drum_bass_hard | |
sleep 0.25 | |
# column 2 (hihat cymbal plays and thens rests for 0.25 seconds) | |
sample :drum_cymbal_closed | |
sleep 0.25 | |
# column 3 (hihat cymbal and snare drum play simultaneously and rest for 0.25 seconds) | |
sample :drum_cymbal_closed | |
sample :drum_snare_hard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Columns (time): 1, 2, 3, 4 | |
Hi-hat cymbal: x, x, x, x | |
Snare drum: o, o, x, o | |
Bass drum: x, o, o, o | |
#(“x” means that the percussion event sounded, while “o” means it rested) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sample_groups.each do |g| (sample_names g).each do |n| sample n, sustain: 0, release: 4 end end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##| generate percussion patterns using bools | |
snpat = (bools 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0) | |
bdpat = (bools 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0) | |
##| generate melody using scale (and injecting rests) | |
use_random_seed 16 | |
mlpat = ((scale :e4, :minor) + (knit :r, 3)).shuffle.take(16) | |
##| generate bass line using chord (and injecting 1 rest) | |
use_random_seed 1234 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SonicPi::Core::RingVector | |
#datramt's Ring Chains | |
def shuffle_times(x) | |
res = self | |
x.times do | |
res = self.shuffle | |
end | |
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# STRATEGIES FOR GENERATING MELODIES & BASS LINES | |
# scale pattern | |
##| my_mel = (scale :e, :minor) # returns a ring | |
# adding rings together will "concatenate" the lists | |
##| my_mel = (scale :e, :minor) + (ring :r, :r, :r, :r, :r, :r, :r, :r) | |
# call the "shuffle" method to scramble the scale and mix in rests | |
##| my_mel = ((scale :e, :minor) + (ring :r, :r, :r, :r, :r, :r, :r, :r)).shuffle |
NewerOlder