diff osc/demoscript.sh @ 76:cdea695a1f25

...
author Chris Cannam
date Fri, 17 Nov 2006 16:26:22 +0000
parents f81611bf11ed
children c1318aac18d2
line wrap: on
line diff
--- a/osc/demoscript.sh	Wed Nov 15 20:00:48 2006 +0000
+++ b/osc/demoscript.sh	Fri Nov 17 16:26:22 2006 +0000
@@ -1,14 +1,35 @@
 #!/bin/bash
 
-audio=$HOME/music
-preferred=$audio/ogg/linux
+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: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"
@@ -34,8 +55,11 @@
     if ! sv-command open "$file"; then
 	pid="`pidof sonic-visualiser`"
 	if [ -z "$pid" ]; then
-	    ( setsid ../sonic-visualiser & )
+	    ( setsid sonic-visualiser -geometry 1000x500+10+100 & )
 	    sleep 2
+            sudo renice +19 `pidof sonic-visualiser`
+            sudo renice +18 `pidof Xorg`
+            sv-command resize 1000 500
 	    load_a_file
 	else
 	    echo "ERROR: Unable to contact sonic-visualiser pid $pid" 1>&2
@@ -47,14 +71,14 @@
 show_stuff()
 {
     sv-command set overlays 2
-    sv-command set zoomwheels 1
+#    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 zoomwheels 0
     sv-command set propertyboxes 0
 }
 
@@ -76,9 +100,9 @@
     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 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
@@ -118,9 +142,13 @@
 
 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
+#    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 -20 -100 -1000; do
+        sv-command set speedup "$speed"
+        sleep 10
     done
 }
 
@@ -139,9 +167,10 @@
 {
     sv-command set propertyboxes 1
     sv-command add spectrogram
-    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 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
 }
@@ -152,12 +181,12 @@
     for x in 1 2 3 4 5 6; do
 	max=$((8000 - 1000*$x))
 	sv-command zoomvertical 43 "$max"
-	sleep 0.1
+	sleep 0.5
     done
     for x in 1 2 3 4 5; do
 	max=$((2000 - 100 * $x))
 	sv-command zoomvertical 43 "$max"
-	sleep 0.1
+	sleep 0.5
     done
 }
 
@@ -170,56 +199,146 @@
 
 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 2
+    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
-    scroll_and_zoom
-    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 3 2 1; do
+#    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 8
+    
+    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 256
-    sleep 10
+    sv-command zoom 1024
+    sleep 5
+    sv-command jump 10
+    sleep 20
     zoom_in_spectrogram
     sleep 20
 
-    if [ -n "$done_playback_bits" ]; then
-	sv-command setcurrent 1
-	sv-command zoom out
-	sv-command zoom out
-	sv-command zoom out
-	sv-command zoom out
-	sv-command zoom out
-	sv-command setcurrent 2
-    fi
+    sv-command select 7.5 11
+    fade_in selection
+    sleep 10
+    sv-command set speedup -200
+    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 speedup 0
+    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
+#    hide_stuff
+#    fade_in
     sleep 10
-    sv-command set layer Bin-Display Frequencies
+#    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 set layer Bin-Display "All Bins"
-    sv-command set layer Colour "Red on Blue"
-    sleep 10
+    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
@@ -228,48 +347,72 @@
 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 5
-    sv-command zoom default
-    sv-command zoom in
-    sv-command zoom in
+    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 transform vamp:vamp-aubio:aubioonset:detectionfunction
+    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 vamp:vamp-aubio:aubioonset:detectionfunction
+    sv-command transform $df
     sv-command set layer Colour Red
     sleep 5
-    sv-command set layer Plot-Type Segmentation
-#    sv-command set layer Vertical-Scale "Log Scale"
     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
-    if [ -n "$done_spectrogram_bits" ]; then
-	sv-command setcurrent 2
-	sv-command delete pane
-    fi
     sleep 10
-    sv-command setcurrent 1 1
+    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 1 2
-    fade_in
-    sleep 5
-    sv-command transform vamp:vamp-aubio:aubioonset: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 setcurrent 2
 #    sv-command transform vamp:qm-vamp-plugins:qm-tempotracker:beats
