Skip to content

Commit f465a0b

Browse files
authored
Update Example_of_OSC_messages_Dyci2_server.md
1 parent 8b5f2dc commit f465a0b

1 file changed

Lines changed: 218 additions & 68 deletions

File tree

Lines changed: 218 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,146 +1,296 @@
1-
#Example of OSC messages to / from Dicy2 server
1+
# Example of OSC messages to / from Dicy2 server
22

3-
This example corresponds to `tab 2` in tutorial `2_Chaining_Agents.maxpat` in [Dicy2 for Max](https://forum.ircam.fr/projects/detail/dicy2/)
3+
This example comes from `tab 2` in tutorial `2_Chaining_Agents.maxpat` in [Dicy2 for Max](https://forum.ircam.fr/projects/detail/dicy2/): In this patch we chain two agents trained on data representing different levels of musical hierarchy to create a composition process that operates at multiple scales.
4+
5+
Agent_Audio is trained on the labeled segments we have previously encountered in our first audio tutorial, and will supply the final output. Agent_Form is trained on a corpus of musical sequences comprised of the same labels, thus creating a set of higher-level gestures.
6+
7+
Scenarios sent to Agent_Form will generate sequences of these gestures, which are in turn passed to Agent_Audio as scenarios. This hierarchical model can be extended to any numer of levels, and the general approach can be applied to any use case such as MIDI or other modes of audio labeling.
8+
9+
10+
---
411

512
## Launch server
613

714
Launch `dicy2_server.app` with OSC ports as arguments
815
*NB: this applies of course to `dicy2_server.app` or to a server started from the Python code!*
916

10-
FROM_SERVER: /server initialized
11-
FROM_SERVER: /server status bang *... (then looped)*
17+
__FROM_SERVER:__
18+
19+
/server initialized
20+
21+
__FROM_SERVER:__
22+
23+
/server status bang *... (then looped)*
24+
25+
---
26+
27+
## 1 - Create two agents
28+
29+
30+
### 1.1 - Create first agent (labels=abstract musical gesture types, contents=sequences of vocal playing modes)
31+
32+
#### 1.1.1 - Create first agent "Agent_Form"
1233

34+
__TO_SERVER:__
1335

14-
## Create two agents
36+
/server create_agent /Agent_Form listlabel
1537

16-
### Create first agent (labels=abstract musical gesture types, contents=sequences of vocal playing modes)
38+
FROM_SERVER:
1739

18-
#### Create first agent "Agent_Form"
40+
/server info "Created new agent at '/Agent_Form'"
1941

20-
TO_SERVER: /server create_agent /Agent_Form listlabel
42+
__FROM_SERVER:__
2143

22-
FROM_SERVER: /server info "Created new agent at '/Agent_Form'"
23-
FROM_SERVER: /server create_agent /Agent_Form
24-
FROM_SERVER: /Agent_Form initialized
25-
FROM_SERVER: /Agent_Form status bang *... (then looped)*
44+
/server create_agent /Agent_Form
45+
46+
__FROM_SERVER:__
47+
48+
/Agent_Form initialized
49+
50+
__FROM_SERVER:__
51+
52+
/Agent_Form status bang
53+
*... (then looped)*
2654

2755

28-
#### Setting some parameters for first agent (in particular the max_continuity parameters)
56+
#### 1.1.2 - Setting some parameters for first agent (in particular the max_continuity parameters)
57+
58+
__TO_SERVER:__
59+
60+
/Agent_Form set_control_parameter generator::prospector::\_navigator::max_continuity 6
61+
62+
__TO_SERVER:__
63+
64+
/Agent_Form set_control_parameter generator::force_output 1
65+
66+
__TO_SERVER:__
67+
68+
/Agent_Form clear listlabel
69+
70+
__FROM_SERVER:__
2971

30-
TO_SERVER: /Agent_Form set_control_parameter generator::prospector::\_navigator::max_continuity 6
31-
TO_SERVER: /Agent_Form set_control_parameter generator::force_output 1
32-
TO_SERVER: /Agent_Form clear listlabel
72+
/Agent_Form clear ListLabel ...
73+
(+ list of default paramaters)
3374

34-
FROM_SERVER: /Agent_Form clear ListLabel ... (+ list of default paramaters)
3575

76+
#### 1.1.3 - Learning a sequence in first agent (labels=abstract musical gesture types, contents=sequences of vocal playing modes)
3677

37-
#### Learning a sequence in first agent (labels=abstract musical gesture types, contents=sequences of vocal playing modes)
78+
__TO_SERVER:__
79+
80+
/Agent_Form learn_event listlabel Gesture_type_1 "Agilita Breath Ribatutto Silence Staccato Tenuto"
81+
82+
__TO_SERVER:__
83+
84+
/Agent_Form learn_event listlabel Gesture_type_2 "Staccato Staccato Staccato"
3885

39-
TO_SERVER: /Agent_Form learn_event listlabel Gesture_type_1 "Agilita Breath Ribatutto Silence Staccato Tenuto"
40-
TO_SERVER: /Agent_Form learn_event listlabel Gesture_type_2 "Staccato Staccato Staccato"
4186
(... send other couples {label} {content})
4287

43-
FROM_SERVER: /Agent_Form new_event_learned "Agilita Breath Ribatutto Silence Staccato Tenuto"
44-
FROM_SERVER: /Agent_Form info "Learned event 'Agilita Breath Ribatutto Silence Staccato Tenuto'"
45-
FROM_SERVER: /Agent_Form new_event_learned "Staccato Staccato Staccato"
46-
FROM_SERVER: /Agent_Form info "Learned event 'Staccato Staccato Staccato'"
88+
__FROM_SERVER:__
89+
90+
/Agent_Form new_event_learned "Agilita Breath Ribatutto Silence Staccato Tenuto"
91+
92+
__FROM_SERVER:__
93+
94+
/Agent_Form info "Learned event 'Agilita Breath Ribatutto Silence Staccato Tenuto'"
95+
96+
__FROM_SERVER:__
97+
98+
/Agent_Form new_event_learned "Staccato Staccato Staccato"
99+
100+
__FROM_SERVER:__
101+
102+
/Agent_Form info "Learned event 'Staccato Staccato Staccato'"
47103
(... feedback other couples {label} {content})
48104

49-
### Create second agent (labels=vocal playing mode, contents=corresponding markers in an audio file)
105+
---
106+
107+
### 1.2 - Create second agent (labels=vocal playing mode, contents=corresponding markers in an audio file)
108+
109+
#### 1.2.1 - Create second agent "Agent_Audio"
110+
111+
__TO_SERVER:__
112+
113+
/server create_agent /Agent_Audio listlabel
114+
115+
FROM_SERVER:
116+
117+
/server info "Created new agent at '/Agent_Audio'"
118+
119+
__FROM_SERVER:__
120+
121+
/server create_agent /Agent_Audio
122+
123+
__FROM_SERVER:__
124+
125+
/Agent_Audio initialized
126+
127+
__FROM_SERVER:__
128+
129+
/Agent_Audio status bang
130+
*... (then looped)*
131+
132+
#### 1.2.2 - Setting some parameters for second agent (in particular the max_continuity parameters)
50133

51-
#### Create second agent "Agent_Audio"
134+
__TO_SERVER:__
52135

53-
TO_SERVER: /server create_agent /Agent_Audio listlabel
136+
/Agent_Audio set_control_parameter generator::prospector::\_navigator::max_continuity 6
54137

55-
FROM_SERVER: /server info "Created new agent at '/Agent_Audio'"
56-
FROM_SERVER: /server create_agent /Agent_Audio
57-
FROM_SERVER: /Agent_Audio initialized
58-
FROM_SERVER: /Agent_Audio status bang *... (then looped)*
138+
__TO_SERVER:__
59139

60-
#### Setting some parameters for second agent (in particular the max_continuity parameters)
140+
/Agent_Audio set_control_parameter generator::force_output 1
61141

62-
TO_SERVER: /Agent_Audio set_control_parameter generator::prospector::\_navigator::max_continuity 6
63-
TO_SERVER: /Agent_Audio set_control_parameter generator::force_output 1
142+
__FROM_SERVER:__
64143

65-
FROM_SERVER: /Agent_Audio clear ListLabel ... (+ list of default paramaters)
144+
/Agent_Audio clear ListLabel ... (+ list of default paramaters)
66145

67-
#### Learning a sequence in first agent (labels=vocal playing mode, contents=corresponding markers in an audio file)
146+
#### 1.2.3 - Learning a sequence in first agent (labels=vocal playing mode, contents=corresponding markers in an audio file)
147+
148+
__TO_SERVER:__
149+
150+
/Agent_Audio clear listlabel
151+
152+
__TO_SERVER:__
153+
154+
/Agent_Audio learn_event listlabel Tenuto "0 1876"
155+
156+
__TO_SERVER:__
157+
158+
/Agent_Audio learn_event listlabel Agilita "1876 2398"
68159

69-
TO_SERVER: /Agent_Audio clear listlabel
70-
TO_SERVER: /Agent_Audio learn_event listlabel Tenuto "0 1876"
71-
TO_SERVER: /Agent_Audio learn_event listlabel Agilita "1876 2398"
72160
(... send other couples {label} {content})
73161

74-
FROM_SERVER: /Agent_Audio new_event_learned "0 1876"
75-
FROM_SERVER: /Agent_Audio info "Learned event '0 1876'"
76-
FROM_SERVER: /Agent_Audio new_event_learned "1876 2398"
77-
FROM_SERVER: /Agent_Audio info "Learned event '1876 2398'"
162+
__FROM_SERVER:__
163+
164+
/Agent_Audio new_event_learned "0 1876"
165+
166+
__FROM_SERVER:__
167+
168+
/Agent_Audio info "Learned event '0 1876'"
169+
170+
__FROM_SERVER:__
171+
172+
/Agent_Audio new_event_learned "1876 2398"
173+
174+
__FROM_SERVER:__
175+
176+
/Agent_Audio info "Learned event '1876 2398'"
177+
78178
(... feedback other couples {label} {content})
79179

180+
---
181+
182+
## 2 - Send queries to the agents
80183

81-
## Send queries to the agents
82184

83-
### First agent "/Agent_Form"
185+
### 2.1 - First agent "/Agent_Form"
84186

85-
#### Send a "free" query to the first agent "/Agent_Form"
187+
#### 2.1.1 - Send a "free" query to the first agent "/Agent_Form"
86188

87189
*A "free" query takes advantage of the model built on the sequence to generate a new sequence without any constraint than the `maxcontinuity` value defined earlier*
88190

89-
TO_SERVER: /Agent_Form query query0 0 relative 10
191+
__TO_SERVER:__/Agent_Form query query0 0 relative 10
90192

91193
__Note the syntax of a "free" query :
92194
`{name_agent} query {name_query} {start_date} {relative or absolute} {number_of_events_to_generate}`__
93195

94-
#### Receiving and parsing the result of the query
196+
#### 2.1.2 - Receiving and parsing the result of the query
197+
198+
__FROM_SERVER:__
199+
200+
/Agent_Form server_received_query query0
201+
202+
__FROM_SERVER:__
203+
204+
/Agent_Form query_result_iterative query0 1 10 "Tenuto Silence None Staccato Tenuto"
205+
206+
FROM_SERVER:
207+
208+
/Agent_Form query_result_iterative query0 2 10 "Staccato None None None Staccato None None Staccato"
95209

96-
FROM_SERVER: /Agent_Form server_received_query query0
97-
FROM_SERVER: /Agent_Form query_result_iterative query0 1 10 "Tenuto Silence None Staccato Tenuto"
98-
FROM_SERVER: /Agent_Form query_result_iterative query0 2 10 "Staccato None None None Staccato None None Staccato"
99210
(...)
100-
FROM_SERVER: /Agent_Form query_result_iterative query0 10 10 "Staccato None None None Staccato None None Staccato"
211+
212+
__FROM_SERVER:__
213+
214+
/Agent_Form query_result_iterative query0 10 10 "Staccato None None None Staccato None None Staccato"
101215

102216
__Note that the output of the query is sent event by event with a counter indicating the potion of the event in the generated sequence__
103217

104-
### Second agent "/Agent_Audio"
218+
---
219+
220+
### 2.2 - Second agent "/Agent_Audio"
105221

106222
In this example we chain "/Agent_Form" and "/Agent_Audio": the "content" alphabet of one corresponding to the "label" alphabet of the other, we can concatenate the output of the query to "/Agent_Form" to use it as a "scenario" for the query to "/Agent_Audio".
107223

108-
#### Send a "scenario" query to the first agent "/Agent_Audio"
224+
#### 2.2.1 - Send a "scenario" query to the first agent "/Agent_Audio"
109225

110226
*The run of a "scenario" query will output the best possible match for a given sequence of labels (see related research articles).*
111227

112-
TO_SERVER: /Agent_Audio query query0 0 relative None listlabel [ Tenuto Silence None Staccato Tenuto Staccato None None None Staccato None None Staccato Tenuto Silence None Staccato Tenuto Staccato None None None Staccato None None Staccato Tenuto Silence None Staccato Tenuto Staccato None None None Staccato None None Staccato Tenuto Silence None Staccato Tenuto Staccato None None None Staccato None None Staccato Tenuto Silence None Staccato Tenuto Staccato None None None Staccato None None Staccato ]
228+
__TO_SERVER:__/Agent_Audio query query0 0 relative None listlabel \[ Tenuto Silence None Staccato Tenuto Staccato None None None Staccato None None Staccato Tenuto Silence None Staccato Tenuto Staccato None None None Staccato None None Staccato Tenuto Silence None Staccato Tenuto Staccato None None None Staccato None None Staccato Tenuto Silence None Staccato Tenuto Staccato None None None Staccato None None Staccato Tenuto Silence None Staccato Tenuto Staccato None None None Staccato None None Staccato \]
113229

114230
__Note the syntax of a "scenario" query :
115231
`{name_agent} query {name_query} {start_date} {relative or absolute} None {[ list_of_labels_to_match ] }`__
116232

117233
__The "None" keyword allows the generation to chose an optimal label.__
118234

119-
#### Receiving and parsing the result of the query
235+
#### 2.2.2 - Receiving and parsing the result of the query
236+
237+
__FROM_SERVER:__
238+
239+
/Agent_Audio server_received_query query0
240+
241+
__FROM_SERVER:__
242+
243+
/Agent_Audio query_result_iterative query0 1 65 "52458 54795"
244+
245+
__FROM_SERVER:__
246+
247+
/Agent_Audio query_result_iterative query0 2 65 "84360 85772"
248+
249+
__FROM_SERVER:__
250+
251+
/Agent_Audio query_result_iterative query0 3 65 "85772 86997"
120252

121-
FROM_SERVER: /Agent_Audio server_received_query query0
122-
FROM_SERVER: /Agent_Audio query_result_iterative query0 1 65 "52458 54795"
123-
FROM_SERVER: /Agent_Audio query_result_iterative query0 2 65 "84360 85772"
124-
FROM_SERVER: /Agent_Audio query_result_iterative query0 3 65 "85772 86997"
125253
(...)
126-
FROM_SERVER: /Agent_Audio query_result_iterative query0 64 65 "19330 19538"
127-
FROM_SERVER: /Agent_Audio query_result_iterative query0 65 65 "19869 20169"
254+
255+
__FROM_SERVER:__
256+
257+
/Agent_Audio query_result_iterative query0 64 65 "19330 19538"
258+
259+
__FROM_SERVER:__
260+
261+
/Agent_Audio query_result_iterative query0 65 65 "19869 20169"
128262

129263
__Note that the output of the query is sent event by event with a counter indicating the potion of the event in the generated sequence__
130264

265+
#### 2.2.3 - Final output
131266

132267
Finally, the result of the process is a sequence of markers that can be used to drive concatenative synthesis:
133268
- it matches a sequence of vocal playing modes in an optimal way thanks to the model learned in the 2nd agent
134269
- and this sequence of vocal playing modes has itself been generated by the system in the style of a higher level corpus associating categories of abstract musical gestures to sequences of vocal playing modes.
135270

136-
## Exit
271+
---
272+
273+
## 3 - Exit
274+
275+
__TO_SERVER:__
276+
277+
/server exit
278+
279+
__FROM_SERVER:__
280+
281+
/Agent_Audio terminated bang
282+
283+
FROM_SERVER:
284+
285+
/Agent_Form terminated bang
286+
287+
__FROM_SERVER:__
288+
289+
/server info "DICY2 server terminated"
137290

138-
TO_SERVER: /server exit
291+
__FROM_SERVER:__
139292

140-
FROM_SERVER: /Agent_Audio terminated bang
141-
FROM_SERVER: /Agent_Form terminated bang
142-
FROM_SERVER: /server info "DICY2 server terminated"
143-
FROM_SERVER: /server terminated bang
293+
/server terminated bang
144294

145295

146296

0 commit comments

Comments
 (0)