trends in answer set programming

Upload: erhard-m-dinhobl

Post on 03-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 Trends in Answer Set Programming

    1/31

    Trends in Answer-Set-

    Programming Focus: Music

    Erhard Dinhobl

  • 7/28/2019 Trends in Answer Set Programming

    2/31

    Roadmap

    Motivation: Why Automatic Composition?

    Basics in Music

    ANTON and Music Basics in Answer-Set-Programming

    ANTON and Answer-Set-Programming

    Conclusion

  • 7/28/2019 Trends in Answer Set Programming

    3/31

    Why Automatic Composition

    Is it possible? With ANTON, yes

    melodic and harmonic composition tool

    ANTON uses declarative programminglanguage for rules representation

    helps composers to understand and detect

    failures

  • 7/28/2019 Trends in Answer Set Programming

    4/31

    Basics

    Harmony

    underlying sound of a melody

    functional parameter, the chord

    structure define harmonic progress (history, new

    melody) i.e. cadences

    Melody

    progress of notes over time

    what we sing

  • 7/28/2019 Trends in Answer Set Programming

    5/31

    Basics - Genre

    style of music different rules (added to

    fundamental music)

    characteristics, culture, instruments, way

    we hear

    western tonality halftone music

    interval structure smaller Arabian-classic, quarter-tone, microtonal

    BUT: blues (quint in between #11 and 5)

  • 7/28/2019 Trends in Answer Set Programming

    6/31

    System ANTON

    minimal set of rules to generate/verify

    music

    adding rules improvement of quality

    Computer-Aided Composition

    Background music Elevators, Halls,

  • 7/28/2019 Trends in Answer Set Programming

    7/31

    Compositionprocess I

    global structure (AABA, Etude, Minuet,)

    melody (not overall, variations, J.S.Bach

    Invetionen, W.A.Mozart Twinkle TwinkleLittle Star)

    question: where is the next note?

    example: Musikalisches Wrfelspiel approved: mathematic models, fractals,

    chaos processes, Markov-chains

  • 7/28/2019 Trends in Answer Set Programming

    8/31

    Compostionprocess II

    David Cope The Algorithmic Composer

    Iannis Xenakis (example: Modulor)

    my work Ursprungskunst generatemusic out of architecture and the other

    way

    ornaments (Claude Debussy, MortonFeldmann)

  • 7/28/2019 Trends in Answer Set Programming

    9/31

    Composition III

    alternative: IRCAM (based onPWConstraints-addon LISP and graphiclang.)

    composition also in improvisation music(jazz, baroque figured bass notation)

    jazz musicians improvise over accord

    structure a standard Improvisation system Composition

    system

  • 7/28/2019 Trends in Answer Set Programming

    10/31

    Answer-Set-Programming I

    formal defined rules

    r: a1,, aj b1,, bm, not bm+1,,not bn

    H(r) = head, left-hand sideconsequence

    B(r) = body, right-hand side condition

    if B(r) = {} H(r) = fact, always true construction of answer-set in fixpoint

    iterations to truth assignment of atoms

  • 7/28/2019 Trends in Answer Set Programming

    11/31

    Answer-Set Example

    a b, c

    b c

    c . d e

    e d

    d & e not contained!

    Iterations:

    T({}) = {c}

    T({c}) = {b, c}T({b, c}) = {a, b, c}

    T({a, b, c}) = {a, b, c}

  • 7/28/2019 Trends in Answer Set Programming

    12/31

    Answer-Set Programming II

    atoms: something about reality

    rules: connection between atoms;

    assignment gets them to true or false

    atoms (rules fulfilled)

    choice rules: 1 { p, q, r } 2

    describes, that at least 1 atom of p, q, r

    but at most 2 are choosen to be true

    no negation %

  • 7/28/2019 Trends in Answer Set Programming

    13/31

    Gelfond-Lifschitz-Reduct

    Reduce every not in rules

    result: no negation in rules

    Interpretation, then check if true or false(accept as true or delete rule)

    all facts

    all rules without neg. a not bc not d

    d b

    d e, not a

    e d, not a

    a .

    c .

    d b

    d e

    e d

    Example:

  • 7/28/2019 Trends in Answer Set Programming

    14/31

    ANTON

    with ASP model is defined due thatmusic is harmonic and melodic valid(instance of rules atoms)

    ANTON consists of 191 loc (28 melodicand harmonic rules)

    piece with 8 notes: 3.500 atoms; 13.400

    rules duet with 16 notes: 11.000 atoms;

    1.350.000 rules

  • 7/28/2019 Trends in Answer Set Programming

    15/31

    runtime of anton

    piece for 1 voice with _length_ notes

    piece for 2 voices with _length_ notes

    clause learning-mechanism better performance

  • 7/28/2019 Trends in Answer Set Programming

    16/31

    Twenty Short Pieces (excerpt)

    verification by human

    disadvantage: only quarternotes

    advantage: due declarative prog.

    order of rules processing doesnt

    matter and rule base is extendable

    trying to get insight to Anton's

    thinking

    0:57

  • 7/28/2019 Trends in Answer Set Programming

    17/31

    Twenty Short Pieces (Harmony)

  • 7/28/2019 Trends in Answer Set Programming

    18/31

    Some Example in Code

    key-rule: choosenNote(P, T, N)

    at time T, voice P plays note N

    discrete time (quarter notes in this

    example)

    may consists of more than one voice

    (polyphonic)

    octave is divided in 12 intervals

    independent from temper

  • 7/28/2019 Trends in Answer Set Programming

    19/31

    Example II

    keyMode(lydian).choosenNote(1,1,25).choosenNote(1,2,24).choosenNote(1,8,19).

    choosenNote(1,9,20).choosenNote(1,10,24).choosenNote(1,14,29).choosenNote(1,15,27).choosenNote(1,16,25).#const t=16.

    configuration(solo).part(1).

  • 7/28/2019 Trends in Answer Set Programming

    20/31

    Some Rules% every note must be in the scale

    #const err nik=note not in scale".reason(err nik).error(P,T,err nik) :- choosenNote(P,T,N), chromatic(N,C), not key(C).

    % melodic minor -> last two notes depend on direction ofplayingerror(P,T + 1,err ism) :- choosenNote(P,T + 1,N),chromatic(N,9), upAt(P,T), keyMode(minor).% voices can only meet at one timehaveMet(P,T+1) :- choosenNote(P,T,N), choosenNote(P+1,T,N), not haveMet(P,T), part(P+1).haveMet(P,T+1) :- haveMet(P,T).% every note, the next note must be an other (up or down)1 { stepAt(P,T), leapAt(P,T) } 1 :- T != t.1 { downAt(P,T), upAt(P,T) } 1 :- T != t.

    % if melody does a jump, only harmonic intervals are allowed1 { leapBy(P,T,LS) : leapSize(LS) : LS > 0 } 1 :- leapUp(P,T).% if a voice changes of interval I the next note must be Isteps higher/lowerchoosenNote(P,T + 1,N + L) :- choosenNote(P,T,N), leapAt(P,T),leapBy(P,T,L), note(N + L).

  • 7/28/2019 Trends in Answer Set Programming

    21/31

    ANTON

    filling of bars no problem

    harmonisation no problem

    harmonisation rules (rules may be takenfrom J.S.Bach Choralgesnge

    consistent rules)

    ANTON produces diff. formats (i.e.Csound, Lilypond) and open for further

    ones

  • 7/28/2019 Trends in Answer Set Programming

    22/31

    Evaluation

    musical

    subjective by human(halftone quartertone

    music)

    technical

    ~200 loc for a script

    ALL libs and so on: ~800

    locSTRASHEELA (UCBelfast): 8000 loc

    BOL-Proc.-Script: 88000

    loc

  • 7/28/2019 Trends in Answer Set Programming

    23/31

    Work on ANTON

    better runtime performance (Anton 1.5)

    real time composition improvisation

    composing trios and quartets (Anton 1.5) rhythmic composition (Anton 1.5)

    recognizing and using of global structures

  • 7/28/2019 Trends in Answer Set Programming

    24/31

    ANTON 1.5 (no yet released)

    runtime for generating pieces for 1/2 voice(s)

    with _length_ notes

    0.22

    1.01

    2.27

    4.62

    0.33

    1.06

    2.42

    4.01

    0.77

    3.73

    16.84

    29.63

    old values

    1.18

    3.88

    14.50

    82.64

  • 7/28/2019 Trends in Answer Set Programming

    25/31

    ANTON 1.5

    runtime for generating pieces for 3/4 voice(s)

    with _length_ notes

  • 7/28/2019 Trends in Answer Set Programming

    26/31

    Example from ANTON 1.5

    code-remarks

    style(quartet).

    part(1..4).

    melodicPart(1).

    lowestPart(4).

    #const quartetBottomNote=1.#const quartetTopNote=68.

    % from contra C

    (lowest + 2 octaves 8vb) to

    g (highest + 2 octaves)

    4/4 or 6/4 or ??

    0:26

  • 7/28/2019 Trends in Answer Set Programming

    27/31

    Verification with lydian chromatic

    concept George Russel

    method of scale-finding for improvisation

    chord some lydian scale = parent scale

    chord

    lydian scale from note (b7, b9,-b5, maj = tonic)

    visualisation-model of Robert M. Wei

    (worked with George Russel) travelling through quint-circle

  • 7/28/2019 Trends in Answer Set Programming

    28/31

    Verification with lydian chromatic concept

    George Russel II

    A Child Is Born

  • 7/28/2019 Trends in Answer Set Programming

    29/31

    Conclusion / Future Work

    - Anton is some kind of composition- not the overall solution- would be useful if it works in realtime

    Future work: trying to get a verification

    model through my mathematicalvisualisation of music in architecture

  • 7/28/2019 Trends in Answer Set Programming

    30/31

    Reductio ad absurdum but good

    Bbmaj Eb7 Abmaj F#7b5 Fm7 Bb7#11 Ebmaj Abmaj||: ||

    B-7 A-5b13 E-7:|| ||

    || |

    | |Bbmaj Eb7

    Abmaj F#7b5 Fm7 Bb7#11 Ebmaj Abmaj|| | |

    (A)

    (B)

    | Gsus

    (A)

    Gsus |

    | Cmaj ||

    - odd count of bars

    - melody some chords (arbitrary)- most incorrect cadences

    - some correct cadences- global structure: AABA

    Christmas-Song Es ist ein Ro entsprungen

    0:49

    Q ll

  • 7/28/2019 Trends in Answer Set Programming

    31/31

    Quellen

    [1]

    Automatic Composition of Melodic and Harmonic Music by Answer Set Programming, Georg Boenn, Martin Brain, Marina DeVos, John ffitch, Cardiff School of Creative & Cultural Industries University of Glamorgan UK

    [2]

    ANTON: Composing Logic and Logic Composing, Georg Boenn, Martin Brain, Marina De Vos, John Ffitch, Cardiff School ofCreative & Cultural Industries University of Glamorgan UK

    [3]

    Ursprungskunst, Erhard Dinhobl, BSc-Thesis, 2008, TU Wien[4]

    Persnliche Korrespondenz mit Robert M. Weiss / Lehrgang Lydian Chromatic Concept am Josef M. Hauer KonservatoriumWr. Neustadt

    [5]

    Persnliche Korrespondenz mit Michael Brain, Entwickler ANTON

    [6]

    Das wohltemperierte Gehirn: Wie Musik im Kopf entsteht und wirkt, Robert Jourdain, Spektrum Verlag, 2001

    [7]

    Neue Jazz-Harmonielehre, Frank Sikora, SCHOTT, 2003[8]

    The Lydian Chromatic Concept of Tonal Organisation, George Russel, Concept Publishing Co. New York N.Y, 1953 (2001)

    [9]

    Automatic Composition using Anwer Set Programming, Georg Boenn, Martin Brain, Marina de Vos, John Ffitch, University ofGlamorgan, UK, 2009

    [10]

    389 Choralgesnge (fr vierstimmigen gemischten Chor), J.S.Bach

    [11]

    Knowledge, Representation, Reasoning and Declarative Problem solving, Chitta Baral, University of Cambridge, 2003[12]

    Logische Programme und Antwortensemantik II, Prof. Dr. Gabriele Kern-Isberner, Universitt Dortmund, 2004

    [13]

    Persnliche Korrespondenz mit Monika Etzelt

    Feel free to contact me: Erhard Dinhobl / [email protected]