# Lesson 3 # In this lesson, you will write code to create # half steps and whole steps. You will also # practice debugging: fixing lines of code that # have mistakes in them. # General Instructions: # # This lesson contains three examples and four # exercises (A, B, C, D). # # To listen to an example, change "comment" # to "uncomment" on the "comment do" line, # then click the "Run" menu command at the # top of the Sonic Pi editor window. # When you are done with the example, turn # it off by changing "uncomment" back to # "comment," and move on to the next section # of the lesson. # # Half Steps: On a piano keyboard, a half step # is the distance between any two adjacent notes. # For example: # white-white (B->C, E->F) # white-black (C->C#) # black-white (G#-A) # In Sonic Pi, a half step is the distance # between any two adjacent note numbers, or two # adjacent letter names. # Example 1: comment do play 60 sleep 0.5 play 61 # play up one half step sleep 0.5 play 60 # play down one half step end # Example 2: comment do play :C4 sleep 0.5 play :Cs4 # play up one half step sleep 0.5 play :C4 # play down one half step end # Exercise A - copy and paste Example 1 code # into the space below this paragraph. Change # the code so that the pattern continues # to move up in half steps, starting # on note 60 and ending on note 72. # Exercise B - copy and paste Example 2 code # into the space below this paragraph. Change # the code so that the pattern moves down # in half steps, starting with :C5 and ending # on :C4. # Whole Steps. Whole steps are = two half steps. # In Sonic Pi, a series of whole steps can be # written as a series of odd numbers or a series # of even numbers. Whole steps can also be # written as letter names two half steps apart. # Example 3 - whole steps: comment do play :C4 sleep 1 play :D4 sleep 1 play :E4 sleep 1 play :Fs4 sleep 1 play :Gs4 sleep 1 play :As4 sleep 1 play :C5 end # Exercise C - change the letter names in # Example 3 to numbers, without changing the # sounding pitches. The first letter name # (:C4) = 60. Your code should be written # as a series of ______ numbers (odd/even?) # and the resulting sound should be an ascending # whole-tone scale (series of whole steps # going up). # Exercise D - Debugging. The following sample # code has some errors in it. Find and correct # all of the errors. Do you recognize the tune # (after fixing the errors)? comment do use_bpm100 play:E4 slleep 1 play :D4 sleep 1 play C4 sleepp 1 play :D4 sleep 1/2 play :E4 sleep 1 play :E4 leep 1 play :E4 sleep 2 end