comparison osc/demoscript.sh @ 76:cdea695a1f25

...
author Chris Cannam
date Fri, 17 Nov 2006 16:26:22 +0000
parents f81611bf11ed
children c1318aac18d2
comparison
equal deleted inserted replaced
75:883f49d80bd3 76:cdea695a1f25
1 #!/bin/bash 1 #!/bin/bash
2 2
3 audio=$HOME/music 3 audio=/data/music
4 preferred=$audio/ogg/linux 4 preferred=$audio/free
5 list=audiofiles.txt 5 list=audiofiles.txt
6 used=audiofiles-used.txt 6 used=audiofiles-used.txt
7 7
8 df=vamp:vamp-aubio:aubioonset:detectionfunction
9 #df=vamp:qm-vamp-plugins:qm-tempotracker:detection_fn
10 onsets=vamp:vamp-aubio:aubioonset:onsets
11 #onsets=vamp:qm-vamp-plugins:qm-tempotracker:beats
12 beats=vamp:vamp-aubio:aubiotempo:beats
13 #beats=$onsets
14 #onsets=$beats
15 chromagram=vamp:qm-vamp-plugins:qm-chromagram:chromagram
16 notes=vamp:vamp-aubio:aubionotes:notes
17
18 pid=`cat /tmp/demoscript.pid 2>/dev/null`
19 if [ -n "$pid" ]; then
20 kill "$pid"
21 fi
22 echo $$ > /tmp/demoscript.pid
23 trap "rm /tmp/demoscript.pid" 0
24
8 sv-command quit 25 sv-command quit
26 sleep 1
27 killall -9 sonic-visualiser
28 sleep 1
9 29
10 pick_file() 30 pick_file()
11 { 31 {
32 file=""
12 count=`wc -l "$list" 2>/dev/null | awk '{ print $1 }'` 33 count=`wc -l "$list" 2>/dev/null | awk '{ print $1 }'`
13 if [ ! -f "$list" ] || [ "$count" -eq "0" ] ; then 34 if [ ! -f "$list" ] || [ "$count" -eq "0" ] ; then
14 find "$audio" -name \*.ogg -print >> "$list" 35 find "$audio" -name \*.ogg -print >> "$list"
15 find "$audio" -name \*.mp3 -print >> "$list" 36 find "$audio" -name \*.mp3 -print >> "$list"
16 find "$audio" -name \*.wav -print >> "$list" 37 find "$audio" -name \*.wav -print >> "$list"
32 { 53 {
33 file=`pick_file` 54 file=`pick_file`
34 if ! sv-command open "$file"; then 55 if ! sv-command open "$file"; then
35 pid="`pidof sonic-visualiser`" 56 pid="`pidof sonic-visualiser`"
36 if [ -z "$pid" ]; then 57 if [ -z "$pid" ]; then
37 ( setsid ../sonic-visualiser & ) 58 ( setsid sonic-visualiser -geometry 1000x500+10+100 & )
38 sleep 2 59 sleep 2
60 sudo renice +19 `pidof sonic-visualiser`
61 sudo renice +18 `pidof Xorg`
62 sv-command resize 1000 500
39 load_a_file 63 load_a_file
40 else 64 else
41 echo "ERROR: Unable to contact sonic-visualiser pid $pid" 1>&2 65 echo "ERROR: Unable to contact sonic-visualiser pid $pid" 1>&2
42 exit 1 66 exit 1
43 fi 67 fi
45 } 69 }
46 70
47 show_stuff() 71 show_stuff()
48 { 72 {
49 sv-command set overlays 2 73 sv-command set overlays 2
50 sv-command set zoomwheels 1 74 # sv-command set zoomwheels 1
51 sv-command set propertyboxes 1 75 sv-command set propertyboxes 1
52 } 76 }
53 77
54 hide_stuff() 78 hide_stuff()
55 { 79 {
56 sv-command set overlays 0 80 sv-command set overlays 0
57 sv-command set zoomwheels 0 81 # sv-command set zoomwheels 0
58 sv-command set propertyboxes 0 82 sv-command set propertyboxes 0
59 } 83 }
60 84
61 reset() 85 reset()
62 { 86 {
74 scroll_and_zoom() 98 scroll_and_zoom()
75 { 99 {
76 sv-command set overlays 0 100 sv-command set overlays 0
77 sv-command set zoomwheels 0 101 sv-command set zoomwheels 0
78 sv-command set propertyboxes 0 102 sv-command set propertyboxes 0
79 sv-command setcurrent 1 1 103 # sv-command setcurrent 1 1
80 sv-command delete layer 104 # sv-command delete layer
81 sv-command setcurrent 1 1 105 # sv-command setcurrent 1 1
82 sv-command set layer Colour Red 106 sv-command set layer Colour Red
83 sleep 1 107 sleep 1
84 sv-command set pane Global-Zoom off 108 sv-command set pane Global-Zoom off
85 sv-command set pane Global-Scroll off 109 sv-command set pane Global-Scroll off
86 sv-command set pane Follow-Playback Scroll 110 sv-command set pane Follow-Playback Scroll
116 sv-command set gain 1 140 sv-command set gain 1
117 } 141 }
118 142
119 slow() 143 slow()
120 { 144 {
121 for speed in -1 -10 -20 -30 -40 -50 -60 -70 -80 -100 -140 -200 -250 -300 -400 -500 -700 -800 -900 -1000; do 145 # for speed in -1 -10 -20 -30 -40 -50 -60 -70 -80 -100 -140 -200 -250 -300 -400 -500 -700 -800 -900 -1000; do
122 sv-command set speedup "$speed" 146 # sv-command set speedup "$speed"
123 sleep 1 147 # sleep 1
148 # done
149 for speed in -20 -100 -1000; do
150 sv-command set speedup "$speed"
151 sleep 10
124 done 152 done
125 } 153 }
126 154
127 stop() 155 stop()
128 { 156 {
137 165
138 add_melodic_range_spectrogram() 166 add_melodic_range_spectrogram()
139 { 167 {
140 sv-command set propertyboxes 1 168 sv-command set propertyboxes 1
141 sv-command add spectrogram 169 sv-command add spectrogram
142 sv-command set layer Window-Size 4096 170 sv-command set layer Window-Size 8192
143 # sv-command set layer Window-Overlap 4 171 # sv-command set layer Window-Size 4096
144 sv-command set layer Window-Overlap 3 172 sv-command set layer Window-Overlap 4
173 # sv-command set layer Window-Overlap 3
145 sv-command set layer Frequency-Scale Log 174 sv-command set layer Frequency-Scale Log
146 sv-command set layer Colour-Scale Meter 175 sv-command set layer Colour-Scale Meter
147 } 176 }
148 177
149 zoom_in_spectrogram() 178 zoom_in_spectrogram()
150 { 179 {
151 sv-command zoomvertical 43 8000 180 sv-command zoomvertical 43 8000
152 for x in 1 2 3 4 5 6; do 181 for x in 1 2 3 4 5 6; do
153 max=$((8000 - 1000*$x)) 182 max=$((8000 - 1000*$x))
154 sv-command zoomvertical 43 "$max" 183 sv-command zoomvertical 43 "$max"
155 sleep 0.1 184 sleep 0.5
156 done 185 done
157 for x in 1 2 3 4 5; do 186 for x in 1 2 3 4 5; do
158 max=$((2000 - 100 * $x)) 187 max=$((2000 - 100 * $x))
159 sv-command zoomvertical 43 "$max" 188 sv-command zoomvertical 43 "$max"
160 sleep 0.1 189 sleep 0.5
161 done 190 done
162 } 191 }
163 192
164 zoom_in_spectrogram_further() 193 zoom_in_spectrogram_further()
165 { 194 {
168 done 197 done
169 } 198 }
170 199
171 playback_bits() 200 playback_bits()
172 { 201 {
202 sv-command setcurrent 1
203 sv-command set pane Global-Zoom off
204 sv-command set pane Global-Scroll off
173 sv-command set pane Follow-Playback Scroll 205 sv-command set pane Follow-Playback Scroll
174 sv-command jump 10 206 sv-command jump 10
175 sv-command setcurrent 1 2 207 sv-command setcurrent 1 1
208 sv-command delete layer
209 sv-command setcurrent 1 1
210 # sv-command setcurrent 1 2
176 sv-command set layer Colour Blue 211 sv-command set layer Colour Blue
177 sleep 5 212 sleep 5
178 hide_stuff 213 hide_stuff
214 sv-command set overlays 0
215 sv-command set zoomwheels 0
216 sv-command set propertyboxes 0
179 fade_in 217 fade_in
180 sleep 10 218 sleep 10
181 scroll_and_zoom 219 # sv-command set layer Colour Blue
182 sleep 10 220 # sleep 1
183 slow 221 # sv-command set layer Colour Orange
184 #sv-command set layer Normalize-Visible-Area on 222 # sleep 1
185 for zoom in 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1; do 223 # sv-command set layer Colour Red
224 # sleep 1
225 # sv-command set layer Colour Green
226 # sleep 1
227 # sleep 1
228
229
230 # scroll_and_zoom
231
232 # sv-command set overlays 0
233 # sv-command set zoomwheels 0
234 # sv-command set propertyboxes 0
235 # sv-command setcurrent 1 1
236 # sv-command delete layer
237 # sv-command setcurrent 1 1
238 # sv-command set layer Colour Red
239 # sleep 1
240 # sv-command set pane Global-Zoom off
241 # sv-command set pane Global-Scroll off
242 # sv-command set pane Follow-Playback Scroll
243 sv-command set zoomwheels 1
244 sleep 1
245 for zoom in 950 900 850 800 750 700 650 600 550 512 450 400 350 300 256 192 160 128 96 64 48 32 24 16; do
186 sv-command zoom $zoom 246 sv-command zoom $zoom
187 sleep 0.1 247 sleep 0.1
188 done 248 done
189 sleep 8 249
250 sleep 1
251 sv-command set zoomwheels 0
252 sv-command zoom 16
253
254 sleep 10
255 #slow
256 #sv-command set layer Normalize-Visible-Area on
257 # for zoom in 15 14 13 12 11 10 9 8 7 6 5 4 ; do
258 # sv-command zoom $zoom
259 # sleep 0.1
260 # done
261 sleep 1
262 sv-command set zoomwheels 0
263 slow
264 sleep 7
190 fade_out 265 fade_out
266 sv-command setcurrent 1
267 sv-command set pane Follow-Playback Page
268 sv-command set pane Global-Zoom on
269 sv-command set pane Global-Scroll on
191 done_playback_bits=1 270 done_playback_bits=1
192 } 271 }
193 272
194 spectrogram_bits() 273 spectrogram_bits()
195 { 274 {
275 sv-command set pane Global-Zoom on
276 sv-command zoom 1024
196 add_melodic_range_spectrogram 277 add_melodic_range_spectrogram
197 sv-command zoom 256 278 sv-command zoom 1024
198 sleep 10 279 sleep 5
280 sv-command jump 10
281 sleep 20
199 zoom_in_spectrogram 282 zoom_in_spectrogram
200 sleep 20 283 sleep 20
201 284
202 if [ -n "$done_playback_bits" ]; then 285 sv-command select 7.5 11
203 sv-command setcurrent 1 286 fade_in selection
204 sv-command zoom out 287 sleep 10
205 sv-command zoom out 288 sv-command set speedup -200
206 sv-command zoom out 289 sleep 10
207 sv-command zoom out 290 sv-command setcurrent 1
208 sv-command zoom out 291 sv-command delete pane
209 sv-command setcurrent 2 292 sv-command zoom in
210 fi 293 sv-command setcurrent 1 2
294 sv-command set layer Normalize-Columns off
295 sv-command set layer Normalize-Visible-Area on
296 sleep 20
297 sv-command set speedup 0
298 sleep 10
299 sv-command select none
300 # fade_out
301
302 # if [ -n "$done_playback_bits" ]; then
303 # sv-command setcurrent 1
304 # sv-command zoom out
305 # sv-command zoom outvamp:qm-vamp-plugins:qm-chromagram:chromagram
306 # sv-command zoom out
307 # sv-command zoom out
308 # sv-command zoom out
309 # sv-command setcurrent 2
310 # fi
211 311
212 hide_stuff 312 # hide_stuff
213 fade_in 313 # fade_in
214 sleep 10 314 sleep 10
215 sv-command set layer Bin-Display Frequencies 315 # sv-command set layer Bin-Display Frequencies
316 # sv-command set layer Normalize-Columns on
317 # sleep 20
318 sv-command set layer Bin-Display "All Bins"
216 sv-command set layer Normalize-Columns on 319 sv-command set layer Normalize-Columns on
217 sleep 20 320 sv-command set layer Normalize-Visible-Area off
218 sv-command set layer Bin-Display "All Bins" 321 sv-command set layer Colour-Scale 0
219 sv-command set layer Colour "Red on Blue" 322 sv-command set layer Colour "Red on Blue"
220 sleep 10 323 sv-command zoomvertical 23 800
324 sleep 20
325 sv-command transform $onsets
326 sv-command set layer Colour Orange
327 sleep 20
221 fade_out 328 fade_out
222 sleep 1 329 sleep 1
330 # sv-command jump 10
331 # sv-command setcurrent 1 2
332 # sv-command set layer Colour "Black on White"
333 # sv-command transform $notes
334 # sv-command set layer Colour Orange
335 sleep 10
336 # sv-command setcurrent 1 3
337 # sv-command delete layer
338 sv-command setcurrent 1 3
339 sv-command delete layer
340 sv-command setcurrent 1 2
341 sv-command set layer Colour Default
223 done_spectrogram_bits=1 342 done_spectrogram_bits=1
224 343
225 # zoom_in_spectrogram_further 344 # zoom_in_spectrogram_further
226 } 345 }
227 346
228 onset_bits() 347 onset_bits()
229 { 348 {
230 show_stuff 349 show_stuff
350 sv-command set zoomwheels 0
231 sv-command setcurrent 1 351 sv-command setcurrent 1
232 sv-command set pane Global-Zoom on 352 sv-command set pane Global-Zoom on
233 sv-command set pane Global-Scroll on 353 sv-command set pane Global-Scroll on
234 sleep 5 354 sleep 0.5
235 sv-command zoom default 355 sv-command set layer Colour Blue
236 sv-command zoom in 356 sleep 0.5
237 sv-command zoom in 357 sv-command set layer Colour Orange
358 sleep 0.5
359 sv-command set layer Colour Red
360 sleep 0.5
361 sv-command set layer Colour Green
362 sleep 1
363 # sleep 1
364 # if [ -n "$done_spectrogram_bits" ]; then
365 # sv-command setcurrent 2
366 # sv-command delete pane
367 # fi
368 # sv-command zoom default
369 # sv-command zoom in
370 # sv-command zoom in
371 # sv-command zoom in
372 sv-command zoom 192
238 sv-command zoom in 373 sv-command zoom in
239 sv-command add timeruler 374 sv-command add timeruler
240 sv-command transform vamp:vamp-aubio:aubioonset:detectionfunction 375 sv-command jump 0
376 sv-command transform $df
377 sv-command set layer Colour Black
241 sleep 5 378 sleep 5
242 sv-command set layer Plot-Type Curve 379 sv-command set layer Plot-Type Curve
243 sleep 5 380 sleep 5
381 sv-command jump 30
244 sv-command setcurrent 1 382 sv-command setcurrent 1
245 sv-command set pane Follow-Playback Page 383 sv-command set pane Follow-Playback Page
246 sv-command transform vamp:vamp-aubio:aubioonset:detectionfunction 384 sv-command transform $df
247 sv-command set layer Colour Red 385 sv-command set layer Colour Red
248 sleep 5 386 sleep 5
387 sv-command jump 30
388 sleep 5
389 if [ "$RANDOM" -lt 16384 ]; then
390 sv-command set layer Vertical-Scale "Log Scale"
391 fi
249 sv-command set layer Plot-Type Segmentation 392 sv-command set layer Plot-Type Segmentation
250 # sv-command set layer Vertical-Scale "Log Scale" 393 sleep 5
251 sv-command jump 30
252 sleep 5
253 # hide_stuff 394 # hide_stuff
254 if [ -n "$done_spectrogram_bits" ]; then 395 sleep 10
255 sv-command setcurrent 2 396 sv-command set overlays 0
256 sv-command delete pane 397 sv-command set propertyboxes 0
257 fi 398 # sv-command setcurrent 1 1
258 sleep 10 399 # sv-command set layer Colour Black
259 sv-command setcurrent 1 1 400 # sv-command setcurrent 1 2
401 sleep 2
402 fade_in
403 sleep 2
404 sv-command transform $onsets
260 sv-command set layer Colour Black 405 sv-command set layer Colour Black
261 sv-command setcurrent 1 2
262 fade_in
263 sleep 5
264 sv-command transform vamp:vamp-aubio:aubioonset:onsets
265 sv-command set layer Colour Black
266 sleep 20
267 sv-command setcurrent 2 406 sv-command setcurrent 2
407 sv-command transform $onsets
408 sv-command set layer Colour Blue
409 sleep 20
410 # sv-command setcurrent 2
268 # sv-command transform vamp:qm-vamp-plugins:qm-tempotracker:beats 411 # sv-command transform vamp:qm-vamp-plugins:qm-tempotracker:beats
269 sv-command transform vamp:vamp-aubio:aubiotempo:beats 412 # sv-command transform $beats
270 sleep 10 413 sleep 20
271 fade_out 414 # fade_out
272 show_stuff 415 # show_stuff
273 } 416 }
274 417
275 selection_bits() 418 selection_bits()
276 { 419 {
277 # reset 420 # reset
278 sv-command set overlays 1 421 sv-command set overlays 1
279 sv-command set zoomwheels 0 422 sv-command set zoomwheels 0
423 sv-command resize 1000 500
424 sv-command zoom default
280 sv-command setcurrent 2 425 sv-command setcurrent 2
281 sv-command delete pane 426 sv-command delete pane
282 if [ -n "$done_playback_bits" ]; then 427 # if [ -n "$done_playback_bits" ]; then
283 sv-command setcurrent 1 2 428 sv-command setcurrent 1 2
284 else 429 # else
285 sv-command setcurrent 1 3 430 # sv-command setcurrent 1 3
286 fi 431 # fi
287 sv-command delete layer 432 sv-command delete layer
288 if [ -n "$done_playback_bits" ]; then 433 # if [ -n "$done_playback_bits" ]; then
289 sv-command setcurrent 1 2 434 sv-command setcurrent 1 2
290 else 435 # else
291 sv-command setcurrent 1 3 436 # sv-command setcurrent 1 3
292 fi 437 # fi
293 sv-command delete layer 438 sv-command delete layer
294 # sv-command transform vamp:qm-vamp-plugins:qm-tempotracker:beats
295 sv-command transform vamp:vamp-aubio:aubiotempo:beats
296 sv-command setcurrent 1 2 439 sv-command setcurrent 1 2
297 sv-command set layer Colour Orange 440 sv-command set layer Colour Orange
298 sv-command setcurrent 1 3 441 # sv-command transform vamp:qm-vamp-plugins:qm-tempotracker:beats
299 sv-command resize 1024 500 442 sv-command transform $beats
300 sv-command zoom default 443 # sv-command setcurrent 1 2
301 sleep 10 444 sv-command set layer Colour Black
445 sleep 20
302 sv-command loop on 446 sv-command loop on
303 base=$((RANDOM % 100)) 447 base=$((RANDOM % 100))
304 sv-command select $base $base.3 448 sv-command select $base $base.3
305 fade_in selection 449 # fade_in selection
306 sleep 12 450 play selection
451 sleep 8
307 base=$((base + 4)) 452 base=$((base + 4))
308 sv-command addselect $base $base.1 453 sv-command addselect $base $base.1
309 sleep 12 454 #sleep 12
310 base=$((base + 2)) 455 base=$((base + 2))
311 sv-command addselect $base $base.1 456 sv-command addselect $base $base.1
312 sleep 6 457 #sleep 6
313 base=$((base + 2)) 458 base=$((base + 2))
314 sv-command addselect $base $base.3 459 sv-command addselect $base $base.3
315 sleep 6 460 #sleep 6
316 base=$((base + 3)) 461 base=$((base + 3))
317 sv-command addselect $base $base.3 462 sv-command addselect $base $base.3
318 sleep 6 463 #sleep 6
319 base=$((base + 2)) 464 base=$((base + 2))
320 sv-command addselect $base $base.3 465 sv-command addselect $base $base.3
321 sleep 12 466 sleep 4
467 sv-command delete layer
468 sleep 16
322 sv-command set speedup -50 469 sv-command set speedup -50
323 sleep 14 470 sleep 14
324 sv-command set speedup 50 471 sv-command set speedup 50
325 sleep 8 472 sleep 8
326 sv-command set speedup 100 473 sv-command set speedup 100
327 sleep 5 474 sleep 5
328 sv-command set speedup 200 475 sv-command set speedup 200
329 fade_out 476 fade_out
330 sleep 20 477 # sleep 10
331 sv-command select none 478 sv-command select none
332 sv-command setcurrent 1 3 479 sv-command set overlays 2
333 sv-command delete layer 480 sv-command set propertyboxes 1
481 # sv-command setcurrent 1 3
482 # sv-command delete layer
334 sv-command setcurrent 1 2 483 sv-command setcurrent 1 2
335 sv-command set layer Colour Black 484 sv-command set layer Colour Black
336 } 485 }
337 486
338 chromagram_bits() 487 chromagram_bits()
339 { 488 {
340 add_melodic_range_spectrogram 489 # add_melodic_range_spectrogram
341 sleep 10 490 # sleep 10
342 sv-command add timeruler 491 sv-command add timeruler
343 sv-command transform vamp:qm-vamp-plugins:qm-chromagram:chromagram 492 sleep 5
344 sleep 2 493 sv-command jump 10
345 sv-command jump 20 494 sv-command zoom out
346 sleep 10 495 sleep 5
496 sv-command transform $chromagram
497 sleep 40
347 sv-command zoom out 498 sv-command zoom out
348 fade_in 499 fade_in
349 sleep 15 500 sleep 20
350 fade_out 501 fade_out
351 } 502 }
352 503
353 while /bin/true; do 504 while /bin/true; do
354 505
355 sleep 2 506 sleep 2
356 load_a_file 507 load_a_file
357 sv-command loop on 508 sv-command loop on
358 509
359 sv-command resize 1024 500 510 sv-command resize 1000 500
360 show_stuff 511 show_stuff
361 sleep 10 512 sleep 20
362 playback_bits 513 playback_bits
363 514
364 sv-command resize 1024 700 515 #sleep 10
516 sv-command resize 1000 700
517 sv-command zoom default
365 show_stuff 518 show_stuff
519 onset_bits
520
521 selection_bits
522
523 #sv-command resize 1000 700
524
366 #sleep 10 525 #sleep 10
526 sv-command resize 1000 700
527 #show_stuff
367 spectrogram_bits 528 spectrogram_bits
368 529
369 sv-command jump 0 530 #sleep 10
370 sv-command resize 1024 700 531 #sv-command jump 0
371 show_stuff 532 #show_stuff
372 sleep 10 533 #chromagram_bits
373 onset_bits
374
375 selection_bits
376
377 sv-command resize 1024 700
378
379 sv-command jump 0
380 chromagram_bits
381 534
382 sleep 20 535 sleep 20
383 536
384 pid="`pidof sonic-visualiser`" 537 #reset
385 if [ -n "$pid" ]; then 538 killall -9 sonic-visualiser
386 kill "$pid"
387 sleep 5
388 else
389 reset
390 fi
391 539
392 done 540 done