j@253
|
1 (cl:in-package #:amuse-geerdes)
|
j@253
|
2
|
j@253
|
3 ;;; The idea of Charm constituents here is closely tied up with the
|
j@253
|
4 ;;; database. The basic constructors below will work without a working
|
j@253
|
5 ;;; database, but obviously not the store and get stuff.
|
j@253
|
6
|
j@253
|
7 (asdf:oos 'asdf:load-op 'amuse-geerdes)
|
j@253
|
8 (asdf:oos 'asdf:load-op 'geerdes-tools)
|
j@253
|
9 (asdf:oos 'asdf:load-op 'amuse-charm)
|
j@253
|
10 (use-package 'amuse-charm)
|
j@253
|
11
|
j@253
|
12 (defparameter *charm-database* ; just for testing
|
j@253
|
13 (connect-to-database :database-name "amuse_charm"
|
j@253
|
14 :username "jamie"
|
j@253
|
15 :make-default nil))
|
j@253
|
16 (disconnect-from-database *charm-database*)
|
j@253
|
17
|
j@253
|
18 (connect-to-database) ; default amuse connection for getting geerdes data
|
j@253
|
19 (disconnect-from-database)
|
j@253
|
20
|
j@253
|
21 ;(create-charm-db-tables *charm-database*)
|
j@253
|
22 ;(drop-charm-db-tables *charm-database*)
|
j@253
|
23
|
j@253
|
24 (defparameter *composition*
|
j@253
|
25 (get-composition (g-id-file-id 1)))
|
j@253
|
26
|
j@253
|
27 (defparameter *charm-constituent-composition*
|
j@253
|
28 (composition->charm-constituent *composition*
|
j@253
|
29 (make-charm-property-list
|
j@253
|
30 'composition)
|
j@253
|
31 (make-charm-property-list
|
j@253
|
32 'polyphonic)))
|
j@253
|
33
|
j@253
|
34 (defparameter *charm-constituent-composition-identifier*
|
j@253
|
35 (store-charm-constituent *charm-constituent-composition*
|
j@253
|
36 *charm-database*))
|
j@253
|
37
|
j@253
|
38 (defparameter *charm-constituent-composition-db*
|
j@253
|
39 (get-charm-constituent *charm-constituent-composition-identifier*
|
j@253
|
40 *charm-database*))
|
j@253
|
41
|
j@253
|
42
|
j@253
|
43 ;;; Slice composition into segments
|
j@253
|
44
|
j@253
|
45 (defparameter *onset-segments-constituent*
|
j@253
|
46 (make-onset-segment-constituent *composition*))
|
j@253
|
47
|
j@253
|
48 (defparameter *onset-segment-constituent-identifier*
|
j@253
|
49 (store-charm-constituent *onset-segments-constituent*
|
j@253
|
50 *charm-database*))
|
j@253
|
51
|
j@253
|
52 (defparameter *charm-constituent-composition-db*
|
j@253
|
53 (get-charm-constituent *onset-segment-constituent-identifier* ;1922
|
j@253
|
54 *charm-database*))
|
j@253
|
55
|
j@253
|
56 ;;; Bar segments
|
j@253
|
57
|
j@253
|
58 (defparameter *bar-segments-constituent*
|
j@253
|
59 (segment-at-bar *composition*))
|
j@253
|
60
|
j@253
|
61
|
j@253
|
62 ;;; Part-like constituents.
|
j@253
|
63
|
j@253
|
64 (defparameter *lead-vocals*
|
j@253
|
65 (geerdes-tools:vocal-part *composition*))
|
j@253
|
66
|
j@253
|
67 (defparameter *charm-vocals*
|
j@253
|
68 (composition->charm-constituent *lead-vocals*
|
j@253
|
69 (make-charm-property-list 'voice
|
j@253
|
70 'monophonic)
|
j@253
|
71 (make-charm-property-list 'song)))
|
j@253
|
72
|
j@253
|
73 (defparameter *charm-vocals-identifier*
|
j@253
|
74 (store-charm-constituent *charm-vocals* *charm-database*))
|
j@253
|
75
|
j@253
|
76 (defparameter *charm-vocals-db*
|
j@253
|
77 (get-charm-constituent *charm-vocals-identifier*
|
j@253
|
78 *charm-database*))
|
j@253
|
79
|
j@253
|
80 (defparameter *bass-guitar*
|
j@253
|
81 (geerdes-tools:bass-part *composition*))
|
j@253
|
82
|
j@253
|
83 (defparameter *charm-bass*
|
j@253
|
84 (composition->charm-constituent *bass-guitar*
|
j@253
|
85 (make-charm-property-list 'guitar
|
j@253
|
86 'polyphonic)
|
j@253
|
87 (make-charm-property-list 'song)))
|
j@253
|
88
|
j@253
|
89 (defparameter *charm-bass-identifier*
|
j@253
|
90 (store-charm-constituent *charm-bass* *charm-database*))
|
j@253
|
91
|
j@253
|
92 (defparameter *charm-bass-db*
|
j@253
|
93 (get-charm-constituent *charm-bass-identifier* *charm-database*))
|
j@253
|
94
|
j@253
|
95
|
j@253
|
96 ;;; Combine above as events.
|
j@253
|
97
|
j@253
|
98 (defparameter *bass+vocals-constituent1*
|
j@253
|
99 (make-standard-charm-constituent
|
j@253
|
100 (append (%list-slot-sequence-data *charm-bass*)
|
j@253
|
101 (%list-slot-sequence-data *charm-vocals*)) *composition*
|
j@253
|
102 (make-charm-property-list 'vocal 'bass-guitar 'polyphonic)
|
j@253
|
103 (make-charm-property-list 'song)))
|
j@253
|
104
|
j@253
|
105 (defparameter *bass+vocals-constituent1-identifier*
|
j@253
|
106 (store-charm-constituent *bass+vocals-constituent1* *charm-database*))
|
j@253
|
107
|
j@253
|
108 (defparameter *bass+vocals-constituent1-db*
|
j@253
|
109 (get-charm-constituent *bass+vocals-constituent1-identifier*
|
j@253
|
110 *charm-database*))
|
j@253
|
111
|
j@253
|
112
|
j@253
|
113 ;;; Combine above as constituents
|
j@253
|
114
|
j@253
|
115 (defparameter *bass+vocals-constituent2*
|
j@253
|
116 (make-standard-charm-constituent
|
j@253
|
117 (list *charm-bass* *charm-vocals*)
|
j@253
|
118 *composition*
|
j@253
|
119 (make-charm-property-list 'vocal 'bass-guitar 'polyphonic)
|
j@253
|
120 (make-charm-property-list 'song)))
|
j@253
|
121
|
j@253
|
122 (defparameter *bass+vocals-constituent2-identifier*
|
j@253
|
123 (store-charm-constituent *bass+vocals-constituent2*
|
j@253
|
124 *charm-database*))
|
j@253
|
125
|
j@253
|
126 (defparameter *bass+vocals-constituent2-db*
|
j@253
|
127 (get-charm-constituent *bass+vocals-constituent2-identifier*
|
j@253
|
128 *charm-database*))
|