Database » History » Version 19
Marcus Pearce, 2016-05-03 02:54 PM
1 | 2 | Jeremy Gow | h1. Database management |
---|---|---|---|
2 | 1 | Jeremy Gow | |
3 | 1 | Jeremy Gow | {{>toc}} |
4 | 11 | Marcus Pearce | |
5 | 15 | Marcus Pearce | Having [[Installation|Installed and started IDyOM and connected to a database]], you can edit and examine the contents of the database and import/export data to/from it. |
6 | 1 | Jeremy Gow | |
7 | 12 | Marcus Pearce | h2. Importing data |
8 | 12 | Marcus Pearce | |
9 | 17 | Marcus Pearce | Before you can do anything you will need to import some data. Methods exist for **kern files (see "Kernscores":http://kern.ccarh.net) and midi files. |
10 | 12 | Marcus Pearce | |
11 | 12 | Marcus Pearce | <pre> |
12 | 16 | Marcus Pearce | CL-USER> (idyom-db:import-data :krn "/home/mas01mtp/research/data/kern/shanxi237/" "A test dataset" 31) |
13 | 12 | Marcus Pearce | Inserting data into database: dataset 31. |
14 | 12 | Marcus Pearce | NIL |
15 | 16 | Marcus Pearce | CL-USER> (idyom-db:describe-dataset 31) |
16 | 12 | Marcus Pearce | |
17 | 12 | Marcus Pearce | A test dataset |
18 | 12 | Marcus Pearce | ----------------------------------------------------------------------------- |
19 | 12 | Marcus Pearce | ID No. Compositions No. events Mean events/composition |
20 | 12 | Marcus Pearce | 31 237 11056 46.649788 |
21 | 14 | Marcus Pearce | ----------------------------------------------------------------------------- |
22 | 14 | Marcus Pearce | NIL |
23 | 12 | Marcus Pearce | CL-USER> |
24 | 12 | Marcus Pearce | </pre> |
25 | 12 | Marcus Pearce | |
26 | 12 | Marcus Pearce | <pre> |
27 | 16 | Marcus Pearce | CL-USER> (idyom-db:import-data :mid "/home/marcusp/research/data/midi/Witchcraft/" "Melodies used in an experiment by de Noojier et al. (2008)" 32) |
28 | 12 | Marcus Pearce | |
29 | 18 | Marcus Pearce | Inserting data into database: dataset 32. |
30 | 18 | Marcus Pearce | NIL |
31 | 16 | Marcus Pearce | CL-USER> (idyom-db:describe-dataset 32) |
32 | 12 | Marcus Pearce | |
33 | 12 | Marcus Pearce | Melodies used in de Noojier et al. (2008) |
34 | 12 | Marcus Pearce | ----------------------------------------------------------------------------- |
35 | 12 | Marcus Pearce | ID No. Compositions No. events Mean events/composition |
36 | 12 | Marcus Pearce | 32 10 313 31.3 |
37 | 12 | Marcus Pearce | ----------------------------------------------------------------------------- |
38 | 13 | Marcus Pearce | </pre> |
39 | 12 | Marcus Pearce | |
40 | 6 | Jeremy Gow | h2. Describing the database |
41 | 6 | Jeremy Gow | |
42 | 4 | Jeremy Gow | A quick way of listing the database contents is: |
43 | 4 | Jeremy Gow | |
44 | 1 | Jeremy Gow | <pre> |
45 | 16 | Marcus Pearce | CL-USER> (idyom-db:describe-database) |
46 | 5 | Jeremy Gow | 0 Songs and ballads from Nova Scotia, Canada. |
47 | 5 | Jeremy Gow | 1 Chorale melodies harmonised by J.S. Bach. |
48 | 5 | Jeremy Gow | 2 Chorale soprano melodies harmonised by J.S. Bach. |
49 | 5 | Jeremy Gow | 3 Alsatian folk songs from the Essen Folk Song Collection. |
50 | 4 | Jeremy Gow | ... |
51 | 4 | Jeremy Gow | </pre> |
52 | 1 | Jeremy Gow | |
53 | 8 | Marcus Pearce | Datasets can be examine in more detail using the verbose option in <code>describe-database</code> and <code>describe-dataset</code>: |
54 | 4 | Jeremy Gow | <pre> |
55 | 16 | Marcus Pearce | CL-USER> (idyom-db:describe-database :verbose t) |
56 | 1 | Jeremy Gow | |
57 | 1 | Jeremy Gow | Songs and ballads from Nova Scotia, Canada. |
58 | 1 | Jeremy Gow | ----------------------------------------------------------------------------- |
59 | 1 | Jeremy Gow | ID No. Compositions No. events Mean events/composition |
60 | 1 | Jeremy Gow | 0 152 8552 56.263157 |
61 | 1 | Jeremy Gow | ----------------------------------------------------------------------------- |
62 | 1 | Jeremy Gow | |
63 | 1 | Jeremy Gow | Chorale melodies harmonised by J.S. Bach. |
64 | 1 | Jeremy Gow | ----------------------------------------------------------------------------- |
65 | 1 | Jeremy Gow | ID No. Compositions No. events Mean events/composition |
66 | 1 | Jeremy Gow | 1 185 9227 49.875675 |
67 | 1 | Jeremy Gow | ----------------------------------------------------------------------------- |
68 | 1 | Jeremy Gow | |
69 | 1 | Jeremy Gow | Chorale soprano melodies harmonised by J.S. Bach. |
70 | 1 | Jeremy Gow | ----------------------------------------------------------------------------- |
71 | 1 | Jeremy Gow | ID No. Compositions No. events Mean events/composition |
72 | 1 | Jeremy Gow | 2 100 4693 46.93 |
73 | 1 | Jeremy Gow | ----------------------------------------------------------------------------- |
74 | 1 | Jeremy Gow | |
75 | 1 | Jeremy Gow | Alsatian folk songs from the Essen Folk Song Collection. |
76 | 1 | Jeremy Gow | ----------------------------------------------------------------------------- |
77 | 1 | Jeremy Gow | ID No. Compositions No. events Mean events/composition |
78 | 1 | Jeremy Gow | 3 91 4496 49.406593 |
79 | 1 | Jeremy Gow | ----------------------------------------------------------------------------- |
80 | 1 | Jeremy Gow | |
81 | 1 | Jeremy Gow | ... |
82 | 1 | Jeremy Gow | |
83 | 8 | Marcus Pearce | Pop melodies used in a segmentation experiment with Daniel Muellensiefen. |
84 | 1 | Jeremy Gow | ----------------------------------------------------------------------------- |
85 | 1 | Jeremy Gow | ID No. Compositions No. events Mean events/composition |
86 | 1 | Jeremy Gow | 29 15 1265 84.333336 |
87 | 1 | Jeremy Gow | ----------------------------------------------------------------------------- |
88 | 1 | Jeremy Gow | |
89 | 1 | Jeremy Gow | Hymn melodies from Hymns Ancient and Modern. |
90 | 1 | Jeremy Gow | ----------------------------------------------------------------------------- |
91 | 1 | Jeremy Gow | ID No. Compositions No. events Mean events/composition |
92 | 1 | Jeremy Gow | 30 120 4280 35.666668 |
93 | 1 | Jeremy Gow | ----------------------------------------------------------------------------- |
94 | 1 | Jeremy Gow | (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30) |
95 | 1 | Jeremy Gow | </pre> |
96 | 6 | Jeremy Gow | |
97 | 1 | Jeremy Gow | <pre> |
98 | 16 | Marcus Pearce | CL-USER> (idyom-db:describe-dataset 0 :verbose t) |
99 | 1 | Jeremy Gow | |
100 | 1 | Jeremy Gow | Songs and ballads from Nova Scotia, Canada. |
101 | 1 | Jeremy Gow | ----------------------------------------------------------------------------- |
102 | 1 | Jeremy Gow | ID No. Compositions No. events Mean events/composition |
103 | 1 | Jeremy Gow | 0 152 8552 56.263157 |
104 | 1 | Jeremy Gow | ----------------------------------------------------------------------------- |
105 | 1 | Jeremy Gow | CPITCH (26): (54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
106 | 1 | Jeremy Gow | 72 73 74 75 76 77 79 81) |
107 | 1 | Jeremy Gow | MPITCH (17): (31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47) |
108 | 1 | Jeremy Gow | ACCIDENTAL (3): (-1 0 1) |
109 | 1 | Jeremy Gow | DUR (14): (3 4 6 8 12 16 18 24 36 48 60 72 96 120) |
110 | 1 | Jeremy Gow | DELTAST (7): (0 12 24 36 48 60 72) |
111 | 1 | Jeremy Gow | BIOI (17): (1 3 4 6 8 12 16 18 24 30 36 48 60 72 84 96 120) |
112 | 1 | Jeremy Gow | KEYSIG (9): (-4 -3 -2 -1 0 1 2 3 4) |
113 | 1 | Jeremy Gow | MODE (2): (0 9) |
114 | 1 | Jeremy Gow | BARLENGTH (7): (36 48 72 96 120 144 168) |
115 | 1 | Jeremy Gow | PULSES (6): (2 3 4 5 6 7) |
116 | 1 | Jeremy Gow | PHRASE (3): (-1 0 1) |
117 | 8 | Marcus Pearce | DYN (1): (NIL) |
118 | 1 | Jeremy Gow | TEMPO (19): (52 54 60 64 76 80 82 84 92 96 100 108 110 112 120 132 |
119 | 1 | Jeremy Gow | 144 152 172) |
120 | 1 | Jeremy Gow | VOICE (1): (1) |
121 | 1 | Jeremy Gow | -----------------------------------------------------------------------------NIL |
122 | 1 | Jeremy Gow | CL-USER> |
123 | 1 | Jeremy Gow | |
124 | 1 | Jeremy Gow | </pre> |
125 | 1 | Jeremy Gow | |
126 | 1 | Jeremy Gow | |
127 | 1 | Jeremy Gow | h2. Exporting data |
128 | 1 | Jeremy Gow | |
129 | 12 | Marcus Pearce | There are functions for exporting compositions from the database in a range of formats including midi. PDF scores can be created using third-party software called "Lilypond":http://www.lilypond.org/. |
130 | 12 | Marcus Pearce | |
131 | 1 | Jeremy Gow | <pre> |
132 | 16 | Marcus Pearce | CL-USER> (idyom-db:export-data (idyom-db:get-composition 31 0) :mid "/tmp/") |
133 | 1 | Jeremy Gow | NIL |
134 | 1 | Jeremy Gow | </pre> |
135 | 1 | Jeremy Gow | |
136 | 12 | Marcus Pearce | Produces a midi file in the "/tmp/" directory. |
137 | 1 | Jeremy Gow | |
138 | 6 | Jeremy Gow | <pre> |
139 | 16 | Marcus Pearce | CL-USER> (idyom-db:export-data (idyom-db:get-composition 31 0) :lisp "/tmp/") |
140 | 1 | Jeremy Gow | NIL |
141 | 1 | Jeremy Gow | </pre> |
142 | 1 | Jeremy Gow | |
143 | 12 | Marcus Pearce | Produces a lisp readable representation of the dataset (useful if one wants to read it back into the database). |
144 | 1 | Jeremy Gow | |
145 | 1 | Jeremy Gow | <pre> |
146 | 16 | Marcus Pearce | CL-USER> (idyom-db:export-data (idyom-db:get-composition 31 0) :ly "/tmp/") |
147 | 1 | Jeremy Gow | NIL |
148 | 1 | Jeremy Gow | </pre> |
149 | 1 | Jeremy Gow | |
150 | 1 | Jeremy Gow | Produces a lilypond file. |
151 | 1 | Jeremy Gow | |
152 | 1 | Jeremy Gow | <pre> |
153 | 16 | Marcus Pearce | CL-USER> (idyom-db:export-data (idyom-db:get-composition 31 0) :pdf "/tmp/") |
154 | 1 | Jeremy Gow | NIL |
155 | 1 | Jeremy Gow | </pre> |
156 | 1 | Jeremy Gow | |
157 | 1 | Jeremy Gow | Produces a pdf score (via lilypond). |
158 | 12 | Marcus Pearce | |
159 | 12 | Marcus Pearce | These functions also work for entire datasets. For example, |
160 | 12 | Marcus Pearce | |
161 | 12 | Marcus Pearce | <pre> |
162 | 16 | Marcus Pearce | CL-USER> (idyom-db:export-data (idyom-db:get-dataset 31) :mid "/tmp/") |
163 | 12 | Marcus Pearce | NIL |
164 | 12 | Marcus Pearce | </pre> |
165 | 12 | Marcus Pearce | |
166 | 12 | Marcus Pearce | exports the whole of dataset 31 to the "/tmp/" directory as midi files. |
167 | 1 | Jeremy Gow | |
168 | 1 | Jeremy Gow | h2. Deleting a dataset |
169 | 1 | Jeremy Gow | |
170 | 1 | Jeremy Gow | <pre> |
171 | 16 | Marcus Pearce | CL-USER> (idyom-db:delete-dataset 735) |
172 | 1 | Jeremy Gow | </pre> |
173 | 1 | Jeremy Gow | |
174 | 1 | Jeremy Gow | deletes dataset 735 from the database. |
175 | 19 | Marcus Pearce | |
176 | 19 | Marcus Pearce | h2. Copying and combining datasets |
177 | 19 | Marcus Pearce | |
178 | 19 | Marcus Pearce | <pre> |
179 | 19 | Marcus Pearce | CL-USER> (idyom-db:copy-datasets 4 '(1 2 3) "Combination of datasets 1 2 3.") |
180 | 19 | Marcus Pearce | </pre> |
181 | 19 | Marcus Pearce | |
182 | 19 | Marcus Pearce | This will create a new dataset 4 which is the result of combining existing datasets 1, 2 and 3. |