DOC PREVIEW
Columbia COMS W4115 - TONEDEF

This preview shows page 1-2-3-4-5 out of 14 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Curtis HenkelCurtis HenkelMatthew DuaneChatura AtapattuKevin RamkishunTONEDEFKevin RamkishunMotivationMotivationC l f h “M i l C Create a language for the “Musical Computer Scientist"h f l Bring the semantics of musical composition to a programming language Flexible enough for a variety of uses Simple music creation Algorithmic music creationLanguage OverviewLanguage OverviewIi i lImperative programming language Statically scoped, weakly‐typed Types are immutable No pointers No polymorphism of function names/* Comments *// Comments / Source file is piped in and optional output file can be piped outcan be piped out.TypesTypesintdigits onlyintdigits only boolean true or false string chars inside double quotes pitch $[A‐G][b#]?[0‐9]? sequence comma‐separated list of ints inside [ ] beat rational numbers  note pitch + beat chord set of notesphraseordered list of chordsphraseordered list of chords rhythm 1,0,‐,_ within ' ' void voidOperatorsOperatorsA ith ti*///%Arithmetic:+ -* / // % Comparators: < > <= >= == != Unary: -! Note/Chord Manipulation: ^ ^^ : :: + Phrase Manipulation: << >> ** @@Assignment:=Assignment:Function DeclarationsFunction Declarationstypefunctionfunc name (type name list) {type functionfunc_name (type name list) {body} Program is a list of function declarations  Applicative orderpp Pass‐by‐value parameters Special functionsmainmain print playSyntax OverviewSyntax Overviewexpression := literal | unop exprexpression := literal | unop expr| expr binop expr| name (expr list) | name = expr| [ expr list ] | name statement := expr; | if (expr) stmt [else stmt]p;| (p) [ ]| for (expr; expr; expr) stmt | while (expr) stmt| foreach(type name in expr) stmt| foreach(type name in expr) stmt| return expr;| {stmt list }| type name [= expr];Example Program ‐ Phrase Creationp gvoid function main() {note n = $C5 : 1//4;sequence s = [];for (int i = 0; i<10; i = i+1){s = s + [x]; /* Creates a sequence }phrase p=n << reverse sequence(s); /*Creates phrase using notephrase p n << reverse_sequence(s); / Creates phrase using note and sequence */play(p);}sequence function reverse_sequence (sequence in_seq) {sequence s = [];foreach (int x in in_seq) {s = [x] + s;}return s;}Language ImplementationLanguage ImplementationScannerSource Code dfInputScanner(.tdf)Tokenized InputParserSyntax TreeCompilerTreedBytecode InterpreterMi!BytecodeOutputInterpreterJFugue (Java)Music!OutputSample BytecodeSample Bytecodevoid function main() {f h(i ii [456]){Output:4foreach (int i in [4,5,6]) {print (i + "\n");}456}0 Jmp 29 Combine17 Concatp1 Hlt2 Entry 13 PushEmpty sequence 10 Bra 1011 Decompose12 Store 118 Jmp -119 Pop20 IsEmptypy q4 PushInt 65 Combine6 PushInt 513 Pop14 Load 115 ConvertType int-py21 Beq -1022 Pop23 PushInt 06 PushInt 57 Combine8 PushInt 415 ConvertType int >string 16 PushString \n23 PushInt 024 Ret 0StackStack type mbeat = int * int (* numerator, denominator *) type mnote = int * mbeat (* pitch, beat *)… type mchord = mnote list (* list of notes *) type mphrase = mchord list (* list of chords *) type msequence = int listArgument 2Argument 1Return AddressOld Frame PointerFramepointer MemInteger of int MemString of stringLocal 1Local 2… MemPitch of int MemBool of bool MemBeat of mbeat MemNote (mnote(65, mbeat (1, 4)))MemChord (mchord([mnote(61, mbeat(1, 2))])) MemNote of mnote MemChord of mchord MemPhrase of mphraseMemBeat (mbeat(1, 4))MemString (string(“Quicksort Music”))((5, (,4))) MemSequence of msequence MemRhythm of stringMemInteger (42)How We CollaboratedHow We CollaboratedSource Code Control SubversionSource Code Control ‐Subversion Hosting by Assembla.comStress frequent commitsSt ess eque t co ts Automatic E‐Mail on new commits to notify team membersGl DGoogle Documents Collaborative editing on all documents and presentationsp Proposal, Task List, LRM, Presentation, Final Report  Instant Messaging, E‐Mail conversations Impromptu meetings (after class) as requiredLessons LearnedLessons LearnedKISS K i Si l Sid (lihé k)KISS ‐Keep it Simple Stupid (cliché, we know) Everything is just an integer or a stringf If you don’t have an easy solution, just add another layer of indirection Orthodox stack ‐> Object based stackSummary & ConclusionSummary & ConclusionSfll il d Tdf h Successfully implemented Tonedef per the Language Reference Manualk Future work Overlapping phrases User interaction in program Command argumentsDiff i d i iDifferent instruments, tempo and time


View Full Document

Columbia COMS W4115 - TONEDEF

Documents in this Course
YOLT

YOLT

13 pages

Lattakia

Lattakia

15 pages

EasyQL

EasyQL

14 pages

Photogram

Photogram

163 pages

Espresso

Espresso

27 pages

NumLang

NumLang

6 pages

EMPATH

EMPATH

14 pages

La Mesa

La Mesa

9 pages

JTemplate

JTemplate

238 pages

MATVEC

MATVEC

4 pages

SASSi

SASSi

16 pages

JTemplate

JTemplate

39 pages

BATS

BATS

10 pages

Synapse

Synapse

11 pages

c.def

c.def

116 pages

TweaXML

TweaXML

108 pages

Load more
Download TONEDEF
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view TONEDEF and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view TONEDEF 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?