Created
June 25, 2019 16:57
-
-
Save bytezen/e0bd801128b44202377b9c627d5423d1 to your computer and use it in GitHub Desktop.
ncgs part 2 making a bass line
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
##| part2-ncgs-bass.rb | |
##| The bass will set the rhythm and get | |
##| folks nodding their heads | |
##| make sure your tempo is the same as | |
##| whatever you chose for your drums | |
use_bpm 60 | |
##| 1) Playing notes | |
##| There is another way to play sounds with | |
##| Sonic Pi: the play command. | |
##| Play around with the command and see if | |
##| you can figure out how it works. | |
##| ----------------------------------------- | |
play 60 | |
##| 2) Choosing sounds | |
##| Sonic Pi comes with different synthesizers | |
##| These synths generate tones that sound VERY | |
##| different. Explore some of the different | |
##| synth sounds by moving the folling line of | |
##| code to line 9 | |
##| ----------------------------------------- | |
use_synth :beep #beep is the default | |
##| 3) Note Length | |
##| We can use the sleep command that we used | |
##| in the drum section to create different | |
##| note durations. We are using a convention | |
##| 1 beat = 1 quarter note. | |
##| So if we 'sleep 1' then we are playing a quarter | |
##| Sleeping for half of a beat or, sleep 0.5, is | |
##| sleeping for half of a quarter note. This would be an | |
##| eigth note. Half of that, sleep 0.25, would a sixteenth note | |
##| and so on | |
##| ----------------------------------------- | |
comment do | |
play 57 | |
sleep 1 | |
play 59 | |
sleep 0.5 | |
play 60 | |
sleep 0.125 | |
play 60 | |
sleep 0.125 | |
play 60 | |
sleep 0.125 | |
play 60 | |
sleep 0.125 | |
play 67 | |
sleep 0.5 | |
play 64 | |
sleep 0.5 | |
play 60 | |
sleep 1 | |
end | |
##| 4) Building a Bass Line | |
##| Now we are going to put some notes together to create a simple bass line | |
##| For the bass line we need notes and a duration to play the notes | |
##| to make it easier to groove I am going to introduce some concepts | |
##| that will make it much easier for you to experiment with ideas | |
##| ----------------------------------------- | |
##| Notes: | |
##| Let's make a list of the notes that we want to play. Then we will use | |
##| Sonic Pi's metronome to step through the list and play the corresponding | |
##| note at that position in the list. Below is the list from the example above: | |
bass_line = ring 57, 59, 60, 60, 60, 60, 67, 64, 60 | |
##| Easy. It's just the numbers that we used separated by a comma | |
##| Now do the same things for the durations | |
durations = ring 1, 0.5, 0.125, 0.125, 0.125, 0.125, 0.5, 0.5, 1 | |
##| Question: Can you guess the total duration? Were you right? What is the total? Can you | |
##| explain why? | |
##| Before moving on, let's make another change. Let's use short hand note names | |
##| instead of those numbers. Remember 1 = quarter note, 0.5 = eight, etc. Here is the | |
##| shorthand that we will use: | |
##| qt = quarter | |
##| et = eight | |
##| st = sixteenth | |
##| ts = thirty-second | |
##| Substituting our code into the durations the list now reads: | |
qt = 1 | |
et = 0.5 | |
st = 0.25 | |
ts = 0.125 | |
durations = ring qt, et, ts, ts, ts, ts, et, et, qt | |
##| You can think of this as we are telling the bass player, 'Play a | |
##| quarter note, an eight note, then rattle off 4 32nds, and then bring | |
##| it on home with a couple of eights and a quarter...ya dig?' | |
##| Great. Now how do we use this? Run the following code and I will step through it | |
##| during the workshop. You can also look up the commands in the help by clicking on the | |
##| term and then pressing [control + i]. If you do that then you will see the term and its | |
##| definition appear in the window below the Buffer. | |
uncomment do | |
live_loop :bass_line do | |
# make the metronome tick once; | |
# use its value to find the note in the bass_line | |
play bass_line[ tick ] | |
# LOOK at the metronome value and use its value | |
# use its value to find the duration to sleep in the durations list | |
sleep durations[ look ] | |
end | |
end | |
##| 4) Compose a bass line | |
##| Use your chosen synth, notes, and sleep patterns | |
##| to create a bass line. | |
##| For starters try to keep the bass line to | |
##| 4 bars (total of sleep time = ??) | |
##| ----------------------------------------- | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment