49
Machaut Messe Machaut Messe Performance Performance Isorhythm Isorhythm

Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Embed Size (px)

Citation preview

Page 1: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Machaut MesseMachaut Messe

Performance Performance

IsorhythmIsorhythm

Page 2: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

ReviewReview

Page 3: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Remember Remember

All Lisp expressions must have matched parentheses; All Lisp expressions must have matched parentheses; that is, every open paren must appropriately have a that is, every open paren must appropriately have a closed paren.closed paren.

Document all of your work by placing comments after a Document all of your work by placing comments after a “;” or enclosing in “”, or placing between #| this is “;” or enclosing in “”, or placing between #| this is documentation |#documentation |#

Name variables and everything you do such that later on Name variables and everything you do such that later on you can tell what they mean and does.you can tell what they mean and does.

Page 4: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Remember Remember

Readability is Readability is @#$%^&* @#$%^&* everythingeverything

Page 5: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

One flew over the parentheses nest!One flew over the parentheses nest!

Page 6: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Hummmmmmm Hummmmmmm

(+ (first *my-numbers*)(+ (first *my-numbers*) (third *my-numbers*)(third *my-numbers*) (first *my-numbers*))(first *my-numbers*))

Note how much easier the above is to read than:Note how much easier the above is to read than: (+ (first *my-numbers*)(third *my-numbers*)(first (+ (first *my-numbers*)(third *my-numbers*)(first

*my-numbers*))*my-numbers*)) 4 4

Page 7: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

More exercisesMore exercises

(nth 5 ‘(1 2 3 4 5 6))(nth 5 ‘(1 2 3 4 5 6)) 66 Remember to check whether the primitive Remember to check whether the primitive

you’re using is zero or one based as in you’re using is zero or one based as in (nthcdr 5 ‘(1 2 3 4 5 6))(nthcdr 5 ‘(1 2 3 4 5 6)) 66 whewwhew

Page 8: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

More?More? (position 1 '(2 1 3 4 5))(position 1 '(2 1 3 4 5)) 11

(position 2 '(2 1 3 4 5))(position 2 '(2 1 3 4 5))

00

And so on.And so on.

Page 9: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

From (0 60 1000 1 64) get:From (0 60 1000 1 64) get:

1) 01) 0

2) 642) 64

3) 10003) 1000

4) (1000 1 64)4) (1000 1 64)

5) (60 1000)5) (60 1000)

6) (0 60 1000)6) (0 60 1000)

7) (0 1)7) (0 1)

8) ((0))8) ((0))

9) (60 1000 64)9) (60 1000 64)

10) (60 0)10) (60 0)

Page 10: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

From (((a) b) c) get:From (((a) b) c) get:

1) a1) a

2) c2) c

3) b3) b

4) (a b)4) (a b)

5) (a (b c)))5) (a (b c)))

Page 11: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

From (a b c d e) get:From (a b c d e) get:

1) (d e)1) (d e)

2) 52) 5

3) (a (b (c (d (e)))))3) (a (b (c (d (e)))))

4) (e d c b a)4) (e d c b a)

5) (a b c d)5) (a b c d)

Page 12: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

From a get:From a get:

1) (a)1) (a)

2) (a . a)2) (a . a)

3) (a (a))3) (a (a))

4) ((a) a)4) ((a) a)

5) (a ())5) (a ())

Page 13: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

From a and (b c) get:From a and (b c) get:

1) (a b c)1) (a b c)

2) ((a) b c)2) ((a) b c)

3) (a (b c))3) (a (b c))

4) (a c)4) (a c)

5) (c b a)5) (c b a)

Page 14: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

From (a b) and (c d) get:From (a b) and (c d) get:

1) (a b c d)1) (a b c d)

2) ((a b) c d)2) ((a b) c d)

3) ((a b)(c d))3) ((a b)(c d))

4) (b a d c)4) (b a d c)

5) (a (b c) d)5) (a (b c) d)

Page 15: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

(append '((1)) '(2 3))(append '((1)) '(2 3))

Page 16: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

((1) 2 3)((1) 2 3)

Page 17: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

(append '((2)(3)) '(4 5))(append '((2)(3)) '(4 5))

Page 18: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

((2) (3) 4 5)((2) (3) 4 5)

Page 19: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

(first '(((a)) (b c d e)))(first '(((a)) (b c d e)))

Page 20: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

((A))((A))

Page 21: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

(rest '(((((f))))))(rest '(((((f))))))

Page 22: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

nilnil

Page 23: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

(first '(rest (a b c)))(first '(rest (a b c)))

Page 24: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

restrest

Page 25: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

(first (second '(((1 2))(2 3 4)((5 6 7)))))(first (second '(((1 2))(2 3 4)((5 6 7)))))

Page 26: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

22

Page 27: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

(second (first '(((1 2))(2 3 4)((5 6 7)))))(second (first '(((1 2))(2 3 4)((5 6 7)))))

Page 28: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

nilnil

Page 29: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Cope-eventCope-event

(0 60 1000 1 127)(0 60 1000 1 127)

On-time (1000 per second)On-time (1000 per second) Pitch number (24 108)Pitch number (24 108) Duration (1000 per second)Duration (1000 per second) Channel (1-16)Channel (1-16) Loudness (1- 127)Loudness (1- 127)

