List of viewpoints » History » Version 2

Version 1 (Marcus Pearce, 2012-02-02 12:02 PM) → Version 2/9 (Marcus Pearce, 2012-04-27 10:11 AM)

Based on "Pearce [2005]":http://webprojects.eecs.qmul.ac.uk/marcusp/papers/Pearce2005.pdf especially table 5.2, p 80 and the relevant source code - mostly <pre>viewpoint-definitions.lisp</pre> in amuse-viewpoints. Entry order is based on category, then order of appearance in source file. h1. Adding Viewpoints

h1. h2. Basic Viewpoints

Unless otherwise indicated, these give information about
viewpoints

1. Add
the last event viewpoint definition to viewpoint-definitions.lisp in the sequence amuse-viewpoints:

* *onset:* Start time (using <pre>amuse:timepoint</pre>) &lt;pre&gt;
* *cpitch:* Midi pitch number, where chromatic notes are counted up and down from middle C = 60 (uses <pre>amuse:chromatic-pitch-number</pre>) (define-basic-viewpoint ornament (events)
(let ((x (amuse-mtp::%mtp-ornament (car (last events)))))
(if x x viewpoints:+undefined+)))

* *dur:* Duration (using <pre>amuse:duration</pre>)
* *keysig:* Integer indicating the position of the key signature on a line of fifths with C major = 0. Roughly corresponds
&lt;/pre&gt;

Ideally, we would have an amuse interface
to a positive count of ornaments to make this general. I.e., we would replace the number of sharps or a negative count of call the number of flats (corresponds exactly if the range &lt;code&gt;%mtp-ornament&lt;/code&gt; (which is limited as indicated in specific to the table mtp backend) above with one to +/-7, since this avoids double accidentals, but that limitation appears unjustified in the general case). Uses <pre>amuse:key-signature-sharps</pre>.
* *mode:* Major = 0, minor = 9 (the choice
&lt;code&gt;amuse:event-ornament&lt;/code&gt; which would have implementations for all of 9 is based on an article about pitch sets in modes, allowing a crude representation of the simpler common modes: Dorian backends.

2. Here
is 2, Lydian 5, etc).
* *tempo:* Currently applicable tempo in bpm.
* *pulses:* Beats/pulses/tactus units in a bar (uses <pre>amuse:beat-units-per-bar</pre> on
how the applicable time signature - this may give interesting results implementation goes for unusual cases).
* *barlength:* Basic time units (ticks) in
the mtp backend:

2a. Add
a bar, based on the timebase (N.B. Viewpoints export information column to a database and so avoid the arbitrary fractions used mtp-event table in amuse as a whole) the database

