CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8
Computational Music Mixingwith
EarSketch: Engaging Students
With Python andMusic
CS4Allgirls
Fatemeh Jamshidi
fzj0007@auburn.edu
1/32
Who are we?
CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 2/32
N
Why Music andProgramming?
•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.
3CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 3/32
What isProgramming?
•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
4CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 4/32
Audiationis to musicas
ComputationalThinkingis to Computer
Science
Motion / Time / Flow
Thinking
Non-Verbal
Feelings:
Music
Thought:
Programming /
Computational
5
1/CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 5/32
Toput this another way...
Encodingthe
Non-Verbal
Encodingthe
Logic
KalmanFilterEine Kliene
6CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 6/32
Motivation
•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.
7CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 7/32
Why Learn toProgram?
8CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 8/32
What isEarSketch?
•Online Programming and Music Mixing Workstation
-Used at
GeorgiaTech to teach Digital Music Mixing.
-Tool for
Programming
-Free!
-Webbased
9CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 9/32
Description ofEarSketch
•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
10CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 10/32
11CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 11/32
EarSketchWebsite: Web based IDEand DAW
CodingWindow: Programming
Music View: Display and Playback
Documentation
and CurriculumSoundLibrary
Toggle
Views
12CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 12/32
What isPython?
•General purpose Computer Programming
Language
•Web development: Googleand Yahoo
•GameDevelopment, Science, Graphics
•In Business:National Weather Service,NASA,
IBM, Disney,and Nokia
•Usedin Development of the GoogleCarand
other RoboticSystems
13CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 13/32
Sample EarSketchProgram
Comments
FinishSection
}
}Setup Section
} MusicSection
}
14 1/CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 14/32
Essential Elements we willuse 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
15CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 15/32
EarSketch PythonFunctions
EarSketch Function Description
init() Start new EarsketchMix
and clear the DAW
setTempo(120) Setsthe beats per minute
(speed) of the Mix
println(“Hello”) Prints messageto console
16CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 16/32
EarSketch Python Functions
Music MixingFunctions
fitMedia(file, track, start, end)
makeBeat(file, track, measure, beatString)
setEffect(track, effect, parameter, sV,
sM, eV, eM)
rhythmEffects(track, effect, parameter,
list, measure)
17CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 17/32
“fitMedia”Function
fitMedia(file, track, start, end)
Location of
Media
Sound
Which Track
in Reaper
Start
measure.
End Measure
Example:
fitMedia(HIP_HOP_DRUMS1_2M, 1, 1, 9)
18CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 18/32
Setting VolumeEffects
setEffect(track, VOLUME, GAIN, level, start,
level2, end)
• Example
setEffect(1, VOLUME, GAIN, -40, 1, 10, 5)
19CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 19/32
SelectedListof EffectsandParameters
Effect Parameter Min to MaxValues
VOLUME GAIN -60 to 12
DELAY DELAY_TIME 0 to 300.0
CHORUS CHORUS_LENGTH 1.0 to 15.0
CHORUS CHORUS_NUMVOICES 1.0 to 8.0
DISTORTION DISTO_GAIN 0.0 to 50.0
FILTER FILTER_FREQ 20.0 to 20000.0
PAN LEFT_RIGHT -100 to 100 (Left to
Right)
Complete Effect list at:
http://earsketch.gatech.edu/category/learning/reference/every-effect-explained
20CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 20/32
“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+++”)
21CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 21/32
Beat Stringnotation
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.
22CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 22/32
“0+++0+++0+0+0+++”
1
makeBeat(ELEKTRO_HOUSE_DRUMS3_2M, 1, 1,
“0+++0+++0+0+0+++”)
23CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 23/32
“0+++0++00+0+0-00”
1
makeBeat(ELEKTRO_HOUSE_DRUMS3_2M, 1, 1, “0+++0++00+0+0-00”)
24CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 24/32
“0+++0+++0+0+0+++”
1
makeBeat(ELEKTRO_HOUSE_DRUMS3_2M, 1, 1, “0+++0+++0+0+0+++”)
25CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 25/32
“0-0-0-0-0-0-0-0-”
1
makeBeat(ELEKTRO_HOUSE_DRUMS3_2M, 1, 1, “0-0-0-0-0-0-0-0-”)
26CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 26/32
For Loops: Skip Counting
fillDrum = HIP_HOP_SYNTHDRUMS2_2M
beat = "0+++0+++0-000+00"
for measure in range(1, 9, 2):
makeBeat(fillDrum, 1, measure, beat)
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)
27CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 27/32
Functions: RecycleandReuse!
Now I can use this section anywhere!
sectionA(1, 9)
sectionA(17, 25)
28CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 28/32
Creating aFunction
1. Definition:
2. Decide on Variables for Music
3. Write fitMedia() calls
4. Write any ForLoops
5. Set Effects
29CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 29/32
RhythmEffects
30CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 30/32
Exercises forClassroom
•Create EarSketchAccount
•Mix1: (ABSection Exercise)
•UsefitMedia and setEffect
•Music in sections
•Mix2: (makeBeat and For Loop Exercise)
•makeBeat
•For Loop Structure
•Mix3: (Defining Functions Exercise)
•Final Mix
31CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 31/32
Final Mix ProjectGoal
• Define Three Functions
• sectionA(start,end)
• sectionB(start,end)
• sectionC(start, end)
• Eachfunction will have at least 3 musicalclips
• At least one function will useafor loopand makeBeat
• At least one function will useeffects
• Call your functions to create amusicmix
• ABABCBB
• At least 64Measures
32CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 32/32