Page 30: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Therefore Therefore

(0 60 1000 1 127)(0 60 1000 1 127) Translates toTranslates to A loud quarter-note middle C on channel 1A loud quarter-note middle C on channel 1 Channel assignments are separate and Channel assignments are separate and

(except for channel 10 usually) can (except for channel 10 usually) can produce any general MIDI soundproduce any general MIDI sound

When saved to MIDI file and opened in a When saved to MIDI file and opened in a notation program produces the above.notation program produces the above.

Page 31: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Cope-eventsCope-events

((0 60 1000 1 127)(1000 62 1000 1 127)((0 60 1000 1 127)(1000 62 1000 1 127)(2000 64 1000 1 127)(3000 65 1000 1 (2000 64 1000 1 127)(3000 65 1000 1 127)(4000 67 1000 1 127)(5000 69 1000 1 127)(4000 67 1000 1 127)(5000 69 1000 1 127)(6000 71 1000 1 127)(7000 72 1000 1 127)(6000 71 1000 1 127)(7000 72 1000 1 127))127))

Produces a loud C-major scale in quarter Produces a loud C-major scale in quarter notes.notes.

Page 32: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Some more functionsSome more functions + (can have any number of args)+ (can have any number of args) - (can have any number of args)- (can have any number of args) / (can have any number of args)/ (can have any number of args) * (can have any number of args)* (can have any number of args) sort (be careful)sort (be careful) expexp sqrtsqrt sin, cosin, tan (etc.)sin, cosin, tan (etc.)

Page 33: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Predicates Predicates

Some Lisp functions serve as test Some Lisp functions serve as test functions as infunctions as in

(listp 1)(listp 1) which returns nil because its argument is which returns nil because its argument is

not a listnot a list (atomp ‘(1))(atomp ‘(1)) which returns nil because its argument is which returns nil because its argument is

not an atomnot an atom The suffix “p” stands for predicateThe suffix “p” stands for predicate

Page 34: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Conditionals Conditionals

Some functions in Common Lisp—Some functions in Common Lisp—called conditionals—test data for called conditionals—test data for certain attributes.certain attributes.

For example, the function For example, the function ifif tests its tests its first argument and returns its first argument and returns its second argument if it proves true, or second argument if it proves true, or its third argument if it proves false. its third argument if it proves false.

Page 35: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Example Example

? ? (if (numberp 1) t nil)(if (numberp 1) t nil) ReturnsReturns TT because “1” is a number and thus because “1” is a number and thus

the first choice (t) is the resultthe first choice (t) is the result Note that Lisp is case insensitive.Note that Lisp is case insensitive.

Page 36: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Named Named

This combination is often termed an This combination is often termed an if-then-elseif-then-else clause. clause.

Page 37: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Quiz Quiz

? (if (numberp (second ‘(a 2 b d f)) ‘yes ‘no)? (if (numberp (second ‘(a 2 b d f)) ‘yes ‘no)

returns returns > yes> yes

Page 38: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Quiz Quiz

? (cons 1 (rest ‘(1 2 3 4 5)))? (cons 1 (rest ‘(1 2 3 4 5)))

returnsreturns

> (1 2 3 4 5)> (1 2 3 4 5)

Whew.Whew.

Page 39: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Now you think of some Now you think of some questions!questions!

Page 40: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Let’s try for a few Let’s try for a few combinationscombinations

(defvar *my-numbers* ‘(1 2 3))(defvar *my-numbers* ‘(1 2 3)) (if (equal (first *my-numbers*) 2)(if (equal (first *my-numbers*) 2)

(third *my-numbers*)(third *my-numbers*)

(first *my-numbers*))(first *my-numbers*))

What’s the answer?What’s the answer?

Page 41: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

AnswerAnswer

11

Page 42: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

AnotherAnother

(append (append

(append *my-numbers* *my-numbers*)(append *my-numbers* *my-numbers*)

(rest *my-numbers*))(rest *my-numbers*))

Page 43: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

AnswerAnswer

(1 2 3 1 2 3 2 3)(1 2 3 1 2 3 2 3)

Page 44: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

A little harderA little harder

(if *my-numbers* (last *my-numbers*) (if *my-numbers* (last *my-numbers*)

())())

Page 45: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

AnswerAnswer

(3)(3)

N.B. The function “last” returns a list of the N.B. The function “last” returns a list of the last number. Weird, but true. last number. Weird, but true.

Page 46: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Try this:Try this:

(if (equal *my-numbers* (1 2 3)) (if (equal *my-numbers* (1 2 3))

(reverse *my-numbers*))(reverse *my-numbers*))

Page 47: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

AnswerAnswer

Error! (forget the single quote on data!!!)Error! (forget the single quote on data!!!)

Page 48: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

Whew! Whew!

(third ‘((((a)) b)(c ((d) e) f)(((g)) h I))(third ‘((((a)) b)(c ((d) e) f)(((g)) h I))

Page 49: Machaut Messe Performance Performance Performance Isorhythm Isorhythm

AnswerAnswer

(((g)) h I))(((g)) h I))