annotate osc/demoscript.sh @ 80:f4f52566e451

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