An Idea •
Brainstorming session
•
Melanie Sumner
•
Compose a song alongside building an Ember app
Slide 3
The Idea Grows •
How to best compare building an app with composing a song
•
Map elements of song to concepts in Ember
•
An Ember app that IS a song
Slide 4
Programming and Songwriting •
Both creative endeavors
•
Both are complex
•
Share many fundamental concepts
•
Patterns
•
Loops
•
Conditionals
•
Problem solving
•
Bugfixing
Slide 5
What’s in a song? •
Sections
•
Intro
•
Verse
•
Chorus
•
Bridge
Slide 6
What are sections composed of? •
Instruments
•
Parts
•
Notes
•
Measures
•
Phrases
Slide 7
Mapping to Ember •
Sections -> Routes
•
Instruments -> Services
•
Parts -> Components
•
Notes -> Contextual Components
Slide 8
Section -> Route •
A location in the song
•
Composed of instruments playing parts together
•
The musical equivalent of a “page”
Slide 9
Instrument -> Service •
Instruments are global
•
Maintain state when moving through sections
•
Keep playing
•
Volume
•
Effects
Slide 10
Part -> Component •
Made up of notes for one instrument
•
Often a pattern that repeats within a section
•
Often re-used across multiple sections
Slide 11
Note -> Contextual Component •
Belongs to a part
•
Needs context
•
Which instrument
•
When to play relative to other notes
Slide 12
Other Globals •
Tempo
•
Master Volume
•
Playing state (start, pause, stop)
•
Where we are in the timeline
•
Could be handled by a single or multiple services
Slide 13
Concept -> Implementation •
Web Audio API - https://www.w3.org/TR/webaudio/
• •
Extremely powerful, but very low level
Tone.js - https://tonejs.github.io
•
Built on top of Web Audio API
•
Primitives for making music (not just sounds)
Slide 14
Hello World •
Create one instrument: piano
•
Play a single note: middle C
Slide 15
Service: piano ember g service piano
Slide 16
Instrument Component
Slide 17
Part Component •
Responsible for
•
Connecting notes to an instrument
•
Scheduling notes to play
•
Scheduling draws
•
Looping
Slide 18
Part Component
Slide 19
Note Component
Slide 20
Play it!
Slide 21
Slide 22
Scale •
String of notes, one after another
•
Ascending (or descending) in pitch
•
Hitting all the white keys (for a C scale)
Slide 23
Scale
Slide 24
Slide 25
How does this work?
Slide 26
Visualization
Slide 27
Two Instruments
Slide 28
Slide 29
Multi-part
Slide 30
Slide 31
Loops
Slide 32
Slide 33
Drum Kit
Slide 34
Drum Kit
Slide 35
Slide 36
Drum Loop
Slide 37
Slide 38
Putting it all Together •
Composed a song with Ember!
•
Routes and controllers for: intro, verse, chorus
•
Auto-advances among the sections
•
Routes handle timing and advancing
•
Controllers inject instruments (services)
•
Parent route for drums
Slide 39
Slide 40
Future Plans •
Write more songs!
•
Turn this into an add-on
•
Continue to add features
•
Collaboratively write songs using GitHub!