Working with viewpoints » History » Version 11

Jeremy Gow, 2013-04-09 02:25 PM

1 1 Jeremy Gow
h1. Working with viewpoints
2 1 Jeremy Gow
3 6 Jeremy Gow
{{>toc}}
4 6 Jeremy Gow
5 3 Jeremy Gow
A number of functions are provided to help the user work with viewpoints and viewpoint data.
6 1 Jeremy Gow
7 5 Jeremy Gow
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.
8 5 Jeremy Gow
9 9 Jeremy Gow
h2. Viewpoint values
10 1 Jeremy Gow
11 4 Jeremy Gow
<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:
12 1 Jeremy Gow
13 1 Jeremy Gow
<pre>
14 4 Jeremy Gow
CL-USER> (music-data:composition-viewpoint 0 3 'cpint)
15 4 Jeremy Gow
(0 -300 0 -200 -200 0 -100 100 200 -200 500 0 0 0 -100 100 200 -700 0 0 0 400 0
16 4 Jeremy Gow
 100 200 0 -700 700 0 200 -200 -300 -400 200 -200)
17 4 Jeremy Gow
</pre>
18 4 Jeremy Gow
19 4 Jeremy Gow
And the linked viewpoint <code>'(cpint ioi)</code> has:
20 4 Jeremy Gow
21 4 Jeremy Gow
<pre>
22 1 Jeremy Gow
CL-USER> (music-data:composition-viewpoint 0 3 '(cpint ioi))
23 1 Jeremy Gow
((0 12) (-300 12) (0 12) (-200 12) (-200 24) (0 12) (-100 12) (100 12) (200 12)
24 1 Jeremy Gow
 (-200 24) (500 12) (0 12) (0 12) (0 12) (-100 12) (100 12) (200 12) (-700 60)
25 1 Jeremy Gow
 (0 12) (0 12) (0 12) (400 12) (0 12) (100 12) (200 12) (0 24) (-700 12)
26 1 Jeremy Gow
 (700 24) (0 12) (200 12) (-200 12) (-300 12) (-400 12) (200 12) (-200 12))
27 1 Jeremy Gow
</pre>
28 4 Jeremy Gow
29 4 Jeremy Gow
Similarly, <code>music-data:dataset-viewpoint</code> returns the values for all compositions in a specific dataset, as a list of lists:
30 4 Jeremy Gow
31 4 Jeremy Gow
<pre>
32 4 Jeremy Gow
CL-USER> (music-data:dataset-viewpoint 0 'cpint)
33 4 Jeremy Gow
((-300 -200 0 0 0 500 0 0 400 0 0 0 0 -200 -200 0 0 -300 -200 0 500 400 0 -200
34 4 Jeremy Gow
  ...)
35 4 Jeremy Gow
 (300 -300 100 -300 200 -200 -300 -400 1200 -300 100 -300 0 200 100 200 -300
36 4 Jeremy Gow
  ...)
37 4 Jeremy Gow
...)
38 4 Jeremy Gow
 </pre>
39 4 Jeremy Gow
40 4 Jeremy Gow
You can also count the frequency of each symbol in a dataset (currently only implemented for numeric viewpoints):
41 4 Jeremy Gow
42 4 Jeremy Gow
<pre>
43 4 Jeremy Gow
CL-USER> (utils:numeric-frequencies (music-data:dataset-viewpoint 0 'cpint))
44 4 Jeremy Gow
((-1400 . 3) (-1200 . 24) (-1100 . 1) (-1000 . 5) (-900 . 28) (-800 . 58)
45 4 Jeremy Gow
 (-700 . 125) (-500 . 251) (-400 . 324) (-300 . 589) (-200 . 1408) (-100 . 341)
46 4 Jeremy Gow
 (0 . 2127) (100 . 414) (200 . 1318) (300 . 432) (400 . 309) (500 . 435)
47 4 Jeremy Gow
 (700 . 120) (800 . 11) (900 . 38) (1000 . 12) (1200 . 25) (1400 . 1)
48 4 Jeremy Gow
 (1900 . 1))
49 6 Jeremy Gow
</pre>
50 6 Jeremy Gow
51 10 Jeremy Gow
h2. List definitions
52 6 Jeremy Gow
53 6 Jeremy Gow
<code>viewpoints:list-viewpoints</code> returns a list of currently defined viewpoints::
54 6 Jeremy Gow
55 6 Jeremy Gow
<pre>
56 6 Jeremy Gow
CL-USER> (viewpoints:list-viewpoints)
57 6 Jeremy Gow
(VIEWPOINTS::ARTICULATION VIEWPOINTS::COMMA VIEWPOINTS::VOICE
58 6 Jeremy Gow
                          VIEWPOINTS::ORNAMENT VIEWPOINTS::DYN
59 6 Jeremy Gow
...)
60 4 Jeremy Gow
</pre>
61 7 Jeremy Gow
62 1 Jeremy Gow
Similarly, particular kinds of viewpoints can be listed using <code>viewpoints:list-basic</code>, <code>viewpoints:list-derived</code>, <code>viewpoints:list-linked</code> and <code>viewpoints:list-threaded</code>.
63 10 Jeremy Gow
64 10 Jeremy Gow
h2. FInd predictors
65 10 Jeremy Gow
66 11 Jeremy Gow
The predictors for a list of viewpoints --- i.e. the source viewpoints capable of predicting one or more of them --- can be listed as follows:
67 10 Jeremy Gow
68 10 Jeremy Gow
<pre>
69 10 Jeremy Gow
CL-USER> (viewpoints:predictors '(bioi))
70 10 Jeremy Gow
(VIEWPOINTS::BIOI-RATIO VIEWPOINTS::BIOI-CONTOUR VIEWPOINTS::BIOI)
71 10 Jeremy Gow
</pre>