Ear sketch(presentation)

  • 1.
    CS4All Girls Presenter: Fatemeh Jamshidi. June 3-8 Computational Music Mixingwith EarSketch: Engaging Students With Python andMusic CS4Allgirls Fatemeh Jamshidi fzj0007@auburn.edu 1/32
  • 2.
    Who are we? CS4AllGirls Presenter : Fatemeh Jamshidi. June 3-8 2/32 N
  • 3.
    Why Music andProgramming? •APhilosophy of Music Education:Bennett Reimer Music allows humans to encode, refine, reflect, and sharenon-verbal thought in a dynamic moving systemthat changesover time. 3CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 3/32
  • 4.
    What isProgramming? •Allows humansto 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 4CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 4/32
  • 5.
    Audiationis to musicas ComputationalThinkingisto Computer Science Motion / Time / Flow Thinking Non-Verbal Feelings: Music Thought: Programming / Computational 5 1/CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 5/32
  • 6.
    Toput this anotherway... Encodingthe Non-Verbal Encodingthe Logic KalmanFilterEine Kliene 6CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 6/32
  • 7.
    Motivation •Enhancingthe number ofstudents 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. 7CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 7/32
  • 8.
    Why Learn toProgram? 8CS4AllGirls Presenter : Fatemeh Jamshidi. June 3-8 8/32
  • 9.
    What isEarSketch? •Online Programmingand Music Mixing Workstation -Used at GeorgiaTech to teach Digital Music Mixing. -Tool for Programming -Free! -Webbased 9CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 9/32
  • 10.
    Description ofEarSketch •Programming Environment •PythonBased •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 10CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 10/32
  • 11.
    11CS4All Girls Presenter: Fatemeh Jamshidi. June 3-8 11/32
  • 12.
    EarSketchWebsite: Web basedIDEand DAW CodingWindow: Programming Music View: Display and Playback Documentation and CurriculumSoundLibrary Toggle Views 12CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 12/32
  • 13.
    What isPython? •General purposeComputer Programming Language •Web development: Googleand Yahoo •GameDevelopment, Science, Graphics •In Business:National Weather Service,NASA, IBM, Disney,and Nokia •Usedin Development of the GoogleCarand other RoboticSystems 13CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 13/32
  • 14.
    Sample EarSketchProgram Comments FinishSection } }Setup Section }MusicSection } 14 1/CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 14/32
  • 15.
    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 15CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 15/32
  • 16.
    EarSketch PythonFunctions EarSketch FunctionDescription init() Start new EarsketchMix and clear the DAW setTempo(120) Setsthe beats per minute (speed) of the Mix println(“Hello”) Prints messageto console 16CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 16/32
  • 17.
    EarSketch Python Functions MusicMixingFunctions fitMedia(file, track, start, end) makeBeat(file, track, measure, beatString) setEffect(track, effect, parameter, sV, sM, eV, eM) rhythmEffects(track, effect, parameter, list, measure) 17CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 17/32
  • 18.
    “fitMedia”Function fitMedia(file, track, start,end) Location of Media Sound Which Track in Reaper Start measure. End Measure Example: fitMedia(HIP_HOP_DRUMS1_2M, 1, 1, 9) 18CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 18/32
  • 19.
    Setting VolumeEffects setEffect(track, VOLUME,GAIN, level, start, level2, end) • Example setEffect(1, VOLUME, GAIN, -40, 1, 10, 5) 19CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 19/32
  • 20.
    SelectedListof EffectsandParameters Effect ParameterMin to MaxValues VOLUME GAIN -60 to 12 DELAY DELAY_TIME 0 to 300.0 CHORUS CHORUS_LENGTH 1.0 to 15.0 CHORUS CHORUS_NUMVOICES 1.0 to 8.0 DISTORTION DISTO_GAIN 0.0 to 50.0 FILTER FILTER_FREQ 20.0 to 20000.0 PAN LEFT_RIGHT -100 to 100 (Left to Right) Complete Effect list at: http://earsketch.gatech.edu/category/learning/reference/every-effect-explained 20CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 20/32
  • 21.
    “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+++”) 21CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 21/32
  • 22.
    Beat Stringnotation 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. 22CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 22/32
  • 23.
  • 24.
    “0+++0++00+0+0-00” 1 makeBeat(ELEKTRO_HOUSE_DRUMS3_2M, 1, 1,“0+++0++00+0+0-00”) 24CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 24/32
  • 25.
    “0+++0+++0+0+0+++” 1 makeBeat(ELEKTRO_HOUSE_DRUMS3_2M, 1, 1,“0+++0+++0+0+0+++”) 25CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 25/32
  • 26.
    “0-0-0-0-0-0-0-0-” 1 makeBeat(ELEKTRO_HOUSE_DRUMS3_2M, 1, 1,“0-0-0-0-0-0-0-0-”) 26CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 26/32
  • 27.
    For Loops: SkipCounting fillDrum = HIP_HOP_SYNTHDRUMS2_2M beat = "0+++0+++0-000+00" for measure in range(1, 9, 2): makeBeat(fillDrum, 1, measure, beat) 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) 27CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 27/32
  • 28.
    Functions: RecycleandReuse! Now Ican use this section anywhere! sectionA(1, 9) sectionA(17, 25) 28CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 28/32
  • 29.
    Creating aFunction 1. Definition: 2.Decide on Variables for Music 3. Write fitMedia() calls 4. Write any ForLoops 5. Set Effects 29CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 29/32
  • 30.
    RhythmEffects 30CS4All Girls Presenter: Fatemeh Jamshidi. June 3-8 30/32
  • 31.
    Exercises forClassroom •Create EarSketchAccount •Mix1:(ABSection Exercise) •UsefitMedia and setEffect •Music in sections •Mix2: (makeBeat and For Loop Exercise) •makeBeat •For Loop Structure •Mix3: (Defining Functions Exercise) •Final Mix 31CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 31/32
  • 32.
    Final Mix ProjectGoal •Define Three Functions • sectionA(start,end) • sectionB(start,end) • sectionC(start, end) • Eachfunction will have at least 3 musicalclips • At least one function will useafor loopand makeBeat • At least one function will useeffects • Call your functions to create amusicmix • ABABCBB • At least 64Measures 32CS4All Girls Presenter : Fatemeh Jamshidi. June 3-8 32/32