2. 2/32
N
Who are we ?
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 2/36
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
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 3/36
4. •Allows humans to encode, refine, reflect,and
share logical thought in adynamic moving
systemthat changesover time.
•Music and Programming (Computational
Thinking) are the sameHuman Skill
expressed in two different domains: non-
verbal feelings in art/music and logical /
motion thought in Programming or
Computational Thinking
4/32
What is Programming?
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 4/36
5. Motion / Time / Flow
Thinking
Non-Verbal
Feelings:
Music
Thought:
Programming /
Computational
1/5/32
Audiation is to Music as Computer
Thinking is to Computer Science
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 5/36
7. •Enhancingthe number of students
interested in computer science related
topics.
•In CS– we tend to focuson:
• Graphics / Games/ Visual
• TextProcessing/ Database
• Logic / Algorithmic / Mathematical
•EarSketchseeksto engagestudents in
CSthrough the art ofmusic.
7/32
Motivation
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 7/36
8. 8/32
Why to learn program?
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 8/36
9. •Online Programming and Music Mixing Workstation
-Used at
GeorgiaTech to teach Digital Music Mixing.
-Tool for
Programming
-Free!
-Webbased
9/32
What is EarSketch?
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 9/36
10. Descriptionof EarSketch
•Programming Environment
•Python Based
•Web BasedApp or Installed Systemof
Software
•APIbuilt in Python for MusicMixing
•NSFFundedproject to encourage
computational interest through themixing
and sharing of music.
•Curriculum and SocialMedia Site
10/32
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 10/36
15. 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/36
17. 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/36
18. 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/36
19. 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/36
20. 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/36
22. 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/36
23. 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/36
24. 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/36
25. 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/36
26. 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/36
27. 27/32
1- How could this code be made more manageable?
QuestionandExercise
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 27/36
28. 28/32
QuestionandExercise
2 - Make a project that's at least 12 measures long, uses
randomness, and has both an A and a B section.
D
A
Y
3
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 28/36
30. D
A
Y
3
30
● In composing or remixing, artists take “slices” of beats and combine
them in rhythmic patterns to create interest and drive.
● One way to make a custom beat pattern in EarSketch is to use
a string to define a pattern.
● Beat patterns in EarSketch use strings to refer to subsections of a
measure in order to place clips at specific places in the measure as
well as define the clip’s play length in one go. Here’s an example of a
beat pattern using a string:
Custom beat patterns and strings
MAGIC Presenter : Fatemeh Jamshidi. June 17-22 30/36
31. “makeBeat”Method
makeBeat(file, track, measure, BeatString)
Location of
Media
Sound
Which Track
in Reaper
What
measure.
Example: “0+++0+++0+0+0+++”
Example:
makeBeat(drums, 1, 1, “0+0+0+++00-00+++”)
21/32MAGIC Presenter : Fatemeh Jamshidi. June 17-22 31/36
32. BeatStringnotation
1) “0, 1, 2, 3 . . . “ =Which Media Soundyou
want for the segmentof beat. Correspond
to placement in aList that is onebased.
2) Note: 0 will refer to asound if it is the
only media file in theargument.
3) “+”Means extend or loop the Media
sound 1/16th of a measure.
4) “-” Means 1/16th measure of rest.
22/32MAGIC Presenter : Fatemeh Jamshidi. June 17-22 32/36