&lt;pre&gt;
(clsql:execute-command &quot;ALTER TABLE mtp_event ADD ornament INT DEFAULT &#x27;0&#x27;;&quot;)

* *deltast:* Gap between last note and its predecessor (returns 0 for first note).
* *bioi:* Basic Inter Onset Interval between ultimate and penultimate onsets (returns 0 for first note).
* *phrase:* 1 if event begins a phrase, -1 if it ends a phrase. Otherwise 0.
&lt;/pre&gt;

_Additional viewpoints (since Pearce, 2005)_

* *mpitch:* Meredith's morphetic pitch - count of name-notes (white notes) up or down from middle C = 35 (N.B. This number itself is 12 greater than
2b. In &lt;code&gt;amuse/implementations/mtp/classes.lisp&lt;/code&gt;:

add
the one used for slot definition &lt;code&gt;(ornament :initarg :ornament :accessor %mtp-ornament)&lt;/code&gt; to the same purpose by AMuSE. I don't remember why or which DM himself uses - DL)
* *accidental:* Inflection of name note, so 0
class definition for a natural, 1 for a single sharp, 2 for a double sharp, -1 for a flat and so on. Uses <pre>amuse:diatonic-pitch-accidental</pre> &lt;code&gt;mtp-event&lt;/code&gt;

_Viewpoints awaiting a general Amuse implementation_

* *dyn:* (dynamics): ppppp = -11; pppp = -9; ppp = -7; pp = -5; p = -3; mp = -1; mf = 1; f = 3; ff = 5; fff = 7; ffff = 9; fffff = 11
* *voice:* voice number in a score (voice 0 assumed
2c. In &lt;code&gt;amuse/implementations/mtp/methods.lisp&lt;/code&gt;:

add &lt;code&gt;ornament&lt;/code&gt;
to be the monody)
* *ornament:* note ornaments (0 = no ornament; 1 = accacciatura; 2 = mordent; 3 = trill)
* *comma:* 0 = no comma; 1 = comma (breath mark)
* *articulation:* 0 = no articulation mark; 1 = staccato; 2 = staccatissimo; 3 = sforzando; 4 = marcato

(These have _to do_ notes
obvious places in <pre>viewpoint-definitions.lisp</pre>.) the variable &lt;code&gt;*event-attributes*&lt;/code&gt; and the function &lt;code&gt;db-event-&gt;mtp-event&lt;/code&gt;

h1. h2. Derived Viewpoints

h2. Primitive derived
viewpoints

* *ioi:* (onset) - Like bioi, though giving +undefined+ for one-event sequence.
* *posinbar:* (onset) - Time offset from beginning


As
of bar.
* *dur-ratio:* (dur) - Duration of last / duration of previous
* *referent:* (keysig) - Chromatic interval of tonic from C (e.g. C major gives 0, F minor gives 5, F major also 5, Bb minor 10). Necessary
2012-26-01, the procedure for deriving scale degree.
* *cpint:* (cpitch) - Chromatic pitch interval
* *contour:* (cpitch) - -1 for a descending interval, 0 unison, 1 ascending (equivalent
adding derived viewpoints is to d, r and u respectively in [http://en.wikipedia.org/wiki/Parsons_code Parson&rsquo;s code]).
* *cpitch-class:* (cpitch) - cpitch modulo 12 (so C = 0, D = 2, etc.)
* *cpcint:* (cpitch) - equivalent
add the viewpoint definition to cpint modulo 12 (so both perfect unison and perfect octave = 0), but _preserving sign_, so ascending and descending intervals are still discriminated. (It looks like this was originally calculated as cpcint-size and then redefined when cpcint-size was added. This makes it more consistent with cpint.)
* *cpintfref:* (cpitch) - Chromatic interval from tonic (0 = tonic, 4 mediant, 7 dominant, etc.)
* *cpintfip:* (cpitch) - Chromatic interval from first event in piece.
* *cpintfiph:* (cpitch) - Chromatic interval from first event in phrase.
* *cpintfib:* (cpitch) - Chromatic interval from event at time 0 in bar (+undefined+ if event is itself at time 0 or if there is nothing at time 0).
* *inscale:* (cpitch) - Returns 1 if event would not require an accidental as a result of
the prevailing key signature and 0 if it would (i.e. file &lt;code&gt;viewpoint-definitions.lisp&lt;/code&gt; in A minor, members of amuse-viewpoints using the set {A, B, C, D, E, F, G} return true, with all others, including macro &lt;code&gt;define-viewpoint&lt;/code&gt; which has the leading note returning 0). following signature:

_Additional viewpoints (not in Pearce 2005)_ &lt;pre&gt;(define-viewpoint (_viewpoint-name_ _viewpoint-type_ (_type-set_)) (_events_ _element_) :function _viewpoint-function_ :function* _inverse-function_)&lt;/pre&gt;

* *ioi-ratio:* (onset) - ioi divided by _viewpoint-name_: a symbol naming the previous ioi (requires at least 3 events).
viewpoint
* *bioi-ratio:* (bioi) - bioi divided by _viewpoint-type_: a symbol giving the previous ioi (requires at least 3 events).
* *bioi-contour:* (bioi) - whether bioi gets larger, smaller or stays the same between consecutive events
* *lphrase:* (phrase) - I _think_ that this finds the duration
type of the preceding phrase iff the last event in the sequence is at a phrase boundary.
* *cpint-size:* (cpitch) - Absolute value
derived viewpoint (&lt;code&gt;derived&lt;/code&gt; for <pre>cpint<pre> (not to be confused with <pre>pint-size</pre>, which is 20fl.oz.)
* *newcontour:* (cpitch) - Returns 1 if contour is unchanged from preceding contour, 0 if it is different.&nabla;
* *cpcint-size:* (cpitch) - Absolute value
primitive derived; &lt;code&gt;test&lt;/code&gt; for cpcint. test; &lt;code&gt;threaded&lt;/code&gt; for threaded)
* *cpcint-2:* (cpitch) - cpcint-size modulo 2. No, I don't know why.
* *cpcint-3:* (cpitch) - cpcint-size modulo 3.
* *cpcint-4:* (cpitch) - cpcint-size modulo 4.
* *cpcint-5:* (cpitch) - cpcint-size modulo 5.
* *cpcint-6:* (cpitch) - cpcint-size modulo 6.
* *octave:* (cpitch) - Octave number, where middle C (and the 11 notes above)
_type-set_: a list of basic viewpoints that this viewpoint is 5 (based on chromatic pitch, so the same as (but 1 higher) <pre>amuse:octave</pre>, but different derived from <pre>amuse:diatonic-pitch octave</pre>, which takes spelling into account) and, therefore, capable of predicting
* *tessitura:*: (cpitch) Apparently based on something from _events_: a symbol denoting the Bach chorales. 0 if lower than F# above middle C (probably including the complete range of Bach basses), 1 if between that F# first argument to &#x27;&#x27;viewpoint-function&#x27;&#x27; and the D above it (no idea) and 2 if above that D (probably rare for altos in chorales, otherwise, top voice only). &#x27;&#x27;inverse-function&#x27;&#x27;
* *registral-direction:* (cpitch) Is _element_: a large (>= perfect fifth) jump followed by a direction change? Is a small (<= perfect fourth) jump followed by a move in symbol denoting the same direction? If the answer second argument to either is yes, return &#x27;&#x27;inverse-function&#x27;&#x27;
* _viewpoint-function_: a function of arity
1, otherwise 0. (N.B. which accepts a tritone move is undefined, I think because it isn't really relevant to list of events, the theory - the movement after &lt;code&gt;events&lt;/code&gt; symbol above, representing a tritone is almost always to resolve melody and returns a harmonic issue. Also, since this is based on chromatic intervals, despite my use value from the domain of diatonic ones in the description, a diminished fifth and an augmented fourth would look viewpoint being defined or the same). &lt;code&gt;+undefined+&lt;/code&gt; symbol
* *intervallic-difference:* (cpitch) Is _inverse-function_: a large jump followed by function of arity 2, accepting a smaller (3 semitones smaller if in list of events and an element from the same direction or 2 semitones if reversing domain of the direction) jump? Is a small jump followed by a similar interval? I think this viewpoint, which returns 1 in these cases, and 0 otherswise. I could be wrong.
* *registral-return:* (cpitch) If
the last three notes form a move away element from and then back to a pitch returns 3. If the returned to pitch is only a semitone away, returns 2, if a tone returns 1. Otherwise returns 0. The pitch contour must be an arch (\/ or /\), with a rising or falling contour or with any pitch repeated, this returns 0.
* *proximity:* (cpitch) 6 minus the number
domain of semitones in the last interval: 0 basic viewpoint which would generate the supplied element if applied to the last interval is a tritone or greater; 1 for a perfect fourth; 4 for a tone; 6 for a unison.
* *closure:* (cpitch) Also based on
supplied event list with the shape defined by the last 3 notes. Scores 1 point element removed (implemented for a change purposes of direction, 1 point for an interval that is more than a tone smaller than the preceding one (so score can be 0, 1, 2)
* *mpitch-class:* (mpitch) 0-7, representing the diatonic pitch set.
efficiency only and not required).

h2. Test viewpoints

So called because they return a boolean value testing whether a condition is satisfied at a particular point in a melody:
h3. Example

* *fib* (onset): First In Bar (is this the first note in the current bar?)
* *crotchet* (onset): is this note on
Define a crotchet pulse?
* *tactus* (onset): is this note on tactus pulse?
* *fiph* (phrase): is this note
viewpoint &lt;code&gt;cpint&lt;/code&gt; returning the first pitch interval in a phrase?
* *liph* (phrase): is this note
semitones between the last final two notes in a phrase?

h2. Threaded viewpoints

So called because they return the value of any viewpoint at locations defined by
melodic sequence given a test basic viewpoint (and are undefined wherever the test viewpoint is false) &lt;code&gt;cpitch&lt;/code&gt; which encodes chromatic pitch in semitones as midi note numbers:

* *thrbar* (cpitch onset): cpint % fib &lt;pre&gt;
* *thrfiph* (define-viewpoint (cpint derived (cpitch))
(events element)
:function (multiple-value-bind (e1 e2)
(values-list (last events 2))
(if (or (null e1) (null e2)) +undefined+
(let ((cpitch1
(cpitch onset): cpint % fiph
* *thrliph*
(list e1)))
(cpitch2
(cpitch onset): cpint % liph
* *thrqu*
(list e2))))
(if (undefined-p cpitch1 cpitch2) +undefined+
(- cpitch2 cpitch1)))))
:function* (list (+ element
(cpitch onset): cpint % crotchet (list (penultimate-element events))))))
* *thrtactus* (cpitch onset): cpint % tactus &lt;/pre&gt;
* *thrintfrefliph* (cpitch onset): cpintfref % liph

h2. Linked viewpoints

Any viewpoints, basic or derived, may be linked into product type whose domain (or alphabet) is the Cartesian product of the domains of the component viewpoints. Pearce (2005) limited himself to a fixed collection of links between two component (basic or primitive derived) viewpoints.