2. 2/32
N
Who are we ?
D
A
Y
3
CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
3. •A Philosophy of Music Education:Bennett
Reimer
Music allows humans to encode, refine,
reflect, and sharenon-verbal thought in a
dynamic moving systemthat changesover
time.
3/32
Why Music and Programming?
D
A
Y
3
CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
4. •Online Programming and Music Mixing Workstation
•Used at GeorgiaTech to teach Digital Music Mixing.
•Tool for Programming
•Free!
•Web based
9/32
What is EarSketch?
D
A
Y
3
CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
6. 14/32
Go to“http://earsketch.gatech.edu/earsketch2"
and login with your EarSketch account name
and password.
MakingaccountonEarSketch
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 14/36CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
7. 15/32
To listen to music examples, use the sound
browser to the left and click on the play icon.
You can browse the music clips using the
Genres and Artists buttons.
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 15/36CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
9. Essential Elements wewilluse inPython:
● Comments
# This is a comment – meant for Humans
● Includes – loading preset methods ordata
from earsketch import *
● Functions– telling the computer “what to do”
fitMedia(drums, 1, 1, 5)
● Variables and data types – Namesfor information
stored by program
Beat1 = “0+++0+++0+0+0+++”
● Tabs:Enclosecode in sections
● Lists:Groups variables into one datastructure
17/32
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 17/36CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
10. 18/32
SetupSection
● The import statement
sets up the basic EarSketch commands to
be used.
● is a function with no parameter, that
creates a new project in reaper.
● is the function to establish the
tempo for the project by setting the
parameter to number of the beats per
minute.
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 18/36CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
11. DefiningVariables
19/32
We will now define three variables for
drums, lead, and bass: (You may pick
three sounds for yourself. Try to select a
drum part, melody, and bass)
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 19/36CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
12. 20/32
● We will use fitMedia() to place the variables on tracks. Type the
following to begin placing music on track one. In this example we:
a. Locate ‘drums’ on track 1
b. Start the ‘drums’ at measure 1
c. End ‘drums’ at measure 9
● The function can take a number of values that are called
parameters. Parameters provide a way to customize a function in
order to make it do what you want.
fitMedia()Function
fitMedia(file, track, start, end)
Location of
Media
Sound
Which Track
in Reaper Start
measure.
End
measure.
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 20/36CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
14. 22/32
● We will now create a contrasting section of music from measures
9 to 17. Add a new comment and then select 3 or 4 more music
samples:
DefiningVariablesfotMusicSectionB
● Use fitMedia() calls for Section B from measure 9 to 17.
● Click on Run to listen to your music.
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 22/36CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
15. 23/32
Timetogetrandom
● One way that programming shines is being able to include
randomness into projects, meaning that the music will be different
every time the script runs.
is a simple variable that is being assigned the output from a new function
.
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 23/36CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
16. 24/32
Looping
For instance, let’s say that we want to insert a single, four measure
long clip of music onto a particular track three times.
● Looping can include multiple executions of some section of code
At first, you might approach this situation this way:
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 24/36CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
17. 25/32
Looping
● The variable is is the index variable for the loop. As the loop
iterates, or executes the statements inside the loop, will be
assigned numbers from 1 through 12.
● The function can have either two or three parameters,
• The first parameter indicates the starting point.
• The second parameter is for ending the loop.
• The third parameter tells the loop how much to increment the index
variable every iteration.
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 25/36CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
18. For Loops: Skip Counting
fillDrum = HIP_HOP_SYNTHDRUMS2_2M
for measure in range(1, 9, 2):
fitMedia(fillDrum, 1, measure, measure +1 )
measure is the “index variable” = assigned values from the
range()
(1, 9, 2) means start counting at 1,
end before 9 [meaning 8] and skip count by 2:
(1, 3, 5, 7)
26/32
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 26/36CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
19. 27/32
1- How could this code be made more manageable?
QuestionandExercise
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 27/36CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
20. 2/32
N
Description
D
A
Y
5
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 2/13
● In music production we can use effects such as
Volume, Pan, Distortion, Delay, and Pitch to change
the properties of the sounds on tracks.
● With these effects we can add color and variety to
the musical samples.
● This lesson will describe the use of the setEffect()
function and demonstrate the effects of Volume,
Pan, and Distortion.
CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
21. 2/32
N
D
A
Y
5
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 3/13
Effect: A tool to manipulate, process, shape, ad change the sound oftracks.
Parameter: The particular value of the effect changed by the envelope.
Examples include GAIN, LEFT_RIGHT,and MIX
Envelope: The values of the Effect parameter asmeasured over time.
This controls the change of effect over time.
Function for setting effects:
setEffect(track, effect, parameter, startValue, startMeasure, endValue,
endMeasure)
Example:
setEffect(1, VOLUME, GAIN, -40, 1, 5, 5)
Vocabulary
CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
22. 3/32
D
A
Y
5
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 4/13
Volume Effect
● In one example, we want track 3 to ‘fade in’ from the beginning.
Therefore we need to use VOLUME effect and parameters.
Effect: VOLUME
Parameter: GAIN
Values: -60 (all the way quiet) to 12 (all the way loud) (we
will use -40 to 5) (Note that 0 is ‘unity’ or standard volume
gain setting)
Setting Volume Effects as following:
setEffect(track, VOLUME, GAIN, level, start, level2, end)
CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
23. 4/32
Assignment
D
A
Y
5
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 5/13
Add the following code to call VOLUME effect:
CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
24. 1/5/32
Decreasing Volume
D
A
Y
5
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 6/13
● Let us say we want the volume to decrease from measures 7 to
9 on track three. Write this code to decrease the volume:
CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8