Composing Music with Grammars
Download
Report
Transcript Composing Music with Grammars
Composing Music with
Grammars
grammar
• the whole system and structure of a language or
of languages in general, usually taken as
consisting of syntax and morphology (including
inflections) and sometimes also phonology and
semantics.
• a particular analysis of the system and structure
of language or of a specific language.
• a set of actual or presumed prescriptive notions
about correct use of a language
• Computing: a set of rules governing what strings
are valid or allowable in a language or text.
syntax - the arrangement of words and phrases
to create well-formed sentences in a language.
morphology - the study of the forms of things,
in particular
• Linguistics: the study of the forms of words.
semantics - the branch of linguistics and logic
concerned with meaning.
• the meaning of a word, phrase, sentence, or
text
Definitions
token - grammatical symbol
root token – root of parse tree
vocabulary (V)– all the tokens plus the null token
alphabet of terminals (T)– subset of vocabulary
language (L) – subset of finite concatenations of
tokens of T
alphabet of non-terminals (N) – categories of
macrostructures in V
sentential form – sequence of non-terminals
production (rewrtiting) rule – LHS RHS
Generative Grammar expressed as a quadruple
G = (N,T,∑,P)
G - generative grammar
N - alphabet of non-terminals
T - alphabet of terminals
∑ - root token
P - collection of production rules of the form:
α → β, where α, β ∈ (N ∪ T)∗, and (N ∩ T) = Ø.
(“∗”denotes the powerset or set of all subsets)
Chomsky’s four types of grammars
Free (type 0) – imposes no restrictions on the form of the production
rule. Intermediate strings can expand and contract in length.
Allows for infinite strings and null strings.
Context-sensitive (type 1) – A α B → A β B. alpha produces beta in the
context of A and B. α → Ø is forbidden.
Context-free (type 2) – very useful with regards to natural language
and programming. Good for representing multi-leveled syntactic
formations of music. Any non-terminal (representing a
macrostructural category like motive, phrase, sentence, section,
movement, entire piece, etc.) may generate a string of tokens at a
lower level.
Finite-state (type 3) – no more than one non-terminal token may
appear on each side of any production rule. Type 2 does not have
this limitation.
Production/Rewrite Rules
Random selection
Serial selection – Useful for musical purposes. No object is selected
again until all the others are selected. (Compare to serialism)
Finite-state transition matrix – successive productions depend on
previous productions. For example:
LHS->
(A.1.0.1.0)
(B.0.1.0.0)
(C.1.1.0.0)
(D.1.1.1.1)
Selection functions – higher level complex functions that return an
integer value that corresponds to an object index.
Meta-production rule – a single generation by a rule is to be
substituted for all occurrences of the LHS of the rule. An example of
horizontal dependency.
The Bol Processor (Bel and Kippen)
A tabla-oriented generative grammar based on machne
learning. Acquires knowledge through parsing
expert input, and attempted generation, followed by
expert approval or disapproval.
EMI – experiments in Musical Intelligence
(David Cope, UC Santa Cruz)
Arguably the most successful and developed
automated grammar for music making.
Analyzes the style of a composer through
batch input of a multitude of pieces. Produces
pieces of music that are highly faithful to the
composer’s style.
Developed in response to writer’s block
occurring after the spending of a large
commission for an opera. Composed in 10
days.
David Cope discusses EMI in a Radiolab
interview
SenGen Production Rules
Sentence -> [PrepositionalPhrase], + NounPhrase1 + VerbPhrase
VerbPhrase1 -> [AdverbPhrase] + Verb1 + [PrepositionalPhrase || AdverbPhrase]
VerbPhrase2 -> [AdverbPhrase] + Verb2 + NounPhrase + [PrepositionalPhrase ||
AdverbPhrase]
NounPhrase -> [Determiner,90%] + [AdjectivePhrase] + Noun + [PrepositionalPhrase]
NounPhrase1 -> [Determiner,90%] + [AdjectivePhrase] + agent
AdverbPhrase -> [AdverbPhrase,25%] + Adverb
AdjectivePhrase -> [AdverbPhrase,15%] + Adjective + [PrepositionalPhrase]
PrepositionalPhrase -> Preposition + NounPhrase + [, + PrepositionalPhrase] (last
stacked PrepPhrase preceeded by and)
Note: credit must be given to Curtis Roads and Paul
Wieneke from whose paper Grammars as
Representations for Music, I quote directly at times
in this presentation as well as the New Oxford
American Dictionary application bundled with Mac
OS X. S.R. Holtzman deserves credit for the section
on production rules taken from Using Generative
Grammars for Music Composition. For a proper
bibliography, see my accompanying paper,
Composing Music with Grammars.