Working with viewpoints » History » Version 6
Version 5 (Jeremy Gow, 2013-04-09 01:06 PM) → Version 6/14 (Jeremy Gow, 2013-04-09 01:11 PM)
h1. Working with viewpoints
{{>toc}}
A number of functions are provided to help the user work with viewpoints and viewpoint data.
The [[List of Viewpoints|available viewpoints]] are described in "Pearce [2005]":http://webprojects.eecs.qmul.ac.uk/marcusp/papers/Pearce2005.pdf and implemented in the <code>derived-viewpoints/</code> directory in amuse-viewpoints. It is easy to implement new viewpoints, the examples in that file and [[Adding Viewpoints]] should help you get started.
h2. Inspecting viewpoint values
<code>music-data:composition-viewpoint</code> will return the viewpoint values for a specific composition. For example, for composition 3 of dataset 0, pitch interval has the following values:
<pre>
CL-USER> (music-data:composition-viewpoint 0 3 'cpint)
(0 -300 0 -200 -200 0 -100 100 200 -200 500 0 0 0 -100 100 200 -700 0 0 0 400 0
100 200 0 -700 700 0 200 -200 -300 -400 200 -200)
</pre>
And the linked viewpoint <code>'(cpint ioi)</code> has:
<pre>
CL-USER> (music-data:composition-viewpoint 0 3 '(cpint ioi))
((0 12) (-300 12) (0 12) (-200 12) (-200 24) (0 12) (-100 12) (100 12) (200 12)
(-200 24) (500 12) (0 12) (0 12) (0 12) (-100 12) (100 12) (200 12) (-700 60)
(0 12) (0 12) (0 12) (400 12) (0 12) (100 12) (200 12) (0 24) (-700 12)
(700 24) (0 12) (200 12) (-200 12) (-300 12) (-400 12) (200 12) (-200 12))
</pre>
Similarly, <code>music-data:dataset-viewpoint</code> returns the values for all compositions in a specific dataset, as a list of lists:
<pre>
CL-USER> (music-data:dataset-viewpoint 0 'cpint)
((-300 -200 0 0 0 500 0 0 400 0 0 0 0 -200 -200 0 0 -300 -200 0 500 400 0 -200
...)
(300 -300 100 -300 200 -200 -300 -400 1200 -300 100 -300 0 200 100 200 -300
...)
...)
</pre>
You can also count the frequency of each symbol in a dataset (currently only implemented for numeric viewpoints):
<pre>
CL-USER> (utils:numeric-frequencies (music-data:dataset-viewpoint 0 'cpint))
((-1400 . 3) (-1200 . 24) (-1100 . 1) (-1000 . 5) (-900 . 28) (-800 . 58)
(-700 . 125) (-500 . 251) (-400 . 324) (-300 . 589) (-200 . 1408) (-100 . 341)
(0 . 2127) (100 . 414) (200 . 1318) (300 . 432) (400 . 309) (500 . 435)
(700 . 120) (800 . 11) (900 . 38) (1000 . 12) (1200 . 25) (1400 . 1)
(1900 . 1))
</pre>
h2. Defined viewpoints
<code>viewpoints:list-viewpoints</code> returns a list of currently defined viewpoints::
<pre>
CL-USER> (viewpoints:list-viewpoints)
(VIEWPOINTS::ARTICULATION VIEWPOINTS::COMMA VIEWPOINTS::VOICE
VIEWPOINTS::ORNAMENT VIEWPOINTS::DYN
...)
</pre>
{{>toc}}
A number of functions are provided to help the user work with viewpoints and viewpoint data.
The [[List of Viewpoints|available viewpoints]] are described in "Pearce [2005]":http://webprojects.eecs.qmul.ac.uk/marcusp/papers/Pearce2005.pdf and implemented in the <code>derived-viewpoints/</code> directory in amuse-viewpoints. It is easy to implement new viewpoints, the examples in that file and [[Adding Viewpoints]] should help you get started.
h2. Inspecting viewpoint values
<code>music-data:composition-viewpoint</code> will return the viewpoint values for a specific composition. For example, for composition 3 of dataset 0, pitch interval has the following values:
<pre>
CL-USER> (music-data:composition-viewpoint 0 3 'cpint)
(0 -300 0 -200 -200 0 -100 100 200 -200 500 0 0 0 -100 100 200 -700 0 0 0 400 0
100 200 0 -700 700 0 200 -200 -300 -400 200 -200)
</pre>
And the linked viewpoint <code>'(cpint ioi)</code> has:
<pre>
CL-USER> (music-data:composition-viewpoint 0 3 '(cpint ioi))
((0 12) (-300 12) (0 12) (-200 12) (-200 24) (0 12) (-100 12) (100 12) (200 12)
(-200 24) (500 12) (0 12) (0 12) (0 12) (-100 12) (100 12) (200 12) (-700 60)
(0 12) (0 12) (0 12) (400 12) (0 12) (100 12) (200 12) (0 24) (-700 12)
(700 24) (0 12) (200 12) (-200 12) (-300 12) (-400 12) (200 12) (-200 12))
</pre>
Similarly, <code>music-data:dataset-viewpoint</code> returns the values for all compositions in a specific dataset, as a list of lists:
<pre>
CL-USER> (music-data:dataset-viewpoint 0 'cpint)
((-300 -200 0 0 0 500 0 0 400 0 0 0 0 -200 -200 0 0 -300 -200 0 500 400 0 -200
...)
(300 -300 100 -300 200 -200 -300 -400 1200 -300 100 -300 0 200 100 200 -300
...)
...)
</pre>
You can also count the frequency of each symbol in a dataset (currently only implemented for numeric viewpoints):
<pre>
CL-USER> (utils:numeric-frequencies (music-data:dataset-viewpoint 0 'cpint))
((-1400 . 3) (-1200 . 24) (-1100 . 1) (-1000 . 5) (-900 . 28) (-800 . 58)
(-700 . 125) (-500 . 251) (-400 . 324) (-300 . 589) (-200 . 1408) (-100 . 341)
(0 . 2127) (100 . 414) (200 . 1318) (300 . 432) (400 . 309) (500 . 435)
(700 . 120) (800 . 11) (900 . 38) (1000 . 12) (1200 . 25) (1400 . 1)
(1900 . 1))
</pre>
h2. Defined viewpoints
<code>viewpoints:list-viewpoints</code> returns a list of currently defined viewpoints::
<pre>
CL-USER> (viewpoints:list-viewpoints)
(VIEWPOINTS::ARTICULATION VIEWPOINTS::COMMA VIEWPOINTS::VOICE
VIEWPOINTS::ORNAMENT VIEWPOINTS::DYN
...)
</pre>