-    sv-command transform vamp:vamp-aubio:aubiotempo:beats
-    sleep 10
-    fade_out
-    show_stuff
+#    sv-command transform $beats
+    sleep 20
+#    fade_out
+#    show_stuff
 }
 
 selection_bits()
@@ -277,48 +420,52 @@
 #    reset
     sv-command set overlays 1
     sv-command set zoomwheels 0
+    sv-command resize 1000 500
+    sv-command zoom default
     sv-command setcurrent 2
     sv-command delete pane
-    if [ -n "$done_playback_bits" ]; then
+#    if [ -n "$done_playback_bits" ]; then
 	sv-command setcurrent 1 2
-    else
-	sv-command setcurrent 1 3
-    fi
+#    else
+#	sv-command setcurrent 1 3
+#    fi
     sv-command delete layer
-    if [ -n "$done_playback_bits" ]; then
+#    if [ -n "$done_playback_bits" ]; then
 	sv-command setcurrent 1 2
-    else
-	sv-command setcurrent 1 3
-    fi
+#    else
+#	sv-command setcurrent 1 3
+#    fi
     sv-command delete layer
-#    sv-command transform vamp:qm-vamp-plugins:qm-tempotracker:beats
-    sv-command transform vamp:vamp-aubio:aubiotempo:beats
     sv-command setcurrent 1 2
     sv-command set layer Colour Orange
-    sv-command setcurrent 1 3
-    sv-command resize 1024 500
-    sv-command zoom default
-    sleep 10
+#    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
-    sleep 12
+#    fade_in selection
+    play selection
+    sleep 8
     base=$((base + 4))
     sv-command addselect $base $base.1
-    sleep 12
+    #sleep 12
     base=$((base + 2))
     sv-command addselect $base $base.1
-    sleep 6
+    #sleep 6
     base=$((base + 2))
     sv-command addselect $base $base.3
-    sleep 6
+    #sleep 6
     base=$((base + 3))
     sv-command addselect $base $base.3
-    sleep 6
+    #sleep 6
     base=$((base + 2))
     sv-command addselect $base $base.3
-    sleep 12
+    sleep 4
+    sv-command delete layer
+    sleep 16
     sv-command set speedup -50
     sleep 14
     sv-command set speedup 50
@@ -327,26 +474,30 @@
     sleep 5
     sv-command set speedup 200
     fade_out
-    sleep 20
+#    sleep 10
     sv-command select none
-    sv-command setcurrent 1 3
-    sv-command delete layer
+    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
+#    add_melodic_range_spectrogram
+#    sleep 10
     sv-command add timeruler
-    sv-command transform vamp:qm-vamp-plugins:qm-chromagram:chromagram
-    sleep 2
-    sv-command jump 20
-    sleep 10
+    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 15
+    sleep 20
     fade_out
 }
 
@@ -356,37 +507,34 @@
 load_a_file
 sv-command loop on
 
-sv-command resize 1024 500
+sv-command resize 1000 500
 show_stuff
-sleep 10
+sleep 20
 playback_bits
 
-sv-command resize 1024 700
+#sleep 10
+sv-command resize 1000 700
+sv-command zoom default
 show_stuff
-#sleep 10
-spectrogram_bits
-
-sv-command jump 0
-sv-command resize 1024 700
-show_stuff
-sleep 10
 onset_bits
 
 selection_bits
 
-sv-command resize 1024 700
+#sv-command resize 1000 700
 
-sv-command jump 0
-chromagram_bits
+#sleep 10
+sv-command resize 1000 700
+#show_stuff
+spectrogram_bits
+
+#sleep 10
+#sv-command jump 0
+#show_stuff
+#chromagram_bits
 
 sleep 20
 
-pid="`pidof sonic-visualiser`"
-if [ -n "$pid" ]; then
-    kill "$pid"
-    sleep 5
-else
-    reset
-fi
+#reset
+killall -9 sonic-visualiser
 
 done