Unit 21 - Northwestern University
Download
Report
Transcript Unit 21 - Northwestern University
twenty-one
chance operations
Fortune telling and meditation
Examples:
Tarot, I Ching, Astrology
Introduce chance
operations into a system
of signs
Results are “meaningless”
But we give them meaning
after the fact
Garfinkel’s breaching
experiments
there is no noise
only signal
Chance operations
Fancy term for “randomness”
A way of taking your ego out of the loop
A way of automating decisions you don’t want to make
Get past your preconceived notions
Creating surprise
Creating juxtapositions that can create new meaning for you
Could you draw a random line?
Generating a terrain for
A way of automating decisions you can’t make
Interactive art – the artist isn’t there to make the decisions
The Art of Noise
[show
[p → [× 256
[turbulence [× 0.001
p.X p.Y]]]]]
turbulence with a numeric argument
[show
[p → [× 256
[cos [× 10
[turbulence [ ⁄ p 50]]]]]]]
Exquisite corpse
The surrealists used a variety of
unusual composition techniques
Automatic writing
Dreams as source material
Chance operations
Why?
They were followers of Freud
They saw the conscious mind as
representative of the ills of society
(repression, war, exploitation)
Unlock the unconscious
Escape the sources of repression
Recover a more “natural” state of the
psyche
Open oneself up to the possibility of
delightful coincidence
Source: http://anexquisitecorpse.net/explanation.shtml
The electric corpse
You now know enough to
write programs to make
exquisite corpse
sentences
We just need one more
primitive procedure
[random-integer low high]
Returns a random number
Greater than or equal to
low
And less than high
[define random-get
[list → [get list
[random-integer 0
[length list]]]]]]
[define exquisite-corpse
[→ [list [random-get nouns]
[random-get verbs]
[random-get nouns]]]]
A more elegant version
It would be more elegant to have
the code read like the grammar for
English
How would we write the code to
work this way?
A sentence is a noun phrase and
a verb phrase
A verb phrase is a verb and a
noun phrase
A noun phrase is a determiner
and a noun
Need to write single-word-phrase
And phrase-type
What should a phrase type be
represented as?
[define article
[single-word-phrase
[define adjective
[single-word-phrase
[define noun
[single-word-phrase
[define verb
[single-word-phrase
'[a the some any]]]
'[green heavy …]]]
'[plant table …]]]
'[eat drink …]]]
[define np
[phrase-type article adjective noun]]
[define vp
[phrase-type verb np]]
[define sentence
[phrase-type np vp]]
Writing the driver code
[define single-word-phrase
[words →
[→
[list [random-get words]]]]]
[define phrase-type
[subphrases ... →
[→
[apply append
[map [call :
proc → [proc]]
subphrases]]]]]
Wow, man, deep…
Meta development environment,
version 1.0.1528.32705
Copyright © 2003 Northwestern University.
► «Load the code»
► [sentence]
[a green rain kill some green dubya]
► [sentence]
[any carnivorous rain drink any carnivorous
plant]
► [sentence]
[some heavy coffee drink some carnivorous cup]
► [sentence]
[a heavy coffee drink a magnificent table]
► [sentence]
[the heavy cup defenestrate some carnivorous
coffee]
►
► [sentence]
[a magnificent cup eat some green plant]
► [sentence]
[the magnificent rain bite some green coffee]
John Cage, 4’33”
(excerpt)
what did you hear?
What the heck was that about?
Cage wanted people to listen to silence around
them with the attitude they bring to a concert
Listening is an active process of making meaning
We can find rhythms in the sound of someone
speaking
Or hear harmony in a power drill
Cage believed these could be just as musical as
a symphony
Okay, but what does this have to do
with chance operations?
Silence isn’t silent
It’s filled with sound
People walking down the hall
The vibration of the HVAC units
People giggling
People shifting uncomfortably in their chairs
All of these can be heard as music
If you don’t believe me
Try sampling it and giving it to a DJ
Random compositions
Coding random algorithms
How do we code something
like this?
Each image is
A set of boxes
Of random size
In random position
With random color
So we need to make a bunch
of random boxes
Then group them
Let’s start with making a
random color …
Random colors
[define random-color
[→ [color [random-integer 0 255]
[random-integer 0 255]
[random-integer 0 255]
[random-integer 0 255]]]]
If you specify a fourth color component, it’s used
as the opacity level or “alpha” channel
A cleaner version
[define random-color
[with component = [→ [random-integer 0 255]]
[→ [color [component]
[component]
[component]
[component]]]]
Making a random box
[define random-box
[max-width max-height →
[with random-point = [→ [point [random-integer 0 max-width]
[random-integer 0 max-height]]]
[box [random-point]
[random-point]]]]]
Box can be called two corners (points) as arguments
Abstracting it to other shapes
[define random-shape
[shape max-width max-height →
[with random-point = [→ [point [random-integer 0 max-width]
[random-integer 0 max-height]]]
[shape [random-point]
[random-point]]]]]
While we’re at it, we might as well put in the ability to
make other kinds of shapes (like ellipses) too
Making a random box
[define boxer “Return a randomly colored random box”
[→ [paint [random-color]
[random-shape box 200 200]]]]
And now a bunch of boxes
[define boxes “A picture with box-count random boxen”
[box-count → [apply group
[iterate boxer box-count]]]]
And we need a helper procedure:
[define iterate “Call φ count times and return a list of the results.”
[φ count → [up-to count
[call : ignore → [φ]]]]]
Running it
► [boxes 5]
► [boxes 10]
►
►
Stochastic grammars
The electric corpse code was
random and recursive
But the randomness was just
in word selection
Not in the grammar
To change the grammar, we
need to randomly select
procedures
[define random-call
[proc-list args ... →
[apply [random-get proc-list]
args]]]
[define verb-phrase
[→ [random-call
[list verb
[phrase-type verb
noun-phrase]
[phrase-type verb
noun-phrase
noun-phrase]]]]]
Random (and dull, and colorless)
stained-glass windows
[define hsplit
[width height → [check valid-box?
[recenter
[stack-left [random-box [ ⁄ width 2]
height]
[random-box [ ⁄ width 2]
height]]]]]]
[define vsplit
[width height → [check valid-box?
[recenter
[stack-top [random-box width
[ ⁄ height 2]]
[random-box width
[ ⁄ height 2]]]]]]]
[define box-operators
[list hsplit vsplit]]
«Add more to taste»
[define random-box
[width height →
[if [or [< width 25]
[< height 25]]
[box width height]
[random-call box-operators width height]]]]
Trying it
► [random-box 128 128]
► [define box-operators
[list box vsplit vsplit vsplit hsplit hsplit]]
► [random-box 256 256]
►
►