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