mirror of
https://github.com/thestk/stk
synced 2026-04-23 07:48:36 +00:00
Version 4.1
This commit is contained in:
committed by
Stephen Sinclair
parent
81475b04c5
commit
2f09fcd019
@@ -168,7 +168,7 @@ proc changePress {value} {
|
||||
|
||||
proc changePitch {value} {
|
||||
global outID
|
||||
puts $outID [format "PitchBend 0.0 1 %.3f" $value]
|
||||
puts $outID [format "PitchChange 0.0 1 %.3f" $value]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
|
||||
@@ -1,233 +0,0 @@
|
||||
# Tcl/Tk Bowed Bar Model GUI for the Synthesis Toolkit (STK)
|
||||
|
||||
set press 64.0
|
||||
set pitch 64.0
|
||||
set cont1 127.0
|
||||
set cont2 20.0
|
||||
set cont4 127.0
|
||||
set cont11 0.0
|
||||
set outID "stdout"
|
||||
set commtype "stdout"
|
||||
set struckbow 0
|
||||
|
||||
# Configure main window
|
||||
wm title . "STK Bowed Bar Controller"
|
||||
wm iconname . "bowedbar"
|
||||
. config -bg black
|
||||
|
||||
# Configure "communications" menu
|
||||
menu .menu -tearoff 0
|
||||
menu .menu.communication -tearoff 0
|
||||
.menu add cascade -label "Communication" -menu .menu.communication \
|
||||
-underline 0
|
||||
.menu.communication add radio -label "Console" -variable commtype \
|
||||
-value "stdout" -command { setComm }
|
||||
.menu.communication add radio -label "Socket" -variable commtype \
|
||||
-value "socket" -command { setComm }
|
||||
. configure -menu .menu
|
||||
|
||||
frame .leftsid -bg black
|
||||
|
||||
proc myExit {} {
|
||||
global pitch outID
|
||||
puts $outID [format "NoteOff -1.0 1 %f 127" $pitch ]
|
||||
flush $outID
|
||||
puts $outID [format "ExitProgram"]
|
||||
flush $outID
|
||||
close $outID
|
||||
exit
|
||||
}
|
||||
|
||||
proc noteOn {pitchVal pressVal} {
|
||||
global outID
|
||||
puts $outID [format "NoteOn -1.0 1 %f %f" $pitchVal $pressVal]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc noteOff {pitchVal pressVal} {
|
||||
global outID
|
||||
puts $outID [format "NoteOff -1.0 1 %f %f" $pitchVal $pressVal]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc patchChange {value} {
|
||||
global outID press cont1 cont4 cont11
|
||||
set patch $value
|
||||
puts $outID [format "ProgramChange -1.0 1 %i" $value]
|
||||
flush $outID
|
||||
set cont1 64.0
|
||||
set cont4 64.0
|
||||
set cont11 64.0
|
||||
}
|
||||
|
||||
proc printWhatz {tag value1 value2 } {
|
||||
global outID
|
||||
puts $outID [format "%s %i %f" $tag $value1 $value2]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc changePress {value} {
|
||||
global outID
|
||||
puts $outID [format "AfterTouch -1.0 1 %f" $value]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc changePitch {value} {
|
||||
global outID
|
||||
puts $outID [format "PitchBend -1.0 1 %.3f" $value]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc activateVel {} {
|
||||
global pitch
|
||||
noteOn $pitch 127
|
||||
printWhatz "ControlChange -1.0 1 " 65 0
|
||||
}
|
||||
|
||||
# Configure sliders
|
||||
frame .press -bg grey66
|
||||
|
||||
button .press.pos -text Pos. -bg grey66 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 65 127}
|
||||
button .press.vel -text Vel. -bg grey66 \
|
||||
-command activateVel
|
||||
|
||||
scale .press.bPressure -from 0 -to 128 -length 200 \
|
||||
-command {changePress } -variable press\
|
||||
-orient horizontal -label "Pos on Bow / Vel of Bow" \
|
||||
-tickinterval 32 -showvalue true -bg grey66
|
||||
|
||||
scale .pitch -from 0 -to 128 -length 200 \
|
||||
-command {changePitch } -variable pitch \
|
||||
-orient horizontal -label "MIDI Note Number" \
|
||||
-tickinterval 32 -showvalue true -bg grey66
|
||||
|
||||
scale .cont2 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 2} \
|
||||
-orient horizontal -label "Bowing Pressure" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont2
|
||||
|
||||
scale .cont4 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 4} \
|
||||
-orient horizontal -label "Strike/Bow Position" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont4
|
||||
|
||||
scale .cont11 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 11} \
|
||||
-orient horizontal -label "Integration" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont11
|
||||
|
||||
scale .reson -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 1} \
|
||||
-orient horizontal -label "Mode Resonance" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont1
|
||||
|
||||
. config -bg grey20
|
||||
|
||||
frame .bowstruk -bg black
|
||||
radiobutton .bowstruk.bowed -text Bowed -bg grey66 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 64 127} \
|
||||
-value 1 -variable struckbow
|
||||
radiobutton .bowstruk.struck -text Struck -bg grey66 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 64 0} \
|
||||
-value 0 -variable struckbow
|
||||
|
||||
pack .press.pos -side left
|
||||
pack .press.bPressure -side left
|
||||
pack .press.vel -side left
|
||||
pack .press -padx 10 -pady 10
|
||||
pack .pitch -padx 10 -pady 10
|
||||
pack .cont2 -padx 10 -pady 10
|
||||
pack .cont4 -padx 10 -pady 10
|
||||
pack .cont11 -padx 10 -pady 10
|
||||
pack .reson -padx 10 -pady 10
|
||||
|
||||
pack .bowstruk.bowed -side left -padx 5
|
||||
pack .bowstruk.struck -side left -padx 5
|
||||
pack .bowstruk -pady 10
|
||||
|
||||
frame .noteOn -bg black
|
||||
button .noteOn.on -text NoteOn -bg grey66 -command { noteOn $pitch $press }
|
||||
button .noteOn.off -text NoteOff -bg grey66 -command { noteOff $pitch 127.0 }
|
||||
button .noteOn.exit -text "Exit Program" -bg grey66 -command myExit
|
||||
pack .noteOn.on -side left -padx 5
|
||||
pack .noteOn.off -side left -padx 5 -pady 10
|
||||
pack .noteOn.exit -side left -padx 5 -pady 10
|
||||
pack .noteOn -pady 10
|
||||
|
||||
bind all <KeyPress> {
|
||||
noteOn $pitch $press
|
||||
}
|
||||
|
||||
# Bind an X windows "close" event with the Exit routine
|
||||
bind . <Destroy> +myExit
|
||||
|
||||
# Socket connection procedure
|
||||
set d .socketdialog
|
||||
|
||||
proc setComm {} {
|
||||
global outID
|
||||
global commtype
|
||||
global d
|
||||
if {$commtype == "stdout"} {
|
||||
if { [string compare "stdout" $outID] } {
|
||||
set i [tk_dialog .dialog "Break Socket Connection?" {You are about to break an existing socket connection ... is this what you want to do?} "" 0 Cancel OK]
|
||||
switch $i {
|
||||
0 {set commtype "socket"}
|
||||
1 {close $outID
|
||||
set outID "stdout"}
|
||||
}
|
||||
}
|
||||
} elseif { ![string compare "stdout" $outID] } {
|
||||
set sockport 2001
|
||||
set sockhost localhost
|
||||
toplevel $d
|
||||
wm title $d "STK Client Socket Connection"
|
||||
wm resizable $d 0 0
|
||||
grab $d
|
||||
label $d.message -text "Specify a socket host and port number below (if different than the STK defaults shown) and then click the \"Connect\" button to invoke a socket-client connection attempt to the STK socket server." \
|
||||
-background white -font {Helvetica 10 bold} \
|
||||
-wraplength 3i -justify left
|
||||
frame $d.sockhost
|
||||
entry $d.sockhost.entry -width 15
|
||||
label $d.sockhost.text -text "Socket Host:" \
|
||||
-font {Helvetica 10 bold}
|
||||
frame $d.sockport
|
||||
entry $d.sockport.entry -width 15
|
||||
label $d.sockport.text -text "Socket Port:" \
|
||||
-font {Helvetica 10 bold}
|
||||
pack $d.message -side top -padx 5 -pady 10
|
||||
pack $d.sockhost.text -side left -padx 1 -pady 2
|
||||
pack $d.sockhost.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockhost -side top -padx 5 -pady 2
|
||||
pack $d.sockport.text -side left -padx 1 -pady 2
|
||||
pack $d.sockport.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockport -side top -padx 5 -pady 2
|
||||
$d.sockhost.entry insert 0 $sockhost
|
||||
$d.sockport.entry insert 0 $sockport
|
||||
frame $d.buttons
|
||||
button $d.buttons.cancel -text "Cancel" -bg grey66 \
|
||||
-command { set commtype "stdout"
|
||||
set outID "stdout"
|
||||
destroy $d }
|
||||
button $d.buttons.connect -text "Connect" -bg grey66 \
|
||||
-command {
|
||||
set sockhost [$d.sockhost.entry get]
|
||||
set sockport [$d.sockport.entry get]
|
||||
set err [catch {socket $sockhost $sockport} outID]
|
||||
|
||||
if {$err == 0} {
|
||||
destroy $d
|
||||
} else {
|
||||
tk_dialog $d.error "Socket Error" {Error: Unable to make socket connection. Make sure the STK socket server is first running and that the port number is correct.} "" 0 OK
|
||||
} }
|
||||
pack $d.buttons.cancel -side left -padx 5 -pady 10
|
||||
pack $d.buttons.connect -side right -padx 5 -pady 10
|
||||
pack $d.buttons -side bottom -padx 5 -pady 10
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,177 +1,177 @@
|
||||
# Tcl/Tk Drum GUI for the Synthesis Toolkit (STK)
|
||||
|
||||
# Set initial control values
|
||||
set press 127
|
||||
set outID "stdout"
|
||||
set commtype "stdout"
|
||||
|
||||
# Turn down the reverb
|
||||
puts $outID "ControlChange 0.0 1 44.0 0.0"
|
||||
|
||||
# Configure main window
|
||||
wm title . "STK Drum Controller"
|
||||
wm iconname . "drum"
|
||||
. config -bg black
|
||||
|
||||
# Configure "communications" menu
|
||||
menu .menu -tearoff 0
|
||||
menu .menu.communication -tearoff 0
|
||||
.menu add cascade -label "Communication" -menu .menu.communication \
|
||||
-underline 0
|
||||
.menu.communication add radio -label "Console" -variable commtype \
|
||||
-value "stdout" -command { setComm }
|
||||
.menu.communication add radio -label "Socket" -variable commtype \
|
||||
-value "socket" -command { setComm }
|
||||
. configure -menu .menu
|
||||
|
||||
# Configure slider
|
||||
scale .bPressure -from 0 -to 128 -length 100 \
|
||||
-command {changePress } -variable press\
|
||||
-orient horizontal -label "Velocity" \
|
||||
-tickinterval 64 -showvalue true -bg grey66
|
||||
|
||||
pack .bPressure -pady 5 -padx 5
|
||||
|
||||
# Configure buttons
|
||||
frame .buttons -bg black
|
||||
frame .buttons.left -bg black
|
||||
frame .buttons.right -bg black
|
||||
|
||||
button .buttons.left.bass -text Bass -bg grey66 \
|
||||
-command { playDrum 36 } -width 7
|
||||
button .buttons.left.snare -text Snare -bg grey66 \
|
||||
-command { playDrum 38 } -width 7
|
||||
button .buttons.left.tomlo -text LoTom -bg grey66 \
|
||||
-command { playDrum 41 } -width 7
|
||||
button .buttons.left.tommid -text MidTom -bg grey66 \
|
||||
-command { playDrum 45 } -width 7
|
||||
button .buttons.left.tomhi -text HiTom -bg grey66 \
|
||||
-command { playDrum 50 } -width 7
|
||||
button .buttons.left.homer -text Homer -bg grey66 \
|
||||
-command { playDrum 90 } -width 7
|
||||
button .buttons.right.hat -text Hat -bg grey66 \
|
||||
-command { playDrum 42 } -width 7
|
||||
button .buttons.right.ride -text Ride -bg grey66 \
|
||||
-command { playDrum 46 } -width 7
|
||||
button .buttons.right.crash -text Crash -bg grey66 \
|
||||
-command { playDrum 49 } -width 7
|
||||
button .buttons.right.cowbel -text CowBel -bg grey66 \
|
||||
-command { playDrum 56 } -width 7
|
||||
button .buttons.right.tamb -text Tamb -bg grey66 \
|
||||
-command { playDrum 54 } -width 7
|
||||
button .buttons.right.homer -text Homer -bg grey66 \
|
||||
-command { playDrum 90 } -width 7
|
||||
|
||||
pack .buttons.left.bass -pady 5
|
||||
pack .buttons.left.snare -pady 5
|
||||
pack .buttons.left.tomlo -pady 5
|
||||
pack .buttons.left.tommid -pady 5
|
||||
pack .buttons.left.tomhi -pady 5
|
||||
pack .buttons.left.homer -pady 5
|
||||
pack .buttons.right.hat -pady 5
|
||||
pack .buttons.right.ride -pady 5
|
||||
pack .buttons.right.crash -pady 5
|
||||
pack .buttons.right.cowbel -pady 5
|
||||
pack .buttons.right.tamb -pady 5
|
||||
pack .buttons.right.homer -pady 5
|
||||
|
||||
pack .buttons.left -side left -pady 5 -padx 5
|
||||
pack .buttons.right -side right -pady 5 -padx 5
|
||||
pack .buttons -pady 5 -padx 5
|
||||
|
||||
# Configure exit button
|
||||
button .exit -text "Exit Program" -bg grey66 -command myExit
|
||||
pack .exit -side bottom -pady 20
|
||||
|
||||
#bind all <KeyPress> {
|
||||
bind . <KeyPress> {
|
||||
noteOn $pitch $press
|
||||
}
|
||||
|
||||
# Bind an X windows "close" event with the Exit routine
|
||||
bind . <Destroy> +myExit
|
||||
|
||||
proc myExit {} {
|
||||
global outID
|
||||
puts $outID [format "ExitProgram"]
|
||||
flush $outID
|
||||
close $outID
|
||||
exit
|
||||
}
|
||||
|
||||
proc playDrum {value} {
|
||||
global press
|
||||
global outID
|
||||
puts $outID [format "NoteOn 0.0 1 %i %f" $value $press]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc changePress {value} {
|
||||
global press
|
||||
set press $value
|
||||
}
|
||||
|
||||
# Socket connection procedure
|
||||
set d .socketdialog
|
||||
|
||||
proc setComm {} {
|
||||
global outID
|
||||
global commtype
|
||||
global d
|
||||
if {$commtype == "stdout"} {
|
||||
if { [string compare "stdout" $outID] } {
|
||||
set i [tk_dialog .dialog "Break Socket Connection?" {You are about to break an existing socket connection ... is this what you want to do?} "" 0 Cancel OK]
|
||||
switch $i {
|
||||
0 {set commtype "socket"}
|
||||
1 {close $outID
|
||||
set outID "stdout"}
|
||||
}
|
||||
}
|
||||
} elseif { ![string compare "stdout" $outID] } {
|
||||
set sockport 2001
|
||||
set sockhost localhost
|
||||
toplevel $d
|
||||
wm title $d "STK Client Socket Connection"
|
||||
wm resizable $d 0 0
|
||||
grab $d
|
||||
label $d.message -text "Specify a socket host and port number below (if different than the STK defaults shown) and then click the \"Connect\" button to invoke a socket-client connection attempt to the STK socket server." \
|
||||
-background white -font {Helvetica 10 bold} \
|
||||
-wraplength 3i -justify left
|
||||
frame $d.sockhost
|
||||
entry $d.sockhost.entry -width 15
|
||||
label $d.sockhost.text -text "Socket Host:" \
|
||||
-font {Helvetica 10 bold}
|
||||
frame $d.sockport
|
||||
entry $d.sockport.entry -width 15
|
||||
label $d.sockport.text -text "Socket Port:" \
|
||||
-font {Helvetica 10 bold}
|
||||
pack $d.message -side top -padx 5 -pady 10
|
||||
pack $d.sockhost.text -side left -padx 1 -pady 2
|
||||
pack $d.sockhost.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockhost -side top -padx 5 -pady 2
|
||||
pack $d.sockport.text -side left -padx 1 -pady 2
|
||||
pack $d.sockport.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockport -side top -padx 5 -pady 2
|
||||
$d.sockhost.entry insert 0 $sockhost
|
||||
$d.sockport.entry insert 0 $sockport
|
||||
frame $d.buttons
|
||||
button $d.buttons.cancel -text "Cancel" -bg grey66 \
|
||||
-command { set commtype "stdout"
|
||||
set outID "stdout"
|
||||
destroy $d }
|
||||
button $d.buttons.connect -text "Connect" -bg grey66 \
|
||||
-command {
|
||||
set sockhost [$d.sockhost.entry get]
|
||||
set sockport [$d.sockport.entry get]
|
||||
set err [catch {socket $sockhost $sockport} outID]
|
||||
|
||||
if {$err == 0} {
|
||||
destroy $d
|
||||
} else {
|
||||
tk_dialog $d.error "Socket Error" {Error: Unable to make socket connection. Make sure the STK socket server is first running and that the port number is correct.} "" 0 OK
|
||||
} }
|
||||
pack $d.buttons.cancel -side left -padx 5 -pady 10
|
||||
pack $d.buttons.connect -side right -padx 5 -pady 10
|
||||
pack $d.buttons -side bottom -padx 5 -pady 10
|
||||
}
|
||||
}
|
||||
# Tcl/Tk Drum GUI for the Synthesis Toolkit (STK)
|
||||
|
||||
# Set initial control values
|
||||
set press 127
|
||||
set outID "stdout"
|
||||
set commtype "stdout"
|
||||
|
||||
# Turn down the reverb
|
||||
puts $outID "ControlChange 0.0 1 44.0 0.0"
|
||||
|
||||
# Configure main window
|
||||
wm title . "STK Drum Controller"
|
||||
wm iconname . "drum"
|
||||
. config -bg black
|
||||
|
||||
# Configure "communications" menu
|
||||
menu .menu -tearoff 0
|
||||
menu .menu.communication -tearoff 0
|
||||
.menu add cascade -label "Communication" -menu .menu.communication \
|
||||
-underline 0
|
||||
.menu.communication add radio -label "Console" -variable commtype \
|
||||
-value "stdout" -command { setComm }
|
||||
.menu.communication add radio -label "Socket" -variable commtype \
|
||||
-value "socket" -command { setComm }
|
||||
. configure -menu .menu
|
||||
|
||||
# Configure slider
|
||||
scale .bPressure -from 0 -to 128 -length 100 \
|
||||
-command {changePress } -variable press\
|
||||
-orient horizontal -label "Velocity" \
|
||||
-tickinterval 64 -showvalue true -bg grey66
|
||||
|
||||
pack .bPressure -pady 5 -padx 5
|
||||
|
||||
# Configure buttons
|
||||
frame .buttons -bg black
|
||||
frame .buttons.left -bg black
|
||||
frame .buttons.right -bg black
|
||||
|
||||
button .buttons.left.bass -text Bass -bg grey66 \
|
||||
-command { playDrum 36 } -width 7
|
||||
button .buttons.left.snare -text Snare -bg grey66 \
|
||||
-command { playDrum 38 } -width 7
|
||||
button .buttons.left.tomlo -text LoTom -bg grey66 \
|
||||
-command { playDrum 41 } -width 7
|
||||
button .buttons.left.tommid -text MidTom -bg grey66 \
|
||||
-command { playDrum 45 } -width 7
|
||||
button .buttons.left.tomhi -text HiTom -bg grey66 \
|
||||
-command { playDrum 50 } -width 7
|
||||
button .buttons.left.homer -text Homer -bg grey66 \
|
||||
-command { playDrum 90 } -width 7
|
||||
button .buttons.right.hat -text Hat -bg grey66 \
|
||||
-command { playDrum 42 } -width 7
|
||||
button .buttons.right.ride -text Ride -bg grey66 \
|
||||
-command { playDrum 46 } -width 7
|
||||
button .buttons.right.crash -text Crash -bg grey66 \
|
||||
-command { playDrum 49 } -width 7
|
||||
button .buttons.right.cowbel -text CowBel -bg grey66 \
|
||||
-command { playDrum 56 } -width 7
|
||||
button .buttons.right.tamb -text Tamb -bg grey66 \
|
||||
-command { playDrum 54 } -width 7
|
||||
button .buttons.right.homer -text Homer -bg grey66 \
|
||||
-command { playDrum 90 } -width 7
|
||||
|
||||
pack .buttons.left.bass -pady 5
|
||||
pack .buttons.left.snare -pady 5
|
||||
pack .buttons.left.tomlo -pady 5
|
||||
pack .buttons.left.tommid -pady 5
|
||||
pack .buttons.left.tomhi -pady 5
|
||||
pack .buttons.left.homer -pady 5
|
||||
pack .buttons.right.hat -pady 5
|
||||
pack .buttons.right.ride -pady 5
|
||||
pack .buttons.right.crash -pady 5
|
||||
pack .buttons.right.cowbel -pady 5
|
||||
pack .buttons.right.tamb -pady 5
|
||||
pack .buttons.right.homer -pady 5
|
||||
|
||||
pack .buttons.left -side left -pady 5 -padx 5
|
||||
pack .buttons.right -side right -pady 5 -padx 5
|
||||
pack .buttons -pady 5 -padx 5
|
||||
|
||||
# Configure exit button
|
||||
button .exit -text "Exit Program" -bg grey66 -command myExit
|
||||
pack .exit -side bottom -pady 20
|
||||
|
||||
#bind all <KeyPress> {
|
||||
bind . <KeyPress> {
|
||||
noteOn $pitch $press
|
||||
}
|
||||
|
||||
# Bind an X windows "close" event with the Exit routine
|
||||
bind . <Destroy> +myExit
|
||||
|
||||
proc myExit {} {
|
||||
global outID
|
||||
puts $outID [format "ExitProgram"]
|
||||
flush $outID
|
||||
close $outID
|
||||
exit
|
||||
}
|
||||
|
||||
proc playDrum {value} {
|
||||
global press
|
||||
global outID
|
||||
puts $outID [format "NoteOn 0.0 1 %i %f" $value $press]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc changePress {value} {
|
||||
global press
|
||||
set press $value
|
||||
}
|
||||
|
||||
# Socket connection procedure
|
||||
set d .socketdialog
|
||||
|
||||
proc setComm {} {
|
||||
global outID
|
||||
global commtype
|
||||
global d
|
||||
if {$commtype == "stdout"} {
|
||||
if { [string compare "stdout" $outID] } {
|
||||
set i [tk_dialog .dialog "Break Socket Connection?" {You are about to break an existing socket connection ... is this what you want to do?} "" 0 Cancel OK]
|
||||
switch $i {
|
||||
0 {set commtype "socket"}
|
||||
1 {close $outID
|
||||
set outID "stdout"}
|
||||
}
|
||||
}
|
||||
} elseif { ![string compare "stdout" $outID] } {
|
||||
set sockport 2001
|
||||
set sockhost localhost
|
||||
toplevel $d
|
||||
wm title $d "STK Client Socket Connection"
|
||||
wm resizable $d 0 0
|
||||
grab $d
|
||||
label $d.message -text "Specify a socket host and port number below (if different than the STK defaults shown) and then click the \"Connect\" button to invoke a socket-client connection attempt to the STK socket server." \
|
||||
-background white -font {Helvetica 10 bold} \
|
||||
-wraplength 3i -justify left
|
||||
frame $d.sockhost
|
||||
entry $d.sockhost.entry -width 15
|
||||
label $d.sockhost.text -text "Socket Host:" \
|
||||
-font {Helvetica 10 bold}
|
||||
frame $d.sockport
|
||||
entry $d.sockport.entry -width 15
|
||||
label $d.sockport.text -text "Socket Port:" \
|
||||
-font {Helvetica 10 bold}
|
||||
pack $d.message -side top -padx 5 -pady 10
|
||||
pack $d.sockhost.text -side left -padx 1 -pady 2
|
||||
pack $d.sockhost.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockhost -side top -padx 5 -pady 2
|
||||
pack $d.sockport.text -side left -padx 1 -pady 2
|
||||
pack $d.sockport.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockport -side top -padx 5 -pady 2
|
||||
$d.sockhost.entry insert 0 $sockhost
|
||||
$d.sockport.entry insert 0 $sockport
|
||||
frame $d.buttons
|
||||
button $d.buttons.cancel -text "Cancel" -bg grey66 \
|
||||
-command { set commtype "stdout"
|
||||
set outID "stdout"
|
||||
destroy $d }
|
||||
button $d.buttons.connect -text "Connect" -bg grey66 \
|
||||
-command {
|
||||
set sockhost [$d.sockhost.entry get]
|
||||
set sockport [$d.sockport.entry get]
|
||||
set err [catch {socket $sockhost $sockport} outID]
|
||||
|
||||
if {$err == 0} {
|
||||
destroy $d
|
||||
} else {
|
||||
tk_dialog $d.error "Socket Error" {Error: Unable to make socket connection. Make sure the STK socket server is first running and that the port number is correct.} "" 0 OK
|
||||
} }
|
||||
pack $d.buttons.cancel -side left -padx 5 -pady 10
|
||||
pack $d.buttons.connect -side right -padx 5 -pady 10
|
||||
pack $d.buttons -side bottom -padx 5 -pady 10
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,264 +1,264 @@
|
||||
set pitch 64.0
|
||||
set press 64.0
|
||||
set cont1 0.0
|
||||
set cont2 64.0
|
||||
set cont4 64.0
|
||||
set cont11 64.0
|
||||
set cont44 24.0
|
||||
set outID "stdout"
|
||||
set commtype "stdout"
|
||||
set preset 0
|
||||
|
||||
# Configure main window
|
||||
wm title . "STK Modal Bar GUI"
|
||||
wm iconname . "modal"
|
||||
. config -bg black
|
||||
|
||||
# Configure "communications" menu
|
||||
menu .menu -tearoff 0
|
||||
menu .menu.communication -tearoff 0
|
||||
.menu add cascade -label "Communication" -menu .menu.communication \
|
||||
-underline 0
|
||||
.menu.communication add radio -label "Console" -variable commtype \
|
||||
-value "stdout" -command { setComm }
|
||||
.menu.communication add radio -label "Socket" -variable commtype \
|
||||
-value "socket" -command { setComm }
|
||||
|
||||
# Configure preset radio buttons
|
||||
frame .radio1 -bg black
|
||||
frame .radio2 -bg black
|
||||
|
||||
radiobutton .radio1.0 -text Marimba -bg grey66 \
|
||||
-variable preset -value 0 -command { patchChange $preset }
|
||||
radiobutton .radio1.1 -text Vibraphone -bg grey66 \
|
||||
-variable preset -value 1 -command { patchChange $preset }
|
||||
radiobutton .radio1.2 -text Agogo -bg grey66 \
|
||||
-variable preset -value 2 -command { patchChange $preset }
|
||||
radiobutton .radio1.3 -text Wood1 -bg grey66 \
|
||||
-variable preset -value 3 -command { patchChange $preset }
|
||||
radiobutton .radio2.4 -text Reso -bg grey66 \
|
||||
-variable preset -value 4 -command { patchChange $preset }
|
||||
radiobutton .radio2.5 -text Wood2 -bg grey66 \
|
||||
-variable preset -value 5 -command { patchChange $preset }
|
||||
radiobutton .radio2.6 -text Beats -bg grey66 \
|
||||
-variable preset -value 6 -command { patchChange $preset }
|
||||
radiobutton .radio2.7 -text 2Fix -bg grey66 \
|
||||
-variable preset -value 7 -command { patchChange $preset }
|
||||
radiobutton .radio2.8 -text Clump -bg grey66 \
|
||||
-variable preset -value 8 -command { patchChange $preset }
|
||||
|
||||
pack .radio1.0 -side left -padx 5
|
||||
pack .radio1.1 -side left -padx 5 -pady 10
|
||||
pack .radio1.2 -side left -padx 5 -pady 10
|
||||
pack .radio1.3 -side left -padx 5 -pady 10
|
||||
pack .radio1
|
||||
pack .radio2.4 -side left -padx 5
|
||||
pack .radio2.5 -side left -padx 5
|
||||
pack .radio2.6 -side left -padx 5 -pady 10
|
||||
pack .radio2.7 -side left -padx 5 -pady 10
|
||||
pack .radio2.8 -side left -padx 5 -pady 10
|
||||
pack .radio2
|
||||
|
||||
# Configure bitmap display
|
||||
if {[file isdirectory bitmaps]} {
|
||||
set bitmappath bitmaps
|
||||
} else {
|
||||
set bitmappath tcl/bitmaps
|
||||
}
|
||||
|
||||
button .pretty -bitmap @$bitmappath/KModal.xbm \
|
||||
-background white -foreground black
|
||||
pack .pretty -padx 5 -pady 10
|
||||
|
||||
# Configure "note-on" buttons
|
||||
frame .noteOn -bg black
|
||||
|
||||
button .noteOn.on -text NoteOn -bg grey66 -command { noteOn $pitch $press }
|
||||
button .noteOn.off -text NoteOff -bg grey66 -command { noteOff $pitch 127.0 }
|
||||
button .noteOn.exit -text "Exit Program" -bg grey66 -command myExit
|
||||
pack .noteOn.on -side left -padx 5
|
||||
pack .noteOn.off -side left -padx 5 -pady 10
|
||||
pack .noteOn.exit -side left -padx 5 -pady 10
|
||||
|
||||
pack .noteOn
|
||||
|
||||
# Configure reverb slider
|
||||
frame .reverb -bg black
|
||||
|
||||
scale .reverb.mix -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 44} \
|
||||
-orient horizontal -label "Reverb Mix" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont44
|
||||
|
||||
pack .reverb.mix -padx 10 -pady 10
|
||||
pack .reverb
|
||||
|
||||
# Configure sliders
|
||||
frame .left -bg black
|
||||
frame .right -bg black
|
||||
|
||||
scale .left.bPressure -from 0 -to 128 -length 200 \
|
||||
-command {changePress } -variable press \
|
||||
-orient horizontal -label "Strike Vigor" \
|
||||
-tickinterval 32 -showvalue true -bg grey66
|
||||
|
||||
scale .left.pitch -from 0 -to 128 -length 200 \
|
||||
-command {changePitch } -variable pitch \
|
||||
-orient horizontal -label "MIDI Note Number" \
|
||||
-tickinterval 32 -showvalue true -bg grey66
|
||||
|
||||
scale .left.cont2 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 2} \
|
||||
-orient horizontal -label "Stick Hardness" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont2
|
||||
|
||||
scale .right.cont4 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 4} \
|
||||
-orient horizontal -label "Stick Position" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont4
|
||||
|
||||
scale .right.cont11 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 11} \
|
||||
-orient horizontal -label "Disabled" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont11 -state disabled
|
||||
|
||||
scale .right.cont1 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 1} \
|
||||
-orient horizontal -label "Direct Stick Mix" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont1
|
||||
|
||||
pack .left.bPressure -padx 10 -pady 10
|
||||
pack .left.pitch -padx 10 -pady 10
|
||||
pack .left.cont2 -padx 10 -pady 10
|
||||
pack .right.cont4 -padx 10 -pady 10
|
||||
pack .right.cont11 -padx 10 -pady 10
|
||||
pack .right.cont1 -padx 10 -pady 10
|
||||
|
||||
pack .left -side left
|
||||
pack .right -side right
|
||||
|
||||
#bind all <KeyPress> {
|
||||
bind . <KeyPress> {
|
||||
noteOn $pitch $press
|
||||
}
|
||||
|
||||
# Bind an X windows "close" event with the Exit routine
|
||||
bind . <Destroy> +myExit
|
||||
|
||||
proc myExit {} {
|
||||
global pitch outID
|
||||
puts $outID [format "ExitProgram"]
|
||||
flush $outID
|
||||
close $outID
|
||||
exit
|
||||
}
|
||||
|
||||
proc noteOn {pitchVal pressVal} {
|
||||
global outID
|
||||
puts $outID [format "NoteOn 0.0 1 %3.2f %3.2f" $pitchVal $pressVal]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc noteOff {pitchVal pressVal} {
|
||||
global outID
|
||||
puts $outID [format "NoteOff 0.0 1 %3.2f %3.2f" $pitchVal $pressVal]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc patchChange {value} {
|
||||
global outID preset
|
||||
if {$preset == 1} {
|
||||
.right.cont11 config -state normal -label "Vibrato Gain"
|
||||
} else {
|
||||
.right.cont11 config -state disabled -label "Disabled"
|
||||
}
|
||||
printWhatz "ControlChange 0.0 1 " 16 $preset
|
||||
}
|
||||
|
||||
proc printWhatz {tag value1 value2 } {
|
||||
global outID
|
||||
puts $outID [format "%s %2i %3.2f" $tag $value1 $value2]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc changePress {value} {
|
||||
global outID
|
||||
puts $outID [format "AfterTouch 0.0 1 %3.2f" $value]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc changePitch {value} {
|
||||
global outID
|
||||
puts $outID [format "PitchBend 0.0 1 %3.2f" $value]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
# Socket connection procedure
|
||||
set d .socketdialog
|
||||
|
||||
proc setComm {} {
|
||||
global outID commtype d
|
||||
if {$commtype == "stdout"} {
|
||||
if { [string compare "stdout" $outID] } {
|
||||
set i [tk_dialog .dialog "Break Socket Connection?" {You are about to break an existing socket connection ... is this what you want to do?} "" 0 Cancel OK]
|
||||
switch $i {
|
||||
0 {set commtype "socket"}
|
||||
1 {close $outID
|
||||
set outID "stdout"}
|
||||
}
|
||||
}
|
||||
} elseif { ![string compare "stdout" $outID] } {
|
||||
set sockport 2001
|
||||
set sockhost localhost
|
||||
toplevel $d
|
||||
wm title $d "STK Client Socket Connection"
|
||||
wm resizable $d 0 0
|
||||
grab $d
|
||||
label $d.message -text "Specify a socket host and port number below (if different than the STK defaults shown) and then click the \"Connect\" button to invoke a socket-client connection attempt to the STK socket server." \
|
||||
-background white -font {Helvetica 10 bold} \
|
||||
-wraplength 3i -justify left
|
||||
frame $d.sockhost
|
||||
entry $d.sockhost.entry -width 15
|
||||
label $d.sockhost.text -text "Socket Host:" \
|
||||
-font {Helvetica 10 bold}
|
||||
frame $d.sockport
|
||||
entry $d.sockport.entry -width 15
|
||||
label $d.sockport.text -text "Socket Port:" \
|
||||
-font {Helvetica 10 bold}
|
||||
pack $d.message -side top -padx 5 -pady 10
|
||||
pack $d.sockhost.text -side left -padx 1 -pady 2
|
||||
pack $d.sockhost.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockhost -side top -padx 5 -pady 2
|
||||
pack $d.sockport.text -side left -padx 1 -pady 2
|
||||
pack $d.sockport.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockport -side top -padx 5 -pady 2
|
||||
$d.sockhost.entry insert 0 $sockhost
|
||||
$d.sockport.entry insert 0 $sockport
|
||||
frame $d.buttons
|
||||
button $d.buttons.cancel -text "Cancel" -bg grey66 \
|
||||
-command { set commtype "stdout"
|
||||
set outID "stdout"
|
||||
destroy $d }
|
||||
button $d.buttons.connect -text "Connect" -bg grey66 \
|
||||
-command {
|
||||
set sockhost [$d.sockhost.entry get]
|
||||
set sockport [$d.sockport.entry get]
|
||||
set err [catch {socket $sockhost $sockport} outID]
|
||||
|
||||
if {$err == 0} {
|
||||
destroy $d
|
||||
} else {
|
||||
tk_dialog $d.error "Socket Error" {Error: Unable to make socket connection. Make sure the STK socket server is first running and that the port number is correct.} "" 0 OK
|
||||
} }
|
||||
pack $d.buttons.cancel -side left -padx 5 -pady 10
|
||||
pack $d.buttons.connect -side right -padx 5 -pady 10
|
||||
pack $d.buttons -side bottom -padx 5 -pady 10
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
set pitch 64.0
|
||||
set press 64.0
|
||||
set cont1 0.0
|
||||
set cont2 64.0
|
||||
set cont4 64.0
|
||||
set cont11 64.0
|
||||
set cont44 24.0
|
||||
set outID "stdout"
|
||||
set commtype "stdout"
|
||||
set preset 0
|
||||
|
||||
# Configure main window
|
||||
wm title . "STK Modal Bar Interface"
|
||||
wm iconname . "modal"
|
||||
. config -bg black
|
||||
|
||||
# Configure "communications" menu
|
||||
menu .menu -tearoff 0
|
||||
menu .menu.communication -tearoff 0
|
||||
.menu add cascade -label "Communication" -menu .menu.communication \
|
||||
-underline 0
|
||||
.menu.communication add radio -label "Console" -variable commtype \
|
||||
-value "stdout" -command { setComm }
|
||||
.menu.communication add radio -label "Socket" -variable commtype \
|
||||
-value "socket" -command { setComm }
|
||||
|
||||
# Configure preset radio buttons
|
||||
frame .radio1 -bg black
|
||||
frame .radio2 -bg black
|
||||
|
||||
radiobutton .radio1.0 -text Marimba -bg grey66 \
|
||||
-variable preset -value 0 -command { patchChange $preset }
|
||||
radiobutton .radio1.1 -text Vibraphone -bg grey66 \
|
||||
-variable preset -value 1 -command { patchChange $preset }
|
||||
radiobutton .radio1.2 -text Agogo -bg grey66 \
|
||||
-variable preset -value 2 -command { patchChange $preset }
|
||||
radiobutton .radio1.3 -text Wood1 -bg grey66 \
|
||||
-variable preset -value 3 -command { patchChange $preset }
|
||||
radiobutton .radio2.4 -text Reso -bg grey66 \
|
||||
-variable preset -value 4 -command { patchChange $preset }
|
||||
radiobutton .radio2.5 -text Wood2 -bg grey66 \
|
||||
-variable preset -value 5 -command { patchChange $preset }
|
||||
radiobutton .radio2.6 -text Beats -bg grey66 \
|
||||
-variable preset -value 6 -command { patchChange $preset }
|
||||
radiobutton .radio2.7 -text 2Fix -bg grey66 \
|
||||
-variable preset -value 7 -command { patchChange $preset }
|
||||
radiobutton .radio2.8 -text Clump -bg grey66 \
|
||||
-variable preset -value 8 -command { patchChange $preset }
|
||||
|
||||
pack .radio1.0 -side left -padx 5
|
||||
pack .radio1.1 -side left -padx 5 -pady 10
|
||||
pack .radio1.2 -side left -padx 5 -pady 10
|
||||
pack .radio1.3 -side left -padx 5 -pady 10
|
||||
pack .radio1
|
||||
pack .radio2.4 -side left -padx 5
|
||||
pack .radio2.5 -side left -padx 5
|
||||
pack .radio2.6 -side left -padx 5 -pady 10
|
||||
pack .radio2.7 -side left -padx 5 -pady 10
|
||||
pack .radio2.8 -side left -padx 5 -pady 10
|
||||
pack .radio2
|
||||
|
||||
# Configure bitmap display
|
||||
if {[file isdirectory bitmaps]} {
|
||||
set bitmappath bitmaps
|
||||
} else {
|
||||
set bitmappath tcl/bitmaps
|
||||
}
|
||||
|
||||
button .pretty -bitmap @$bitmappath/KModal.xbm \
|
||||
-background white -foreground black
|
||||
pack .pretty -padx 5 -pady 10
|
||||
|
||||
# Configure "note-on" buttons
|
||||
frame .noteOn -bg black
|
||||
|
||||
button .noteOn.on -text NoteOn -bg grey66 -command { noteOn $pitch $press }
|
||||
button .noteOn.off -text NoteOff -bg grey66 -command { noteOff $pitch 127.0 }
|
||||
button .noteOn.exit -text "Exit Program" -bg grey66 -command myExit
|
||||
pack .noteOn.on -side left -padx 5
|
||||
pack .noteOn.off -side left -padx 5 -pady 10
|
||||
pack .noteOn.exit -side left -padx 5 -pady 10
|
||||
|
||||
pack .noteOn
|
||||
|
||||
# Configure reverb slider
|
||||
frame .reverb -bg black
|
||||
|
||||
scale .reverb.mix -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 44} \
|
||||
-orient horizontal -label "Reverb Mix" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont44
|
||||
|
||||
pack .reverb.mix -padx 10 -pady 10
|
||||
pack .reverb
|
||||
|
||||
# Configure sliders
|
||||
frame .left -bg black
|
||||
frame .right -bg black
|
||||
|
||||
scale .left.bPressure -from 0 -to 128 -length 200 \
|
||||
-command {changePress } -variable press \
|
||||
-orient horizontal -label "Strike Vigor" \
|
||||
-tickinterval 32 -showvalue true -bg grey66
|
||||
|
||||
scale .left.pitch -from 0 -to 128 -length 200 \
|
||||
-command {changePitch } -variable pitch \
|
||||
-orient horizontal -label "MIDI Note Number" \
|
||||
-tickinterval 32 -showvalue true -bg grey66
|
||||
|
||||
scale .left.cont2 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 2} \
|
||||
-orient horizontal -label "Stick Hardness" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont2
|
||||
|
||||
scale .right.cont4 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 4} \
|
||||
-orient horizontal -label "Stick Position" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont4
|
||||
|
||||
scale .right.cont11 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 11} \
|
||||
-orient horizontal -label "Disabled" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont11 -state disabled
|
||||
|
||||
scale .right.cont1 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 1} \
|
||||
-orient horizontal -label "Direct Stick Mix" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont1
|
||||
|
||||
pack .left.bPressure -padx 10 -pady 10
|
||||
pack .left.pitch -padx 10 -pady 10
|
||||
pack .left.cont2 -padx 10 -pady 10
|
||||
pack .right.cont4 -padx 10 -pady 10
|
||||
pack .right.cont11 -padx 10 -pady 10
|
||||
pack .right.cont1 -padx 10 -pady 10
|
||||
|
||||
pack .left -side left
|
||||
pack .right -side right
|
||||
|
||||
#bind all <KeyPress> {
|
||||
bind . <KeyPress> {
|
||||
noteOn $pitch $press
|
||||
}
|
||||
|
||||
# Bind an X windows "close" event with the Exit routine
|
||||
bind . <Destroy> +myExit
|
||||
|
||||
proc myExit {} {
|
||||
global pitch outID
|
||||
puts $outID [format "ExitProgram"]
|
||||
flush $outID
|
||||
close $outID
|
||||
exit
|
||||
}
|
||||
|
||||
proc noteOn {pitchVal pressVal} {
|
||||
global outID
|
||||
puts $outID [format "NoteOn 0.0 1 %3.2f %3.2f" $pitchVal $pressVal]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc noteOff {pitchVal pressVal} {
|
||||
global outID
|
||||
puts $outID [format "NoteOff 0.0 1 %3.2f %3.2f" $pitchVal $pressVal]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc patchChange {value} {
|
||||
global outID preset
|
||||
if {$preset == 1} {
|
||||
.right.cont11 config -state normal -label "Vibrato Gain"
|
||||
} else {
|
||||
.right.cont11 config -state disabled -label "Disabled"
|
||||
}
|
||||
printWhatz "ControlChange 0.0 1 " 16 $preset
|
||||
}
|
||||
|
||||
proc printWhatz {tag value1 value2 } {
|
||||
global outID
|
||||
puts $outID [format "%s %2i %3.2f" $tag $value1 $value2]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc changePress {value} {
|
||||
global outID
|
||||
puts $outID [format "AfterTouch 0.0 1 %3.2f" $value]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc changePitch {value} {
|
||||
global outID
|
||||
puts $outID [format "PitchChange 0.0 1 %3.2f" $value]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
# Socket connection procedure
|
||||
set d .socketdialog
|
||||
|
||||
proc setComm {} {
|
||||
global outID commtype d
|
||||
if {$commtype == "stdout"} {
|
||||
if { [string compare "stdout" $outID] } {
|
||||
set i [tk_dialog .dialog "Break Socket Connection?" {You are about to break an existing socket connection ... is this what you want to do?} "" 0 Cancel OK]
|
||||
switch $i {
|
||||
0 {set commtype "socket"}
|
||||
1 {close $outID
|
||||
set outID "stdout"}
|
||||
}
|
||||
}
|
||||
} elseif { ![string compare "stdout" $outID] } {
|
||||
set sockport 2001
|
||||
set sockhost localhost
|
||||
toplevel $d
|
||||
wm title $d "STK Client Socket Connection"
|
||||
wm resizable $d 0 0
|
||||
grab $d
|
||||
label $d.message -text "Specify a socket host and port number below (if different than the STK defaults shown) and then click the \"Connect\" button to invoke a socket-client connection attempt to the STK socket server." \
|
||||
-background white -font {Helvetica 10 bold} \
|
||||
-wraplength 3i -justify left
|
||||
frame $d.sockhost
|
||||
entry $d.sockhost.entry -width 15
|
||||
label $d.sockhost.text -text "Socket Host:" \
|
||||
-font {Helvetica 10 bold}
|
||||
frame $d.sockport
|
||||
entry $d.sockport.entry -width 15
|
||||
label $d.sockport.text -text "Socket Port:" \
|
||||
-font {Helvetica 10 bold}
|
||||
pack $d.message -side top -padx 5 -pady 10
|
||||
pack $d.sockhost.text -side left -padx 1 -pady 2
|
||||
pack $d.sockhost.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockhost -side top -padx 5 -pady 2
|
||||
pack $d.sockport.text -side left -padx 1 -pady 2
|
||||
pack $d.sockport.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockport -side top -padx 5 -pady 2
|
||||
$d.sockhost.entry insert 0 $sockhost
|
||||
$d.sockport.entry insert 0 $sockport
|
||||
frame $d.buttons
|
||||
button $d.buttons.cancel -text "Cancel" -bg grey66 \
|
||||
-command { set commtype "stdout"
|
||||
set outID "stdout"
|
||||
destroy $d }
|
||||
button $d.buttons.connect -text "Connect" -bg grey66 \
|
||||
-command {
|
||||
set sockhost [$d.sockhost.entry get]
|
||||
set sockport [$d.sockport.entry get]
|
||||
set err [catch {socket $sockhost $sockport} outID]
|
||||
|
||||
if {$err == 0} {
|
||||
destroy $d
|
||||
} else {
|
||||
tk_dialog $d.error "Socket Error" {Error: Unable to make socket connection. Make sure the STK socket server is first running and that the port number is correct.} "" 0 OK
|
||||
} }
|
||||
pack $d.buttons.cancel -side left -padx 5 -pady 10
|
||||
pack $d.buttons.connect -side right -padx 5 -pady 10
|
||||
pack $d.buttons -side bottom -padx 5 -pady 10
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,445 +1,445 @@
|
||||
# Tcl/Tk Physical Model GUI for the Synthesis Toolkit (STK)
|
||||
|
||||
# Set initial control values
|
||||
set pitch 64.0
|
||||
set press 64.0
|
||||
set cont1 0.0
|
||||
set cont2 20.0
|
||||
set cont4 64.0
|
||||
set cont11 64.0
|
||||
set cont44 24.0
|
||||
set outID "stdout"
|
||||
set commtype "stdout"
|
||||
set oldpatch 0
|
||||
set patchnum 0
|
||||
|
||||
# Configure main window
|
||||
wm title . "STK Physical Model Controller"
|
||||
wm iconname . "physical"
|
||||
. config -bg black
|
||||
|
||||
# Configure "communications" menu
|
||||
menu .menu -tearoff 0
|
||||
menu .menu.communication -tearoff 0
|
||||
.menu add cascade -label "Communication" -menu .menu.communication \
|
||||
-underline 0
|
||||
.menu.communication add radio -label "Console" -variable commtype \
|
||||
-value "stdout" -command { setComm }
|
||||
.menu.communication add radio -label "Socket" -variable commtype \
|
||||
-value "socket" -command { setComm }
|
||||
. configure -menu .menu
|
||||
|
||||
# Configure patch change buttons
|
||||
frame .radios1 -bg black
|
||||
frame .radios2 -bg black
|
||||
|
||||
radiobutton .radios1.clar -text "Clarinet" -bg grey66 \
|
||||
-variable patchnum -value 0 -command { patchChange $patchnum }
|
||||
radiobutton .radios1.hole -text "BlowHole" -bg grey66 \
|
||||
-variable patchnum -value 1 -command { patchChange $patchnum }
|
||||
radiobutton .radios1.fony -text "Saxofony" -bg grey66 \
|
||||
-variable patchnum -value 2 -command { patchChange $patchnum }
|
||||
radiobutton .radios1.flut -text "Flute" -bg grey66 \
|
||||
-variable patchnum -value 3 -command { patchChange $patchnum }
|
||||
radiobutton .radios1.bras -text "Brass" -bg grey66 \
|
||||
-variable patchnum -value 4 -command { patchChange $patchnum }
|
||||
radiobutton .radios1.botl -text "BlowBotl" -bg grey66 \
|
||||
-variable patchnum -value 5 -command { patchChange $patchnum }
|
||||
radiobutton .radios2.bowd -text "Bowed" -bg grey66 \
|
||||
-variable patchnum -value 6 -command { patchChange $patchnum }
|
||||
radiobutton .radios2.pluk -text "Plucked" -bg grey66 \
|
||||
-variable patchnum -value 7 -command { patchChange $patchnum }
|
||||
radiobutton .radios2.karp -text "StifKarp" -bg grey66 \
|
||||
-variable patchnum -value 8 -command { patchChange $patchnum }
|
||||
radiobutton .radios2.sitr -text "Sitar" -bg grey66 \
|
||||
-variable patchnum -value 9 -command { patchChange $patchnum }
|
||||
radiobutton .radios2.mand -text "Mandolin" -bg grey66 \
|
||||
-variable patchnum -value 10 -command { patchChange $patchnum }
|
||||
|
||||
pack .radios1.clar -side left -padx 5 -pady 10
|
||||
pack .radios1.hole -side left -padx 5 -pady 10
|
||||
pack .radios1.fony -side left -padx 5 -pady 10
|
||||
pack .radios1.flut -side left -padx 5 -pady 10
|
||||
pack .radios1.bras -side left -padx 5 -pady 10
|
||||
pack .radios1.botl -side left -padx 5 -pady 10
|
||||
pack .radios2.bowd -side left -padx 5 -pady 10
|
||||
pack .radios2.pluk -side left -padx 5 -pady 10
|
||||
pack .radios2.karp -side left -padx 5 -pady 10
|
||||
pack .radios2.sitr -side left -padx 5 -pady 10
|
||||
pack .radios2.mand -side left -padx 5 -pady 10
|
||||
|
||||
pack .radios1
|
||||
pack .radios2
|
||||
|
||||
# Configure bitmap display
|
||||
if {[file isdirectory bitmaps]} {
|
||||
set bitmappath bitmaps
|
||||
} else {
|
||||
set bitmappath tcl/bitmaps
|
||||
}
|
||||
button .pretty -bitmap @$bitmappath/Klar.xbm \
|
||||
-background white -foreground black
|
||||
pack .pretty -padx 5 -pady 10
|
||||
|
||||
# Configure "note-on" buttons
|
||||
frame .noteOn -bg black
|
||||
|
||||
button .noteOn.on -text NoteOn -bg grey66 -command { noteOn $pitch $press }
|
||||
button .noteOn.off -text NoteOff -bg grey66 -command { noteOff $pitch 127.0 }
|
||||
button .noteOn.exit -text "Exit Program" -bg grey66 -command myExit
|
||||
pack .noteOn.on -side left -padx 5
|
||||
pack .noteOn.off -side left -padx 5 -pady 10
|
||||
pack .noteOn.exit -side left -padx 5 -pady 10
|
||||
|
||||
pack .noteOn
|
||||
|
||||
# Configure reverb slider
|
||||
frame .reverb -bg black
|
||||
|
||||
scale .reverb.mix -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 44} \
|
||||
-orient horizontal -label "Reverb Mix" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont44
|
||||
|
||||
pack .reverb.mix -padx 10 -pady 10
|
||||
pack .reverb
|
||||
|
||||
# Configure sliders
|
||||
frame .left -bg black
|
||||
frame .right -bg black
|
||||
|
||||
scale .left.bPressure -from 0 -to 128 -length 200 \
|
||||
-command {changePress } -variable press \
|
||||
-orient horizontal -label "Breath Pressure" \
|
||||
-tickinterval 32 -showvalue true -bg grey66
|
||||
|
||||
scale .left.pitch -from 0 -to 128 -length 200 \
|
||||
-command {changePitch } -variable pitch \
|
||||
-orient horizontal -label "MIDI Note Number" \
|
||||
-tickinterval 32 -showvalue true -bg grey66
|
||||
|
||||
scale .left.cont2 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 2} \
|
||||
-orient horizontal -label "Reed Stiffness" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont2
|
||||
|
||||
scale .right.cont4 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 4} \
|
||||
-orient horizontal -label "Breath Noise" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont4
|
||||
|
||||
scale .right.cont11 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 11} \
|
||||
-orient horizontal -label "Vibrato Rate" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont11
|
||||
|
||||
scale .right.cont1 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 1} \
|
||||
-orient horizontal -label "Vibrato Amount" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont1
|
||||
|
||||
pack .left.bPressure -padx 10 -pady 10
|
||||
pack .left.pitch -padx 10 -pady 10
|
||||
pack .left.cont2 -padx 10 -pady 10
|
||||
pack .right.cont4 -padx 10 -pady 10
|
||||
pack .right.cont11 -padx 10 -pady 10
|
||||
pack .right.cont1 -padx 10 -pady 10
|
||||
|
||||
pack .left -side left
|
||||
pack .right -side right
|
||||
|
||||
#bind all <KeyPress> {
|
||||
bind . <KeyPress> {
|
||||
noteOn $pitch $press
|
||||
}
|
||||
|
||||
# Bind an X windows "close" event with the Exit routine
|
||||
bind . <Destroy> +myExit
|
||||
|
||||
proc myExit {} {
|
||||
global pitch outID
|
||||
puts $outID [format "ExitProgram"]
|
||||
flush $outID
|
||||
close $outID
|
||||
exit
|
||||
}
|
||||
|
||||
proc noteOn {pitchVal pressVal} {
|
||||
global outID
|
||||
puts $outID [format "NoteOn 0.0 1 %f %f" $pitchVal $pressVal]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc noteOff {pitchVal pressVal} {
|
||||
global outID
|
||||
puts $outID [format "NoteOff 0.0 1 %f %f" $pitchVal $pressVal]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc patchChange {value} {
|
||||
global outID bitmappath cont1 cont2 cont4 cont11 pitch oldpatch
|
||||
puts $outID [format "ProgramChange 0.0 1 %i" $value]
|
||||
if {$value==0} { # Clarinet
|
||||
.pretty config -bitmap @$bitmappath/Klar.xbm
|
||||
.left.bPressure config -state normal -label "Breath Pressure"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state normal -label "Reed Stiffness"
|
||||
.right.cont4 config -state normal -label "Breath Noise"
|
||||
.right.cont11 config -state normal -label "Vibrato Rate"
|
||||
.right.cont1 config -state normal -label "Vibrato Amount"
|
||||
set cont1 20.0
|
||||
set cont2 64.0
|
||||
set cont4 20.0
|
||||
set cont11 64.0
|
||||
printWhatz "ControlChange 0.0 1 " 1 $cont1
|
||||
printWhatz "ControlChange 0.0 1 " 2 $cont2
|
||||
printWhatz "ControlChange 0.0 1 " 4 $cont4
|
||||
printWhatz "ControlChange 0.0 1 " 11 $cont11
|
||||
}
|
||||
if {$value==1} { # BlowHole
|
||||
.pretty config -bitmap @$bitmappath/Klar.xbm
|
||||
.left.bPressure config -state normal -label "Breath Pressure"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state normal -label "Reed Stiffness"
|
||||
.right.cont4 config -state normal -label "Breath Noise"
|
||||
.right.cont11 config -state normal -label "Tonehole Openness"
|
||||
.right.cont1 config -state normal -label "Register Vent Openness"
|
||||
set cont1 0.0
|
||||
set cont2 64.0
|
||||
set cont4 20.0
|
||||
set cont11 0.0
|
||||
printWhatz "ControlChange 0.0 1 " 1 $cont1
|
||||
printWhatz "ControlChange 0.0 1 " 2 $cont2
|
||||
printWhatz "ControlChange 0.0 1 " 4 $cont4
|
||||
printWhatz "ControlChange 0.0 1 " 11 $cont11
|
||||
}
|
||||
if {$value==2} { # Saxofony
|
||||
.pretty config -bitmap @$bitmappath/prcFunny.xbm
|
||||
.left.bPressure config -state normal -label "Breath Pressure"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state normal -label "Reed Stiffness"
|
||||
.right.cont4 config -state normal -label "Breath Noise"
|
||||
.right.cont11 config -state normal -label "Blow Position"
|
||||
.right.cont1 config -state normal -label "Vibrato Amount"
|
||||
set cont1 20.0
|
||||
set cont2 64.0
|
||||
set cont4 20.0
|
||||
set cont11 26.0
|
||||
printWhatz "ControlChange 0.0 1 " 1 $cont1
|
||||
printWhatz "ControlChange 0.0 1 " 2 $cont2
|
||||
printWhatz "ControlChange 0.0 1 " 4 $cont4
|
||||
printWhatz "ControlChange 0.0 1 " 11 $cont11
|
||||
}
|
||||
if {$value==3} { # Flute
|
||||
.pretty config -bitmap @$bitmappath/KFloot.xbm
|
||||
.left.bPressure config -state normal -label "Breath Pressure"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state normal -label "Embouchure Adjustment"
|
||||
.right.cont4 config -state normal -label "Breath Noise"
|
||||
.right.cont11 config -state normal -label "Vibrato Rate"
|
||||
.right.cont1 config -state normal -label "Vibrato Amount"
|
||||
set cont1 20.0
|
||||
set cont2 64.0
|
||||
set cont4 20.0
|
||||
set cont11 64.0
|
||||
printWhatz "ControlChange 0.0 1 " 1 $cont1
|
||||
printWhatz "ControlChange 0.0 1 " 2 $cont2
|
||||
printWhatz "ControlChange 0.0 1 " 4 $cont4
|
||||
printWhatz "ControlChange 0.0 1 " 11 $cont11
|
||||
}
|
||||
if {$value==4} { # Brass
|
||||
.pretty config -bitmap @$bitmappath/KHose.xbm
|
||||
.left.bPressure config -state normal -label "Breath Pressure"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state normal -label "Lip Adjustment"
|
||||
.right.cont4 config -state normal -label "Slide Length"
|
||||
.right.cont11 config -state normal -label "Vibrato Rate"
|
||||
.right.cont1 config -state normal -label "Vibrato Amount"
|
||||
set cont1 0.0
|
||||
set cont2 64.0
|
||||
set cont4 20.0
|
||||
set cont11 64.0
|
||||
set press 80.0
|
||||
printWhatz "ControlChange 0.0 1 " 1 $cont1
|
||||
printWhatz "ControlChange 0.0 1 " 2 $cont2
|
||||
printWhatz "ControlChange 0.0 1 " 4 $cont4
|
||||
printWhatz "ControlChange 0.0 1 " 11 $cont11
|
||||
puts $outID [format "NoteOn 0.0 1 %3.2f %3.2f" $pitch $press]
|
||||
}
|
||||
if {$value==5} { # Bottle
|
||||
.pretty config -bitmap @$bitmappath/prcFunny.xbm
|
||||
.left.bPressure config -state normal -label "Breath Pressure"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state disabled -label "Disabled"
|
||||
.right.cont4 config -state normal -label "Breath Noise"
|
||||
.right.cont11 config -state normal -label "Vibrato Rate"
|
||||
.right.cont1 config -state normal -label "Vibrato Amount"
|
||||
set cont1 20.0
|
||||
set cont4 20.0
|
||||
set cont11 64.0
|
||||
printWhatz "ControlChange 0.0 1 " 1 $cont1
|
||||
printWhatz "ControlChange 0.0 1 " 4 $cont4
|
||||
printWhatz "ControlChange 0.0 1 " 11 $cont11
|
||||
}
|
||||
if {$value==6} { # Bowed String
|
||||
.pretty config -bitmap @$bitmappath/KFiddl.xbm
|
||||
.left.bPressure config -state normal -label "Volume"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state normal -label "Bow Pressure"
|
||||
.right.cont4 config -state normal -label "Bow Position"
|
||||
.right.cont11 config -state normal -label "Vibrato Rate"
|
||||
.right.cont1 config -state normal -label "Vibrato Amount"
|
||||
set cont1 4.0
|
||||
set cont2 64.0
|
||||
set cont4 64.0
|
||||
set cont11 64.0
|
||||
printWhatz "ControlChange 0.0 1 " 1 $cont1
|
||||
printWhatz "ControlChange 0.0 1 " 2 $cont2
|
||||
printWhatz "ControlChange 0.0 1 " 4 $cont4
|
||||
printWhatz "ControlChange 0.0 1 " 11 $cont11
|
||||
}
|
||||
if {$value==7} { # Yer Basic Pluck
|
||||
.pretty config -bitmap @$bitmappath/KPluk.xbm
|
||||
.left.bPressure config -state normal -label "Pluck Strength"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state disabled -label "Disabled"
|
||||
.right.cont4 config -state disabled -label "Disabled"
|
||||
.right.cont11 config -state disabled -label "Disabled"
|
||||
.right.cont1 config -state disabled -label "Disabled"
|
||||
}
|
||||
if {$value==8} { # Stiff String
|
||||
.pretty config -bitmap @$bitmappath/KPluk.xbm
|
||||
.left.bPressure config -state normal -label "Pluck Strength"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state disabled -label "Disabled"
|
||||
.right.cont4 config -state normal -label "Pickup Position"
|
||||
.right.cont11 config -state normal -label "String Sustain"
|
||||
.right.cont1 config -state normal -label "String Stretch"
|
||||
set cont1 10.0
|
||||
set cont4 64.0
|
||||
set cont11 96.0
|
||||
printWhatz "ControlChange 0.0 1 " 1 $cont1
|
||||
printWhatz "ControlChange 0.0 1 " 4 $cont4
|
||||
printWhatz "ControlChange 0.0 1 " 11 $cont11
|
||||
}
|
||||
if {$value==9} { # Sitar
|
||||
.pretty config -bitmap @$bitmappath/KPluk.xbm
|
||||
.left.bPressure config -state normal -label "Pluck Strength"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state disabled -label "Disabled"
|
||||
.right.cont4 config -state disabled -label "Disabled"
|
||||
.right.cont11 config -state disabled -label "Disabled"
|
||||
.right.cont1 config -state disabled -label "Disabled"
|
||||
}
|
||||
if {$value==10} { # Mandolin
|
||||
.pretty config -bitmap @$bitmappath/KPluk.xbm
|
||||
.left.bPressure config -state normal -label "Microphone Position and Gain"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state normal -label "Mandolin Body Size"
|
||||
.right.cont4 config -state normal -label "Pick Position"
|
||||
.right.cont11 config -state normal -label "String Sustain"
|
||||
.right.cont1 config -state normal -label "String Detune"
|
||||
set cont1 10.0
|
||||
set cont2 64.0
|
||||
set cont4 64.0
|
||||
set cont11 96.0
|
||||
set press 64.0
|
||||
printWhatz "ControlChange 0.0 1 " 1 $cont1
|
||||
printWhatz "ControlChange 0.0 1 " 2 $cont2
|
||||
printWhatz "ControlChange 0.0 1 " 4 $cont4
|
||||
printWhatz "ControlChange 0.0 1 " 11 $cont11
|
||||
changePress $press
|
||||
}
|
||||
set oldpatch $value
|
||||
}
|
||||
|
||||
proc printWhatz {tag value1 value2 } {
|
||||
global outID
|
||||
puts $outID [format "%s %i %f" $tag $value1 $value2]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc changePress {value} {
|
||||
global outID patchnum
|
||||
if { $patchnum<7 || $patchnum>9 } {
|
||||
puts $outID [format "AfterTouch 0.0 1 %f" $value]
|
||||
flush $outID
|
||||
}
|
||||
}
|
||||
|
||||
proc changePitch {value} {
|
||||
global outID
|
||||
puts $outID [format "PitchBend 0.0 1 %.3f" $value]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
# Socket connection procedure
|
||||
set d .socketdialog
|
||||
|
||||
proc setComm {} {
|
||||
global outID
|
||||
global commtype
|
||||
global d
|
||||
if {$commtype == "stdout"} {
|
||||
if { [string compare "stdout" $outID] } {
|
||||
set i [tk_dialog .dialog "Break Socket Connection?" {You are about to break an existing socket connection ... is this what you want to do?} "" 0 Cancel OK]
|
||||
switch $i {
|
||||
0 {set commtype "socket"}
|
||||
1 {close $outID
|
||||
set outID "stdout"}
|
||||
}
|
||||
}
|
||||
} elseif { ![string compare "stdout" $outID] } {
|
||||
set sockport 2001
|
||||
set sockhost localhost
|
||||
toplevel $d
|
||||
wm title $d "STK Client Socket Connection"
|
||||
wm resizable $d 0 0
|
||||
grab $d
|
||||
label $d.message -text "Specify a socket host and port number below (if different than the STK defaults shown) and then click the \"Connect\" button to invoke a socket-client connection attempt to the STK socket server." \
|
||||
-background white -font {Helvetica 10 bold} \
|
||||
-wraplength 3i -justify left
|
||||
frame $d.sockhost
|
||||
entry $d.sockhost.entry -width 15
|
||||
label $d.sockhost.text -text "Socket Host:" \
|
||||
-font {Helvetica 10 bold}
|
||||
frame $d.sockport
|
||||
entry $d.sockport.entry -width 15
|
||||
label $d.sockport.text -text "Socket Port:" \
|
||||
-font {Helvetica 10 bold}
|
||||
pack $d.message -side top -padx 5 -pady 10
|
||||
pack $d.sockhost.text -side left -padx 1 -pady 2
|
||||
pack $d.sockhost.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockhost -side top -padx 5 -pady 2
|
||||
pack $d.sockport.text -side left -padx 1 -pady 2
|
||||
pack $d.sockport.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockport -side top -padx 5 -pady 2
|
||||
$d.sockhost.entry insert 0 $sockhost
|
||||
$d.sockport.entry insert 0 $sockport
|
||||
frame $d.buttons
|
||||
button $d.buttons.cancel -text "Cancel" -bg grey66 \
|
||||
-command { set commtype "stdout"
|
||||
set outID "stdout"
|
||||
destroy $d }
|
||||
button $d.buttons.connect -text "Connect" -bg grey66 \
|
||||
-command {
|
||||
set sockhost [$d.sockhost.entry get]
|
||||
set sockport [$d.sockport.entry get]
|
||||
set err [catch {socket $sockhost $sockport} outID]
|
||||
|
||||
if {$err == 0} {
|
||||
destroy $d
|
||||
} else {
|
||||
tk_dialog $d.error "Socket Error" {Error: Unable to make socket connection. Make sure the STK socket server is first running and that the port number is correct.} "" 0 OK
|
||||
} }
|
||||
pack $d.buttons.cancel -side left -padx 5 -pady 10
|
||||
pack $d.buttons.connect -side right -padx 5 -pady 10
|
||||
pack $d.buttons -side bottom -padx 5 -pady 10
|
||||
}
|
||||
}
|
||||
|
||||
# Tcl/Tk Physical Model GUI for the Synthesis Toolkit (STK)
|
||||
|
||||
# Set initial control values
|
||||
set pitch 64.0
|
||||
set press 64.0
|
||||
set cont1 0.0
|
||||
set cont2 20.0
|
||||
set cont4 64.0
|
||||
set cont11 64.0
|
||||
set cont44 24.0
|
||||
set outID "stdout"
|
||||
set commtype "stdout"
|
||||
set oldpatch 0
|
||||
set patchnum 0
|
||||
|
||||
# Configure main window
|
||||
wm title . "STK Physical Model Controller"
|
||||
wm iconname . "physical"
|
||||
. config -bg black
|
||||
|
||||
# Configure "communications" menu
|
||||
menu .menu -tearoff 0
|
||||
menu .menu.communication -tearoff 0
|
||||
.menu add cascade -label "Communication" -menu .menu.communication \
|
||||
-underline 0
|
||||
.menu.communication add radio -label "Console" -variable commtype \
|
||||
-value "stdout" -command { setComm }
|
||||
.menu.communication add radio -label "Socket" -variable commtype \
|
||||
-value "socket" -command { setComm }
|
||||
. configure -menu .menu
|
||||
|
||||
# Configure patch change buttons
|
||||
frame .radios1 -bg black
|
||||
frame .radios2 -bg black
|
||||
|
||||
radiobutton .radios1.clar -text "Clarinet" -bg grey66 \
|
||||
-variable patchnum -value 0 -command { patchChange $patchnum }
|
||||
radiobutton .radios1.hole -text "BlowHole" -bg grey66 \
|
||||
-variable patchnum -value 1 -command { patchChange $patchnum }
|
||||
radiobutton .radios1.fony -text "Saxofony" -bg grey66 \
|
||||
-variable patchnum -value 2 -command { patchChange $patchnum }
|
||||
radiobutton .radios1.flut -text "Flute" -bg grey66 \
|
||||
-variable patchnum -value 3 -command { patchChange $patchnum }
|
||||
radiobutton .radios1.bras -text "Brass" -bg grey66 \
|
||||
-variable patchnum -value 4 -command { patchChange $patchnum }
|
||||
radiobutton .radios1.botl -text "BlowBotl" -bg grey66 \
|
||||
-variable patchnum -value 5 -command { patchChange $patchnum }
|
||||
radiobutton .radios2.bowd -text "Bowed" -bg grey66 \
|
||||
-variable patchnum -value 6 -command { patchChange $patchnum }
|
||||
radiobutton .radios2.pluk -text "Plucked" -bg grey66 \
|
||||
-variable patchnum -value 7 -command { patchChange $patchnum }
|
||||
radiobutton .radios2.karp -text "StifKarp" -bg grey66 \
|
||||
-variable patchnum -value 8 -command { patchChange $patchnum }
|
||||
radiobutton .radios2.sitr -text "Sitar" -bg grey66 \
|
||||
-variable patchnum -value 9 -command { patchChange $patchnum }
|
||||
radiobutton .radios2.mand -text "Mandolin" -bg grey66 \
|
||||
-variable patchnum -value 10 -command { patchChange $patchnum }
|
||||
|
||||
pack .radios1.clar -side left -padx 5 -pady 10
|
||||
pack .radios1.hole -side left -padx 5 -pady 10
|
||||
pack .radios1.fony -side left -padx 5 -pady 10
|
||||
pack .radios1.flut -side left -padx 5 -pady 10
|
||||
pack .radios1.bras -side left -padx 5 -pady 10
|
||||
pack .radios1.botl -side left -padx 5 -pady 10
|
||||
pack .radios2.bowd -side left -padx 5 -pady 10
|
||||
pack .radios2.pluk -side left -padx 5 -pady 10
|
||||
pack .radios2.karp -side left -padx 5 -pady 10
|
||||
pack .radios2.sitr -side left -padx 5 -pady 10
|
||||
pack .radios2.mand -side left -padx 5 -pady 10
|
||||
|
||||
pack .radios1
|
||||
pack .radios2
|
||||
|
||||
# Configure bitmap display
|
||||
if {[file isdirectory bitmaps]} {
|
||||
set bitmappath bitmaps
|
||||
} else {
|
||||
set bitmappath tcl/bitmaps
|
||||
}
|
||||
button .pretty -bitmap @$bitmappath/Klar.xbm \
|
||||
-background white -foreground black
|
||||
pack .pretty -padx 5 -pady 10
|
||||
|
||||
# Configure "note-on" buttons
|
||||
frame .noteOn -bg black
|
||||
|
||||
button .noteOn.on -text NoteOn -bg grey66 -command { noteOn $pitch $press }
|
||||
button .noteOn.off -text NoteOff -bg grey66 -command { noteOff $pitch 127.0 }
|
||||
button .noteOn.exit -text "Exit Program" -bg grey66 -command myExit
|
||||
pack .noteOn.on -side left -padx 5
|
||||
pack .noteOn.off -side left -padx 5 -pady 10
|
||||
pack .noteOn.exit -side left -padx 5 -pady 10
|
||||
|
||||
pack .noteOn
|
||||
|
||||
# Configure reverb slider
|
||||
frame .reverb -bg black
|
||||
|
||||
scale .reverb.mix -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 44} \
|
||||
-orient horizontal -label "Reverb Mix" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont44
|
||||
|
||||
pack .reverb.mix -padx 10 -pady 10
|
||||
pack .reverb
|
||||
|
||||
# Configure sliders
|
||||
frame .left -bg black
|
||||
frame .right -bg black
|
||||
|
||||
scale .left.bPressure -from 0 -to 128 -length 200 \
|
||||
-command {changePress } -variable press \
|
||||
-orient horizontal -label "Breath Pressure" \
|
||||
-tickinterval 32 -showvalue true -bg grey66
|
||||
|
||||
scale .left.pitch -from 0 -to 128 -length 200 \
|
||||
-command {changePitch } -variable pitch \
|
||||
-orient horizontal -label "MIDI Note Number" \
|
||||
-tickinterval 32 -showvalue true -bg grey66
|
||||
|
||||
scale .left.cont2 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 2} \
|
||||
-orient horizontal -label "Reed Stiffness" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont2
|
||||
|
||||
scale .right.cont4 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 4} \
|
||||
-orient horizontal -label "Breath Noise" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont4
|
||||
|
||||
scale .right.cont11 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 11} \
|
||||
-orient horizontal -label "Vibrato Rate" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont11
|
||||
|
||||
scale .right.cont1 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange 0.0 1 " 1} \
|
||||
-orient horizontal -label "Vibrato Amount" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont1
|
||||
|
||||
pack .left.bPressure -padx 10 -pady 10
|
||||
pack .left.pitch -padx 10 -pady 10
|
||||
pack .left.cont2 -padx 10 -pady 10
|
||||
pack .right.cont4 -padx 10 -pady 10
|
||||
pack .right.cont11 -padx 10 -pady 10
|
||||
pack .right.cont1 -padx 10 -pady 10
|
||||
|
||||
pack .left -side left
|
||||
pack .right -side right
|
||||
|
||||
#bind all <KeyPress> {
|
||||
bind . <KeyPress> {
|
||||
noteOn $pitch $press
|
||||
}
|
||||
|
||||
# Bind an X windows "close" event with the Exit routine
|
||||
bind . <Destroy> +myExit
|
||||
|
||||
proc myExit {} {
|
||||
global pitch outID
|
||||
puts $outID [format "ExitProgram"]
|
||||
flush $outID
|
||||
close $outID
|
||||
exit
|
||||
}
|
||||
|
||||
proc noteOn {pitchVal pressVal} {
|
||||
global outID
|
||||
puts $outID [format "NoteOn 0.0 1 %f %f" $pitchVal $pressVal]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc noteOff {pitchVal pressVal} {
|
||||
global outID
|
||||
puts $outID [format "NoteOff 0.0 1 %f %f" $pitchVal $pressVal]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc patchChange {value} {
|
||||
global outID bitmappath cont1 cont2 cont4 cont11 pitch oldpatch
|
||||
puts $outID [format "ProgramChange 0.0 1 %i" $value]
|
||||
if {$value==0} { # Clarinet
|
||||
.pretty config -bitmap @$bitmappath/Klar.xbm
|
||||
.left.bPressure config -state normal -label "Breath Pressure"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state normal -label "Reed Stiffness"
|
||||
.right.cont4 config -state normal -label "Breath Noise"
|
||||
.right.cont11 config -state normal -label "Vibrato Rate"
|
||||
.right.cont1 config -state normal -label "Vibrato Amount"
|
||||
set cont1 20.0
|
||||
set cont2 64.0
|
||||
set cont4 20.0
|
||||
set cont11 64.0
|
||||
printWhatz "ControlChange 0.0 1 " 1 $cont1
|
||||
printWhatz "ControlChange 0.0 1 " 2 $cont2
|
||||
printWhatz "ControlChange 0.0 1 " 4 $cont4
|
||||
printWhatz "ControlChange 0.0 1 " 11 $cont11
|
||||
}
|
||||
if {$value==1} { # BlowHole
|
||||
.pretty config -bitmap @$bitmappath/Klar.xbm
|
||||
.left.bPressure config -state normal -label "Breath Pressure"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state normal -label "Reed Stiffness"
|
||||
.right.cont4 config -state normal -label "Breath Noise"
|
||||
.right.cont11 config -state normal -label "Tonehole Openness"
|
||||
.right.cont1 config -state normal -label "Register Vent Openness"
|
||||
set cont1 0.0
|
||||
set cont2 64.0
|
||||
set cont4 20.0
|
||||
set cont11 0.0
|
||||
printWhatz "ControlChange 0.0 1 " 1 $cont1
|
||||
printWhatz "ControlChange 0.0 1 " 2 $cont2
|
||||
printWhatz "ControlChange 0.0 1 " 4 $cont4
|
||||
printWhatz "ControlChange 0.0 1 " 11 $cont11
|
||||
}
|
||||
if {$value==2} { # Saxofony
|
||||
.pretty config -bitmap @$bitmappath/prcFunny.xbm
|
||||
.left.bPressure config -state normal -label "Breath Pressure"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state normal -label "Reed Stiffness"
|
||||
.right.cont4 config -state normal -label "Breath Noise"
|
||||
.right.cont11 config -state normal -label "Blow Position"
|
||||
.right.cont1 config -state normal -label "Vibrato Amount"
|
||||
set cont1 20.0
|
||||
set cont2 64.0
|
||||
set cont4 20.0
|
||||
set cont11 26.0
|
||||
printWhatz "ControlChange 0.0 1 " 1 $cont1
|
||||
printWhatz "ControlChange 0.0 1 " 2 $cont2
|
||||
printWhatz "ControlChange 0.0 1 " 4 $cont4
|
||||
printWhatz "ControlChange 0.0 1 " 11 $cont11
|
||||
}
|
||||
if {$value==3} { # Flute
|
||||
.pretty config -bitmap @$bitmappath/KFloot.xbm
|
||||
.left.bPressure config -state normal -label "Breath Pressure"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state normal -label "Embouchure Adjustment"
|
||||
.right.cont4 config -state normal -label "Breath Noise"
|
||||
.right.cont11 config -state normal -label "Vibrato Rate"
|
||||
.right.cont1 config -state normal -label "Vibrato Amount"
|
||||
set cont1 20.0
|
||||
set cont2 64.0
|
||||
set cont4 20.0
|
||||
set cont11 64.0
|
||||
printWhatz "ControlChange 0.0 1 " 1 $cont1
|
||||
printWhatz "ControlChange 0.0 1 " 2 $cont2
|
||||
printWhatz "ControlChange 0.0 1 " 4 $cont4
|
||||
printWhatz "ControlChange 0.0 1 " 11 $cont11
|
||||
}
|
||||
if {$value==4} { # Brass
|
||||
.pretty config -bitmap @$bitmappath/KHose.xbm
|
||||
.left.bPressure config -state normal -label "Breath Pressure"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state normal -label "Lip Adjustment"
|
||||
.right.cont4 config -state normal -label "Slide Length"
|
||||
.right.cont11 config -state normal -label "Vibrato Rate"
|
||||
.right.cont1 config -state normal -label "Vibrato Amount"
|
||||
set cont1 0.0
|
||||
set cont2 64.0
|
||||
set cont4 20.0
|
||||
set cont11 64.0
|
||||
set press 80.0
|
||||
printWhatz "ControlChange 0.0 1 " 1 $cont1
|
||||
printWhatz "ControlChange 0.0 1 " 2 $cont2
|
||||
printWhatz "ControlChange 0.0 1 " 4 $cont4
|
||||
printWhatz "ControlChange 0.0 1 " 11 $cont11
|
||||
puts $outID [format "NoteOn 0.0 1 %3.2f %3.2f" $pitch $press]
|
||||
}
|
||||
if {$value==5} { # Bottle
|
||||
.pretty config -bitmap @$bitmappath/prcFunny.xbm
|
||||
.left.bPressure config -state normal -label "Breath Pressure"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state disabled -label "Disabled"
|
||||
.right.cont4 config -state normal -label "Breath Noise"
|
||||
.right.cont11 config -state normal -label "Vibrato Rate"
|
||||
.right.cont1 config -state normal -label "Vibrato Amount"
|
||||
set cont1 20.0
|
||||
set cont4 20.0
|
||||
set cont11 64.0
|
||||
printWhatz "ControlChange 0.0 1 " 1 $cont1
|
||||
printWhatz "ControlChange 0.0 1 " 4 $cont4
|
||||
printWhatz "ControlChange 0.0 1 " 11 $cont11
|
||||
}
|
||||
if {$value==6} { # Bowed String
|
||||
.pretty config -bitmap @$bitmappath/KFiddl.xbm
|
||||
.left.bPressure config -state normal -label "Volume"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state normal -label "Bow Pressure"
|
||||
.right.cont4 config -state normal -label "Bow Position"
|
||||
.right.cont11 config -state normal -label "Vibrato Rate"
|
||||
.right.cont1 config -state normal -label "Vibrato Amount"
|
||||
set cont1 4.0
|
||||
set cont2 64.0
|
||||
set cont4 64.0
|
||||
set cont11 64.0
|
||||
printWhatz "ControlChange 0.0 1 " 1 $cont1
|
||||
printWhatz "ControlChange 0.0 1 " 2 $cont2
|
||||
printWhatz "ControlChange 0.0 1 " 4 $cont4
|
||||
printWhatz "ControlChange 0.0 1 " 11 $cont11
|
||||
}
|
||||
if {$value==7} { # Yer Basic Pluck
|
||||
.pretty config -bitmap @$bitmappath/KPluk.xbm
|
||||
.left.bPressure config -state normal -label "Pluck Strength"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state disabled -label "Disabled"
|
||||
.right.cont4 config -state disabled -label "Disabled"
|
||||
.right.cont11 config -state disabled -label "Disabled"
|
||||
.right.cont1 config -state disabled -label "Disabled"
|
||||
}
|
||||
if {$value==8} { # Stiff String
|
||||
.pretty config -bitmap @$bitmappath/KPluk.xbm
|
||||
.left.bPressure config -state normal -label "Pluck Strength"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state disabled -label "Disabled"
|
||||
.right.cont4 config -state normal -label "Pickup Position"
|
||||
.right.cont11 config -state normal -label "String Sustain"
|
||||
.right.cont1 config -state normal -label "String Stretch"
|
||||
set cont1 10.0
|
||||
set cont4 64.0
|
||||
set cont11 96.0
|
||||
printWhatz "ControlChange 0.0 1 " 1 $cont1
|
||||
printWhatz "ControlChange 0.0 1 " 4 $cont4
|
||||
printWhatz "ControlChange 0.0 1 " 11 $cont11
|
||||
}
|
||||
if {$value==9} { # Sitar
|
||||
.pretty config -bitmap @$bitmappath/KPluk.xbm
|
||||
.left.bPressure config -state normal -label "Pluck Strength"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state disabled -label "Disabled"
|
||||
.right.cont4 config -state disabled -label "Disabled"
|
||||
.right.cont11 config -state disabled -label "Disabled"
|
||||
.right.cont1 config -state disabled -label "Disabled"
|
||||
}
|
||||
if {$value==10} { # Mandolin
|
||||
.pretty config -bitmap @$bitmappath/KPluk.xbm
|
||||
.left.bPressure config -state normal -label "Microphone Position and Gain"
|
||||
.left.pitch config -state normal -label "MIDI Note Number"
|
||||
.left.cont2 config -state normal -label "Mandolin Body Size"
|
||||
.right.cont4 config -state normal -label "Pick Position"
|
||||
.right.cont11 config -state normal -label "String Sustain"
|
||||
.right.cont1 config -state normal -label "String Detune"
|
||||
set cont1 10.0
|
||||
set cont2 64.0
|
||||
set cont4 64.0
|
||||
set cont11 96.0
|
||||
set press 64.0
|
||||
printWhatz "ControlChange 0.0 1 " 1 $cont1
|
||||
printWhatz "ControlChange 0.0 1 " 2 $cont2
|
||||
printWhatz "ControlChange 0.0 1 " 4 $cont4
|
||||
printWhatz "ControlChange 0.0 1 " 11 $cont11
|
||||
changePress $press
|
||||
}
|
||||
set oldpatch $value
|
||||
}
|
||||
|
||||
proc printWhatz {tag value1 value2 } {
|
||||
global outID
|
||||
puts $outID [format "%s %i %f" $tag $value1 $value2]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc changePress {value} {
|
||||
global outID patchnum
|
||||
if { $patchnum<7 || $patchnum>9 } {
|
||||
puts $outID [format "AfterTouch 0.0 1 %f" $value]
|
||||
flush $outID
|
||||
}
|
||||
}
|
||||
|
||||
proc changePitch {value} {
|
||||
global outID
|
||||
puts $outID [format "PitchChange 0.0 1 %.3f" $value]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
# Socket connection procedure
|
||||
set d .socketdialog
|
||||
|
||||
proc setComm {} {
|
||||
global outID
|
||||
global commtype
|
||||
global d
|
||||
if {$commtype == "stdout"} {
|
||||
if { [string compare "stdout" $outID] } {
|
||||
set i [tk_dialog .dialog "Break Socket Connection?" {You are about to break an existing socket connection ... is this what you want to do?} "" 0 Cancel OK]
|
||||
switch $i {
|
||||
0 {set commtype "socket"}
|
||||
1 {close $outID
|
||||
set outID "stdout"}
|
||||
}
|
||||
}
|
||||
} elseif { ![string compare "stdout" $outID] } {
|
||||
set sockport 2001
|
||||
set sockhost localhost
|
||||
toplevel $d
|
||||
wm title $d "STK Client Socket Connection"
|
||||
wm resizable $d 0 0
|
||||
grab $d
|
||||
label $d.message -text "Specify a socket host and port number below (if different than the STK defaults shown) and then click the \"Connect\" button to invoke a socket-client connection attempt to the STK socket server." \
|
||||
-background white -font {Helvetica 10 bold} \
|
||||
-wraplength 3i -justify left
|
||||
frame $d.sockhost
|
||||
entry $d.sockhost.entry -width 15
|
||||
label $d.sockhost.text -text "Socket Host:" \
|
||||
-font {Helvetica 10 bold}
|
||||
frame $d.sockport
|
||||
entry $d.sockport.entry -width 15
|
||||
label $d.sockport.text -text "Socket Port:" \
|
||||
-font {Helvetica 10 bold}
|
||||
pack $d.message -side top -padx 5 -pady 10
|
||||
pack $d.sockhost.text -side left -padx 1 -pady 2
|
||||
pack $d.sockhost.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockhost -side top -padx 5 -pady 2
|
||||
pack $d.sockport.text -side left -padx 1 -pady 2
|
||||
pack $d.sockport.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockport -side top -padx 5 -pady 2
|
||||
$d.sockhost.entry insert 0 $sockhost
|
||||
$d.sockport.entry insert 0 $sockport
|
||||
frame $d.buttons
|
||||
button $d.buttons.cancel -text "Cancel" -bg grey66 \
|
||||
-command { set commtype "stdout"
|
||||
set outID "stdout"
|
||||
destroy $d }
|
||||
button $d.buttons.connect -text "Connect" -bg grey66 \
|
||||
-command {
|
||||
set sockhost [$d.sockhost.entry get]
|
||||
set sockport [$d.sockport.entry get]
|
||||
set err [catch {socket $sockhost $sockport} outID]
|
||||
|
||||
if {$err == 0} {
|
||||
destroy $d
|
||||
} else {
|
||||
tk_dialog $d.error "Socket Error" {Error: Unable to make socket connection. Make sure the STK socket server is first running and that the port number is correct.} "" 0 OK
|
||||
} }
|
||||
pack $d.buttons.cancel -side left -padx 5 -pady 10
|
||||
pack $d.buttons.connect -side right -padx 5 -pady 10
|
||||
pack $d.buttons -side bottom -padx 5 -pady 10
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,275 +1,277 @@
|
||||
# Tcl/Tk Shakers GUI for the Synthesis Toolkit (STK)
|
||||
|
||||
# Set initial control values
|
||||
set press 64.0
|
||||
set cont1 64.0
|
||||
set cont4 64.0
|
||||
set cont11 64.0
|
||||
set cont99 24.0
|
||||
set outID "stdout"
|
||||
set commtype "stdout"
|
||||
set patchnum 0
|
||||
|
||||
# Configure main window
|
||||
wm title . "STK Shakers Controller"
|
||||
wm iconname . "shakers"
|
||||
. config -bg black
|
||||
|
||||
# Configure "communications" menu
|
||||
menu .menu -tearoff 0
|
||||
menu .menu.communication -tearoff 0
|
||||
.menu add cascade -label "Communication" -menu .menu.communication \
|
||||
-underline 0
|
||||
.menu.communication add radio -label "Console" -variable commtype \
|
||||
-value "stdout" -command { setComm }
|
||||
.menu.communication add radio -label "Socket" -variable commtype \
|
||||
-value "socket" -command { setComm }
|
||||
. configure -menu .menu
|
||||
|
||||
# Configure sliders
|
||||
frame .right -bg black
|
||||
|
||||
scale .right.bPressure -from 0 -to 128 -length 300 \
|
||||
-command {changePress } -variable press\
|
||||
-orient horizontal -label "Shake Energy" \
|
||||
-tickinterval 32 -showvalue true -bg grey66
|
||||
|
||||
scale .right.cont2 -from 0 -to 128 -length 300 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 11} \
|
||||
-orient horizontal -label "(<--High) System Damping (Low-->)" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont4
|
||||
|
||||
scale .right.cont3 -from 0 -to 128 -length 300 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 4} \
|
||||
-orient horizontal -label "Number of Objects" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont11
|
||||
|
||||
scale .right.vibrato -from 0 -to 128 -length 300 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 1} \
|
||||
-orient horizontal -label "Resonance Center Freq." \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont1
|
||||
|
||||
scale .right.reverb -from 0 -to 128 -length 300 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 44} \
|
||||
-orient horizontal -label "Reverb Mix" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont99
|
||||
|
||||
pack .right.bPressure -padx 10 -pady 10
|
||||
pack .right.vibrato -padx 10 -pady 10
|
||||
pack .right.cont2 -padx 10 -pady 10
|
||||
pack .right.cont3 -padx 10 -pady 10
|
||||
pack .right.reverb -padx 10 -pady 10
|
||||
|
||||
pack .right -side right -padx 5 -pady 5
|
||||
|
||||
# Configure radio buttons
|
||||
frame .buttons -bg black
|
||||
frame .buttons.columns -bg black
|
||||
frame .buttons.columns.left1 -bg black
|
||||
frame .buttons.columns.left2 -bg black
|
||||
|
||||
radiobutton .buttons.columns.left1.maraca -text Maraca -bg grey66 \
|
||||
-command { patchChange 0 } -variable patchnum -width 12 \
|
||||
-justify left -value 0
|
||||
radiobutton .buttons.columns.left1.sekere -text Sekere -bg grey66 \
|
||||
-command { patchChange 2 } -variable patchnum -width 12 \
|
||||
-justify left -value 2
|
||||
radiobutton .buttons.columns.left1.cabasa -text Cabasa -bg grey66 \
|
||||
-command { patchChange 1 } -variable patchnum -width 12 \
|
||||
-justify left -value 1
|
||||
radiobutton .buttons.columns.left1.bamboo -text Bamboo -bg grey66 \
|
||||
-command { patchChange 5 } -variable patchnum -width 12 \
|
||||
-justify left -value 5
|
||||
radiobutton .buttons.columns.left1.waterdrp -text "Water Drops" -bg grey66 \
|
||||
-command { patchChange 4 } -variable patchnum -width 12 \
|
||||
-justify left -value 4
|
||||
radiobutton .buttons.columns.left1.tambourn -text Tambourine -bg grey66 \
|
||||
-command { patchChange 6 } -variable patchnum -width 12 \
|
||||
-justify left -value 6
|
||||
radiobutton .buttons.columns.left1.sleighbl -text "Sleigh Bells" -bg grey66 \
|
||||
-command { patchChange 7 } -variable patchnum -width 12 \
|
||||
-justify left -value 7
|
||||
radiobutton .buttons.columns.left1.guiro -text Guiro -bg grey66 \
|
||||
-command { patchChange 3 } -variable patchnum -width 12 \
|
||||
-justify left -value 3
|
||||
radiobutton .buttons.columns.left1.stix1 -text Sticks -bg grey66 \
|
||||
-command { patchChange 8 } -variable patchnum -width 12 \
|
||||
-justify left -value 8
|
||||
radiobutton .buttons.columns.left1.crunch1 -text Crunch -bg grey66 \
|
||||
-command { patchChange 9 } -variable patchnum -width 12 \
|
||||
-justify left -value 9
|
||||
radiobutton .buttons.columns.left1.wrench -text Wrench -bg grey66 \
|
||||
-command { patchChange 10 } -variable patchnum -width 12 \
|
||||
-justify left -value 10
|
||||
radiobutton .buttons.columns.left2.sandpapr -text "Sand Paper" -bg grey66 \
|
||||
-command { patchChange 11 } -variable patchnum -width 12 \
|
||||
-justify left -value 11
|
||||
radiobutton .buttons.columns.left2.cokecan -text "Coke Can" -bg grey66 \
|
||||
-command { patchChange 12 } -variable patchnum -width 12 \
|
||||
-justify left -value 12
|
||||
radiobutton .buttons.columns.left2.nextmug -text "NeXT Mug" -bg grey66 \
|
||||
-command { patchChange 13 } -variable patchnum -width 12 \
|
||||
-justify left -value 13
|
||||
radiobutton .buttons.columns.left2.pennymug -text "Mug & Penny" -bg grey66 \
|
||||
-command { patchChange 14 } -variable patchnum -width 12 \
|
||||
-justify left -value 14
|
||||
radiobutton .buttons.columns.left2.nicklemug -text "Mug & Nickle" -bg grey66 \
|
||||
-command { patchChange 15 } -variable patchnum -width 12 \
|
||||
-justify left -value 15
|
||||
radiobutton .buttons.columns.left2.dimemug -text "Mug & Dime" -bg grey66 \
|
||||
-command { patchChange 16 } -variable patchnum -width 12 \
|
||||
-justify left -value 16
|
||||
radiobutton .buttons.columns.left2.quartermug -text "Mug & Quarter" -bg grey66 \
|
||||
-command { patchChange 17 } -variable patchnum -width 12 \
|
||||
-justify left -value 17
|
||||
radiobutton .buttons.columns.left2.francmug -text "Mug & Franc" -bg grey66 \
|
||||
-command { patchChange 18 } -variable patchnum -width 12 \
|
||||
-justify left -value 18
|
||||
radiobutton .buttons.columns.left2.pesomug -text "Mug & Peso" -bg grey66 \
|
||||
-command { patchChange 19 } -variable patchnum -width 12 \
|
||||
-justify left -value 19
|
||||
radiobutton .buttons.columns.left2.bigrocks -text "Big Rocks" -bg grey66 \
|
||||
-command { patchChange 20 } -variable patchnum -width 12 \
|
||||
-justify left -value 20
|
||||
radiobutton .buttons.columns.left2.littlerocks -text "Little Rocks" -bg grey66 \
|
||||
-command { patchChange 21 } -variable patchnum -width 12 \
|
||||
-justify left -value 21
|
||||
radiobutton .buttons.columns.left1.tunedbamboo -text "Tuned Bamboo" -bg grey66 \
|
||||
-command { patchChange 22 } -variable patchnum -width 12 \
|
||||
-justify left -value 22
|
||||
|
||||
pack .buttons.columns.left1.maraca -pady 5
|
||||
pack .buttons.columns.left1.sekere -pady 5
|
||||
pack .buttons.columns.left1.cabasa -pady 5
|
||||
pack .buttons.columns.left1.bamboo -pady 5
|
||||
pack .buttons.columns.left1.tunedbamboo -pady 5
|
||||
pack .buttons.columns.left1.waterdrp -pady 5
|
||||
pack .buttons.columns.left1.tambourn -pady 5
|
||||
pack .buttons.columns.left1.sleighbl -pady 5
|
||||
pack .buttons.columns.left1.guiro -pady 5
|
||||
pack .buttons.columns.left1.stix1 -pady 5
|
||||
pack .buttons.columns.left1.crunch1 -pady 5
|
||||
pack .buttons.columns.left1.wrench -pady 5
|
||||
pack .buttons.columns.left2.sandpapr -pady 5
|
||||
pack .buttons.columns.left2.cokecan -pady 5
|
||||
pack .buttons.columns.left2.nextmug -pady 5
|
||||
pack .buttons.columns.left2.pennymug -pady 5
|
||||
pack .buttons.columns.left2.nicklemug -pady 5
|
||||
pack .buttons.columns.left2.dimemug -pady 5
|
||||
pack .buttons.columns.left2.quartermug -pady 5
|
||||
pack .buttons.columns.left2.francmug -pady 5
|
||||
pack .buttons.columns.left2.pesomug -pady 5
|
||||
pack .buttons.columns.left2.bigrocks -pady 5
|
||||
pack .buttons.columns.left2.littlerocks -pady 5
|
||||
|
||||
pack .buttons.columns.left1 -side left -padx 10
|
||||
pack .buttons.columns.left2 -side left -padx 10
|
||||
pack .buttons.columns -padx 10 -side top
|
||||
|
||||
# Configure exit button
|
||||
button .buttons.exit -text "Exit Program" -bg grey66 -command myExit
|
||||
pack .buttons.exit -pady 10 -side bottom
|
||||
pack .buttons -pady 5
|
||||
|
||||
#bind all <KeyPress> {
|
||||
bind . <KeyPress> {
|
||||
patchChange $patchnum
|
||||
}
|
||||
|
||||
# Bind an X windows "close" event with the Exit routine
|
||||
bind . <Destroy> +myExit
|
||||
|
||||
proc myExit {} {
|
||||
global outID
|
||||
puts $outID [format "ExitProgram"]
|
||||
flush $outID
|
||||
close $outID
|
||||
exit
|
||||
}
|
||||
|
||||
proc patchChange {value} {
|
||||
global outID press
|
||||
puts $outID [format "NoteOn -1.0 1 %i $press" $value]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc printWhatz {tag value1 value2 } {
|
||||
global outID
|
||||
puts $outID [format "%s %i %f" $tag $value1 $value2]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc changePress {value} {
|
||||
global outID
|
||||
puts $outID [format "AfterTouch -1.0 1 %f" $value]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
# Socket connection procedure
|
||||
set d .socketdialog
|
||||
|
||||
proc setComm {} {
|
||||
global outID
|
||||
global commtype
|
||||
global d
|
||||
if {$commtype == "stdout"} {
|
||||
if { [string compare "stdout" $outID] } {
|
||||
set i [tk_dialog .dialog "Break Socket Connection?" {You are about to break an existing socket connection ... is this what you want to do?} "" 0 Cancel OK]
|
||||
switch $i {
|
||||
0 {set commtype "socket"}
|
||||
1 {close $outID
|
||||
set outID "stdout"}
|
||||
}
|
||||
}
|
||||
} elseif { ![string compare "stdout" $outID] } {
|
||||
set sockport 2001
|
||||
set sockhost localhost
|
||||
toplevel $d
|
||||
wm title $d "STK Client Socket Connection"
|
||||
wm resizable $d 0 0
|
||||
grab $d
|
||||
label $d.message -text "Specify a socket host and port number below (if different than the STK defaults shown) and then click the \"Connect\" button to invoke a socket-client connection attempt to the STK socket server." \
|
||||
-background white -font {Helvetica 10 bold} \
|
||||
-wraplength 3i -justify left
|
||||
frame $d.sockhost
|
||||
entry $d.sockhost.entry -width 15
|
||||
label $d.sockhost.text -text "Socket Host:" \
|
||||
-font {Helvetica 10 bold}
|
||||
frame $d.sockport
|
||||
entry $d.sockport.entry -width 15
|
||||
label $d.sockport.text -text "Socket Port:" \
|
||||
-font {Helvetica 10 bold}
|
||||
pack $d.message -side top -padx 5 -pady 10
|
||||
pack $d.sockhost.text -side left -padx 1 -pady 2
|
||||
pack $d.sockhost.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockhost -side top -padx 5 -pady 2
|
||||
pack $d.sockport.text -side left -padx 1 -pady 2
|
||||
pack $d.sockport.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockport -side top -padx 5 -pady 2
|
||||
$d.sockhost.entry insert 0 $sockhost
|
||||
$d.sockport.entry insert 0 $sockport
|
||||
frame $d.buttons
|
||||
button $d.buttons.cancel -text "Cancel" -bg grey66 \
|
||||
-command { set commtype "stdout"
|
||||
set outID "stdout"
|
||||
destroy $d }
|
||||
button $d.buttons.connect -text "Connect" -bg grey66 \
|
||||
-command {
|
||||
set sockhost [$d.sockhost.entry get]
|
||||
set sockport [$d.sockport.entry get]
|
||||
set err [catch {socket $sockhost $sockport} outID]
|
||||
|
||||
if {$err == 0} {
|
||||
destroy $d
|
||||
} else {
|
||||
tk_dialog $d.error "Socket Error" {Error: Unable to make socket connection. Make sure the STK socket server is first running and that the port number is correct.} "" 0 OK
|
||||
} }
|
||||
pack $d.buttons.cancel -side left -padx 5 -pady 10
|
||||
pack $d.buttons.connect -side right -padx 5 -pady 10
|
||||
pack $d.buttons -side bottom -padx 5 -pady 10
|
||||
}
|
||||
}
|
||||
# Tcl/Tk Shakers GUI for the Synthesis Toolkit (STK)
|
||||
|
||||
# Set initial control values
|
||||
set press 64.0
|
||||
set cont1 64.0
|
||||
set cont4 64.0
|
||||
set cont11 64.0
|
||||
set cont99 24.0
|
||||
set outID "stdout"
|
||||
set commtype "stdout"
|
||||
set patchnum 0
|
||||
|
||||
# Configure main window
|
||||
wm title . "STK Shakers Controller"
|
||||
wm iconname . "shakers"
|
||||
. config -bg black
|
||||
|
||||
# Configure "communications" menu
|
||||
menu .menu -tearoff 0
|
||||
menu .menu.communication -tearoff 0
|
||||
.menu add cascade -label "Communication" -menu .menu.communication \
|
||||
-underline 0
|
||||
.menu.communication add radio -label "Console" -variable commtype \
|
||||
-value "stdout" -command { setComm }
|
||||
.menu.communication add radio -label "Socket" -variable commtype \
|
||||
-value "socket" -command { setComm }
|
||||
. configure -menu .menu
|
||||
|
||||
# Configure sliders
|
||||
frame .right -bg black
|
||||
|
||||
scale .right.bPressure -from 0 -to 128 -length 300 \
|
||||
-command {changePress } -variable press\
|
||||
-orient horizontal -label "Shake Energy" \
|
||||
-tickinterval 32 -showvalue true -bg grey66
|
||||
|
||||
scale .right.cont2 -from 0 -to 128 -length 300 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 11} \
|
||||
-orient horizontal -label "(<--High) System Damping (Low-->)" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont4
|
||||
|
||||
scale .right.cont3 -from 0 -to 128 -length 300 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 4} \
|
||||
-orient horizontal -label "Number of Objects" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont11
|
||||
|
||||
scale .right.vibrato -from 0 -to 128 -length 300 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 1} \
|
||||
-orient horizontal -label "Resonance Center Freq." \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont1
|
||||
|
||||
scale .right.reverb -from 0 -to 128 -length 300 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 44} \
|
||||
-orient horizontal -label "Reverb Mix" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont99
|
||||
|
||||
pack .right.bPressure -padx 10 -pady 10
|
||||
pack .right.vibrato -padx 10 -pady 10
|
||||
pack .right.cont2 -padx 10 -pady 10
|
||||
pack .right.cont3 -padx 10 -pady 10
|
||||
pack .right.reverb -padx 10 -pady 10
|
||||
|
||||
pack .right -side right -padx 5 -pady 5
|
||||
|
||||
# Configure radio buttons
|
||||
frame .buttons -bg black
|
||||
frame .buttons.columns -bg black
|
||||
frame .buttons.columns.left1 -bg black
|
||||
frame .buttons.columns.left2 -bg black
|
||||
|
||||
radiobutton .buttons.columns.left1.maraca -text Maraca -bg grey66 \
|
||||
-command { patchChange 0 } -variable patchnum -width 12 \
|
||||
-justify left -value 0
|
||||
radiobutton .buttons.columns.left1.sekere -text Sekere -bg grey66 \
|
||||
-command { patchChange 2 } -variable patchnum -width 12 \
|
||||
-justify left -value 2
|
||||
radiobutton .buttons.columns.left1.cabasa -text Cabasa -bg grey66 \
|
||||
-command { patchChange 1 } -variable patchnum -width 12 \
|
||||
-justify left -value 1
|
||||
radiobutton .buttons.columns.left1.bamboo -text Bamboo -bg grey66 \
|
||||
-command { patchChange 5 } -variable patchnum -width 12 \
|
||||
-justify left -value 5
|
||||
radiobutton .buttons.columns.left1.waterdrp -text "Water Drops" -bg grey66 \
|
||||
-command { patchChange 4 } -variable patchnum -width 12 \
|
||||
-justify left -value 4
|
||||
radiobutton .buttons.columns.left1.tambourn -text Tambourine -bg grey66 \
|
||||
-command { patchChange 6 } -variable patchnum -width 12 \
|
||||
-justify left -value 6
|
||||
radiobutton .buttons.columns.left1.sleighbl -text "Sleigh Bells" -bg grey66 \
|
||||
-command { patchChange 7 } -variable patchnum -width 12 \
|
||||
-justify left -value 7
|
||||
radiobutton .buttons.columns.left1.guiro -text Guiro -bg grey66 \
|
||||
-command { patchChange 3 } -variable patchnum -width 12 \
|
||||
-justify left -value 3
|
||||
radiobutton .buttons.columns.left1.stix1 -text Sticks -bg grey66 \
|
||||
-command { patchChange 8 } -variable patchnum -width 12 \
|
||||
-justify left -value 8
|
||||
radiobutton .buttons.columns.left1.crunch1 -text Crunch -bg grey66 \
|
||||
-command { patchChange 9 } -variable patchnum -width 12 \
|
||||
-justify left -value 9
|
||||
radiobutton .buttons.columns.left1.wrench -text Wrench -bg grey66 \
|
||||
-command { patchChange 10 } -variable patchnum -width 12 \
|
||||
-justify left -value 10
|
||||
radiobutton .buttons.columns.left2.sandpapr -text "Sand Paper" -bg grey66 \
|
||||
-command { patchChange 11 } -variable patchnum -width 12 \
|
||||
-justify left -value 11
|
||||
radiobutton .buttons.columns.left2.cokecan -text "Coke Can" -bg grey66 \
|
||||
-command { patchChange 12 } -variable patchnum -width 12 \
|
||||
-justify left -value 12
|
||||
radiobutton .buttons.columns.left2.nextmug -text "NeXT Mug" -bg grey66 \
|
||||
-command { patchChange 13 } -variable patchnum -width 12 \
|
||||
-justify left -value 13
|
||||
radiobutton .buttons.columns.left2.pennymug -text "Mug & Penny" -bg grey66 \
|
||||
-command { patchChange 14 } -variable patchnum -width 12 \
|
||||
-justify left -value 14
|
||||
radiobutton .buttons.columns.left2.nicklemug -text "Mug & Nickle" -bg grey66 \
|
||||
-command { patchChange 15 } -variable patchnum -width 12 \
|
||||
-justify left -value 15
|
||||
radiobutton .buttons.columns.left2.dimemug -text "Mug & Dime" -bg grey66 \
|
||||
-command { patchChange 16 } -variable patchnum -width 12 \
|
||||
-justify left -value 16
|
||||
radiobutton .buttons.columns.left2.quartermug -text "Mug & Quarter" -bg grey66 \
|
||||
-command { patchChange 17 } -variable patchnum -width 12 \
|
||||
-justify left -value 17
|
||||
radiobutton .buttons.columns.left2.francmug -text "Mug & Franc" -bg grey66 \
|
||||
-command { patchChange 18 } -variable patchnum -width 12 \
|
||||
-justify left -value 18
|
||||
radiobutton .buttons.columns.left2.pesomug -text "Mug & Peso" -bg grey66 \
|
||||
-command { patchChange 19 } -variable patchnum -width 12 \
|
||||
-justify left -value 19
|
||||
radiobutton .buttons.columns.left2.bigrocks -text "Big Rocks" -bg grey66 \
|
||||
-command { patchChange 20 } -variable patchnum -width 12 \
|
||||
-justify left -value 20
|
||||
radiobutton .buttons.columns.left2.littlerocks -text "Little Rocks" -bg grey66 \
|
||||
-command { patchChange 21 } -variable patchnum -width 12 \
|
||||
-justify left -value 21
|
||||
radiobutton .buttons.columns.left1.tunedbamboo -text "Tuned Bamboo" -bg grey66 \
|
||||
-command { patchChange 22 } -variable patchnum -width 12 \
|
||||
-justify left -value 22
|
||||
|
||||
pack .buttons.columns.left1.maraca -pady 5
|
||||
pack .buttons.columns.left1.sekere -pady 5
|
||||
pack .buttons.columns.left1.cabasa -pady 5
|
||||
pack .buttons.columns.left1.bamboo -pady 5
|
||||
pack .buttons.columns.left1.tunedbamboo -pady 5
|
||||
pack .buttons.columns.left1.waterdrp -pady 5
|
||||
pack .buttons.columns.left1.tambourn -pady 5
|
||||
pack .buttons.columns.left1.sleighbl -pady 5
|
||||
pack .buttons.columns.left1.guiro -pady 5
|
||||
pack .buttons.columns.left1.stix1 -pady 5
|
||||
pack .buttons.columns.left1.crunch1 -pady 5
|
||||
pack .buttons.columns.left1.wrench -pady 5
|
||||
pack .buttons.columns.left2.sandpapr -pady 5
|
||||
pack .buttons.columns.left2.cokecan -pady 5
|
||||
pack .buttons.columns.left2.nextmug -pady 5
|
||||
pack .buttons.columns.left2.pennymug -pady 5
|
||||
pack .buttons.columns.left2.nicklemug -pady 5
|
||||
pack .buttons.columns.left2.dimemug -pady 5
|
||||
pack .buttons.columns.left2.quartermug -pady 5
|
||||
pack .buttons.columns.left2.francmug -pady 5
|
||||
pack .buttons.columns.left2.pesomug -pady 5
|
||||
pack .buttons.columns.left2.bigrocks -pady 5
|
||||
pack .buttons.columns.left2.littlerocks -pady 5
|
||||
|
||||
pack .buttons.columns.left1 -side left -padx 10
|
||||
pack .buttons.columns.left2 -side left -padx 10
|
||||
pack .buttons.columns -padx 10 -side top
|
||||
|
||||
# Configure exit button
|
||||
button .buttons.exit -text "Exit Program" -bg grey66 -command myExit
|
||||
pack .buttons.exit -pady 10 -side bottom
|
||||
pack .buttons -pady 5
|
||||
|
||||
#bind all <KeyPress> {
|
||||
bind . <KeyPress> {
|
||||
patchChange $patchnum
|
||||
}
|
||||
|
||||
# Bind an X windows "close" event with the Exit routine
|
||||
bind . <Destroy> +myExit
|
||||
|
||||
proc myExit {} {
|
||||
global outID
|
||||
puts $outID [format "ExitProgram"]
|
||||
flush $outID
|
||||
close $outID
|
||||
exit
|
||||
}
|
||||
|
||||
proc patchChange {value} {
|
||||
global outID press
|
||||
puts $outID [format "NoteOn -1.0 1 %i $press" $value]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc printWhatz {tag value1 value2 } {
|
||||
global outID
|
||||
puts $outID [format "%s %i %f" $tag $value1 $value2]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc changePress {value} {
|
||||
global outID
|
||||
puts $outID [format "AfterTouch -1.0 1 %f" $value]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
eval patchChange $patchnum
|
||||
|
||||
# Socket connection procedure
|
||||
set d .socketdialog
|
||||
|
||||
proc setComm {} {
|
||||
global outID
|
||||
global commtype
|
||||
global d
|
||||
if {$commtype == "stdout"} {
|
||||
if { [string compare "stdout" $outID] } {
|
||||
set i [tk_dialog .dialog "Break Socket Connection?" {You are about to break an existing socket connection ... is this what you want to do?} "" 0 Cancel OK]
|
||||
switch $i {
|
||||
0 {set commtype "socket"}
|
||||
1 {close $outID
|
||||
set outID "stdout"}
|
||||
}
|
||||
}
|
||||
} elseif { ![string compare "stdout" $outID] } {
|
||||
set sockport 2001
|
||||
set sockhost localhost
|
||||
toplevel $d
|
||||
wm title $d "STK Client Socket Connection"
|
||||
wm resizable $d 0 0
|
||||
grab $d
|
||||
label $d.message -text "Specify a socket host and port number below (if different than the STK defaults shown) and then click the \"Connect\" button to invoke a socket-client connection attempt to the STK socket server." \
|
||||
-background white -font {Helvetica 10 bold} \
|
||||
-wraplength 3i -justify left
|
||||
frame $d.sockhost
|
||||
entry $d.sockhost.entry -width 15
|
||||
label $d.sockhost.text -text "Socket Host:" \
|
||||
-font {Helvetica 10 bold}
|
||||
frame $d.sockport
|
||||
entry $d.sockport.entry -width 15
|
||||
label $d.sockport.text -text "Socket Port:" \
|
||||
-font {Helvetica 10 bold}
|
||||
pack $d.message -side top -padx 5 -pady 10
|
||||
pack $d.sockhost.text -side left -padx 1 -pady 2
|
||||
pack $d.sockhost.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockhost -side top -padx 5 -pady 2
|
||||
pack $d.sockport.text -side left -padx 1 -pady 2
|
||||
pack $d.sockport.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockport -side top -padx 5 -pady 2
|
||||
$d.sockhost.entry insert 0 $sockhost
|
||||
$d.sockport.entry insert 0 $sockport
|
||||
frame $d.buttons
|
||||
button $d.buttons.cancel -text "Cancel" -bg grey66 \
|
||||
-command { set commtype "stdout"
|
||||
set outID "stdout"
|
||||
destroy $d }
|
||||
button $d.buttons.connect -text "Connect" -bg grey66 \
|
||||
-command {
|
||||
set sockhost [$d.sockhost.entry get]
|
||||
set sockport [$d.sockport.entry get]
|
||||
set err [catch {socket $sockhost $sockport} outID]
|
||||
|
||||
if {$err == 0} {
|
||||
destroy $d
|
||||
} else {
|
||||
tk_dialog $d.error "Socket Error" {Error: Unable to make socket connection. Make sure the STK socket server is first running and that the port number is correct.} "" 0 OK
|
||||
} }
|
||||
pack $d.buttons.cancel -side left -padx 5 -pady 10
|
||||
pack $d.buttons.connect -side right -padx 5 -pady 10
|
||||
pack $d.buttons -side bottom -padx 5 -pady 10
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,240 +1,233 @@
|
||||
# Tcl/Tk Voice GUI for the Synthesis Toolkit (STK)
|
||||
|
||||
# Set initial control values
|
||||
set pitch 64.0
|
||||
set press 64.0
|
||||
set cont1 20.0
|
||||
set cont2 64.0
|
||||
set cont4 64.0
|
||||
set cont11 64.0
|
||||
set outID "stdout"
|
||||
set commtype "stdout"
|
||||
set patchnum 16
|
||||
|
||||
# Configure main window
|
||||
wm title . "STK Voice Model Controller"
|
||||
wm iconname . "voice"
|
||||
. config -bg black
|
||||
|
||||
# Configure "communications" menu
|
||||
menu .menu -tearoff 0
|
||||
menu .menu.communication -tearoff 0
|
||||
.menu add cascade -label "Communication" -menu .menu.communication \
|
||||
-underline 0
|
||||
.menu.communication add radio -label "Console" -variable commtype \
|
||||
-value "stdout" -command { setComm }
|
||||
.menu.communication add radio -label "Socket" -variable commtype \
|
||||
-value "socket" -command { setComm }
|
||||
. configure -menu .menu
|
||||
|
||||
# Configure patch change buttons
|
||||
frame .instChoice -bg black
|
||||
|
||||
radiobutton .instChoice.fm -text "FMVoice" -bg grey66 \
|
||||
-command { patchChange 14 } -value 14 -variable patchnum
|
||||
radiobutton .instChoice.form -text "Formant" -bg grey66 \
|
||||
-command { patchChange 15 } -value 15 -variable patchnum
|
||||
|
||||
pack .instChoice.fm -side left -padx 5
|
||||
pack .instChoice.form -side left -padx 5 -pady 10
|
||||
|
||||
pack .instChoice -side top
|
||||
|
||||
# Configure bitmap display
|
||||
if {[file isdirectory bitmaps]} {
|
||||
set bitmappath bitmaps
|
||||
} else {
|
||||
set bitmappath tcl/bitmaps
|
||||
}
|
||||
button .pretty -bitmap @$bitmappath/prcFunny.xbm \
|
||||
-background white -foreground black
|
||||
.pretty config -bitmap @$bitmappath/prc.xbm
|
||||
pack .pretty -padx 5 -pady 10
|
||||
|
||||
# Configure "note-on" buttons
|
||||
frame .noteOn -bg black
|
||||
|
||||
button .noteOn.on -text NoteOn -bg grey66 -command { noteOn $pitch $press }
|
||||
button .noteOn.off -text NoteOff -bg grey66 -command { noteOff $pitch 127.0 }
|
||||
button .noteOn.exit -text "Exit Program" -bg grey66 -command myExit
|
||||
pack .noteOn.on -side left -padx 5
|
||||
pack .noteOn.off -side left -padx 5 -pady 10
|
||||
pack .noteOn.exit -side left -padx 5 -pady 10
|
||||
|
||||
pack .noteOn
|
||||
|
||||
# Configure sliders
|
||||
frame .left -bg black
|
||||
frame .right -bg black
|
||||
|
||||
scale .left.bPressure -from 0 -to 128 -length 200 \
|
||||
-command {changePress } -variable press \
|
||||
-orient horizontal -label "Loudness (Spectral Tilt)" \
|
||||
-tickinterval 32 -showvalue true -bg grey66
|
||||
|
||||
scale .left.pitch -from 0 -to 128 -length 200 \
|
||||
-command {changePitch } -variable pitch \
|
||||
-orient horizontal -label "MIDI Note Number" \
|
||||
-tickinterval 32 -showvalue true -bg grey66
|
||||
|
||||
scale .left.cont1 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 2} \
|
||||
-orient horizontal -label "Formant Q / Voiced/Un." \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont2
|
||||
|
||||
scale .right.cont2 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 4} \
|
||||
-orient horizontal -label "Vowel (Bass, Tenor, Alto, Sop.)" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont4
|
||||
|
||||
scale .right.cont3 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 11} \
|
||||
-orient horizontal -label "Vibrato Rate" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont11
|
||||
|
||||
scale .right.vibrato -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 1} \
|
||||
-orient horizontal -label "Vibrato Amount" \
|
||||
-tickinterval 32 -showvalue true -bg grey66\
|
||||
-variable cont1
|
||||
|
||||
pack .left.bPressure -padx 10 -pady 10
|
||||
pack .left.pitch -padx 10 -pady 10
|
||||
pack .left.cont1 -padx 10 -pady 10
|
||||
pack .right.cont2 -padx 10 -pady 10
|
||||
pack .right.cont3 -padx 10 -pady 10
|
||||
pack .right.vibrato -padx 10 -pady 10
|
||||
|
||||
pack .left -side left
|
||||
pack .right -side right
|
||||
|
||||
# Bind an X windows "close" event with the Exit routine
|
||||
bind . <Destroy> +myExit
|
||||
|
||||
proc myExit {} {
|
||||
global pitch
|
||||
global outID
|
||||
puts $outID [format "ExitProgram"]
|
||||
flush $outID
|
||||
close $outID
|
||||
exit
|
||||
}
|
||||
|
||||
proc noteOn {pitchVal pressVal} {
|
||||
global outID
|
||||
puts $outID [format "NoteOn -1.0 1 %f %f" $pitchVal $pressVal]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc noteOff {pitchVal pressVal} {
|
||||
global outID
|
||||
puts $outID [format "NoteOff -1.0 1 %f %f" $pitchVal $pressVal]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc patchChange {value} {
|
||||
global outID
|
||||
global bitmappath
|
||||
global cont1
|
||||
global cont2
|
||||
global cont4
|
||||
global cont11
|
||||
puts $outID [format "ProgramChange -1.0 1 %i" $value]
|
||||
if {$value==16} {
|
||||
.pretty config -bitmap @$bitmappath/KVoiceFM.xbm
|
||||
}
|
||||
if {$value==17} {
|
||||
.pretty config -bitmap @$bitmappath/KVoicForm.xbm
|
||||
}
|
||||
flush $outID
|
||||
set cont1 0.0
|
||||
set cont2 20.0
|
||||
set cont4 64.0
|
||||
set cont11 64.0
|
||||
}
|
||||
|
||||
proc printWhatz {tag value1 value2 } {
|
||||
global outID
|
||||
puts $outID [format "%s %i %f" $tag $value1 $value2]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc changePress {value} {
|
||||
global outID
|
||||
puts $outID [format "AfterTouch -1.0 1 %f" $value]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc changePitch {value} {
|
||||
global outID
|
||||
puts $outID [format "PitchBend -1.0 1 %.3f" $value]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
# Socket connection procedure
|
||||
set d .socketdialog
|
||||
|
||||
proc setComm {} {
|
||||
global outID
|
||||
global commtype
|
||||
global d
|
||||
if {$commtype == "stdout"} {
|
||||
if { [string compare "stdout" $outID] } {
|
||||
set i [tk_dialog .dialog "Break Socket Connection?" {You are about to break an existing socket connection ... is this what you want to do?} "" 0 Cancel OK]
|
||||
switch $i {
|
||||
0 {set commtype "socket"}
|
||||
1 {close $outID
|
||||
set outID "stdout"}
|
||||
}
|
||||
}
|
||||
} elseif { ![string compare "stdout" $outID] } {
|
||||
set sockport 2001
|
||||
set sockhost localhost
|
||||
toplevel $d
|
||||
wm title $d "STK Client Socket Connection"
|
||||
wm resizable $d 0 0
|
||||
grab $d
|
||||
label $d.message -text "Specify a socket host and port number below (if different than the STK defaults shown) and then click the \"Connect\" button to invoke a socket-client connection attempt to the STK socket server." \
|
||||
-background white -font {Helvetica 10 bold} \
|
||||
-wraplength 3i -justify left
|
||||
frame $d.sockhost
|
||||
entry $d.sockhost.entry -width 15
|
||||
label $d.sockhost.text -text "Socket Host:" \
|
||||
-font {Helvetica 10 bold}
|
||||
frame $d.sockport
|
||||
entry $d.sockport.entry -width 15
|
||||
label $d.sockport.text -text "Socket Port:" \
|
||||
-font {Helvetica 10 bold}
|
||||
pack $d.message -side top -padx 5 -pady 10
|
||||
pack $d.sockhost.text -side left -padx 1 -pady 2
|
||||
pack $d.sockhost.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockhost -side top -padx 5 -pady 2
|
||||
pack $d.sockport.text -side left -padx 1 -pady 2
|
||||
pack $d.sockport.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockport -side top -padx 5 -pady 2
|
||||
$d.sockhost.entry insert 0 $sockhost
|
||||
$d.sockport.entry insert 0 $sockport
|
||||
frame $d.buttons
|
||||
button $d.buttons.cancel -text "Cancel" -bg grey66 \
|
||||
-command { set commtype "stdout"
|
||||
set outID "stdout"
|
||||
destroy $d }
|
||||
button $d.buttons.connect -text "Connect" -bg grey66 \
|
||||
-command {
|
||||
set sockhost [$d.sockhost.entry get]
|
||||
set sockport [$d.sockport.entry get]
|
||||
set err [catch {socket $sockhost $sockport} outID]
|
||||
|
||||
if {$err == 0} {
|
||||
destroy $d
|
||||
} else {
|
||||
tk_dialog $d.error "Socket Error" {Error: Unable to make socket connection. Make sure the STK socket server is first running and that the port number is correct.} "" 0 OK
|
||||
} }
|
||||
pack $d.buttons.cancel -side left -padx 5 -pady 10
|
||||
pack $d.buttons.connect -side right -padx 5 -pady 10
|
||||
pack $d.buttons -side bottom -padx 5 -pady 10
|
||||
}
|
||||
}
|
||||
# Tcl/Tk Voice GUI for the Synthesis Toolkit (STK)
|
||||
|
||||
# Set initial control values
|
||||
set pitch 64.0
|
||||
set press 64.0
|
||||
set cont1 20.0
|
||||
set cont2 64.0
|
||||
set cont4 64.0
|
||||
set cont11 64.0
|
||||
set outID "stdout"
|
||||
set commtype "stdout"
|
||||
set patchnum 17
|
||||
|
||||
# Configure main window
|
||||
wm title . "STK Voice Model Controller"
|
||||
wm iconname . "voice"
|
||||
. config -bg black
|
||||
|
||||
# Configure "communications" menu
|
||||
menu .menu -tearoff 0
|
||||
menu .menu.communication -tearoff 0
|
||||
.menu add cascade -label "Communication" -menu .menu.communication \
|
||||
-underline 0
|
||||
.menu.communication add radio -label "Console" -variable commtype \
|
||||
-value "stdout" -command { setComm }
|
||||
.menu.communication add radio -label "Socket" -variable commtype \
|
||||
-value "socket" -command { setComm }
|
||||
. configure -menu .menu
|
||||
|
||||
# Configure patch change buttons
|
||||
frame .instChoice -bg black
|
||||
|
||||
radiobutton .instChoice.fm -text "FMVoice" -bg grey66 \
|
||||
-command { patchChange 17 } -value 17 -variable patchnum
|
||||
radiobutton .instChoice.form -text "Formant" -bg grey66 \
|
||||
-command { patchChange 18 } -value 18 -variable patchnum
|
||||
|
||||
pack .instChoice.fm -side left -padx 5
|
||||
pack .instChoice.form -side left -padx 5 -pady 10
|
||||
|
||||
pack .instChoice -side top
|
||||
|
||||
# Configure bitmap display
|
||||
if {[file isdirectory bitmaps]} {
|
||||
set bitmappath bitmaps
|
||||
} else {
|
||||
set bitmappath tcl/bitmaps
|
||||
}
|
||||
button .pretty -bitmap @$bitmappath/KVoiceFM.xbm \
|
||||
-background white -foreground black
|
||||
pack .pretty -padx 5 -pady 10
|
||||
|
||||
# Configure "note-on" buttons
|
||||
frame .noteOn -bg black
|
||||
|
||||
button .noteOn.on -text NoteOn -bg grey66 -command { noteOn $pitch $press }
|
||||
button .noteOn.off -text NoteOff -bg grey66 -command { noteOff $pitch 127.0 }
|
||||
button .noteOn.exit -text "Exit Program" -bg grey66 -command myExit
|
||||
pack .noteOn.on -side left -padx 5
|
||||
pack .noteOn.off -side left -padx 5 -pady 10
|
||||
pack .noteOn.exit -side left -padx 5 -pady 10
|
||||
|
||||
pack .noteOn
|
||||
|
||||
# Configure sliders
|
||||
frame .left -bg black
|
||||
frame .right -bg black
|
||||
|
||||
scale .left.bPressure -from 0 -to 128 -length 200 \
|
||||
-command {changePress } -variable press \
|
||||
-orient horizontal -label "Loudness (Spectral Tilt)" \
|
||||
-tickinterval 32 -showvalue true -bg grey66
|
||||
|
||||
scale .left.pitch -from 0 -to 128 -length 200 \
|
||||
-command {changePitch } -variable pitch \
|
||||
-orient horizontal -label "MIDI Note Number" \
|
||||
-tickinterval 32 -showvalue true -bg grey66
|
||||
|
||||
scale .left.cont1 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 2} \
|
||||
-orient horizontal -label "Formant Q / Voiced/Un." \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont2
|
||||
|
||||
scale .right.cont2 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 4} \
|
||||
-orient horizontal -label "Vowel (Bass, Tenor, Alto, Sop.)" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont4
|
||||
|
||||
scale .right.cont3 -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 11} \
|
||||
-orient horizontal -label "Vibrato Rate" \
|
||||
-tickinterval 32 -showvalue true -bg grey66 \
|
||||
-variable cont11
|
||||
|
||||
scale .right.vibrato -from 0 -to 128 -length 200 \
|
||||
-command {printWhatz "ControlChange -1.0 1 " 1} \
|
||||
-orient horizontal -label "Vibrato Amount" \
|
||||
-tickinterval 32 -showvalue true -bg grey66\
|
||||
-variable cont1
|
||||
|
||||
pack .left.bPressure -padx 10 -pady 10
|
||||
pack .left.pitch -padx 10 -pady 10
|
||||
pack .left.cont1 -padx 10 -pady 10
|
||||
pack .right.cont2 -padx 10 -pady 10
|
||||
pack .right.cont3 -padx 10 -pady 10
|
||||
pack .right.vibrato -padx 10 -pady 10
|
||||
|
||||
pack .left -side left
|
||||
pack .right -side right
|
||||
|
||||
# Bind an X windows "close" event with the Exit routine
|
||||
bind . <Destroy> +myExit
|
||||
|
||||
proc myExit {} {
|
||||
global pitch outID
|
||||
puts $outID [format "ExitProgram"]
|
||||
flush $outID
|
||||
close $outID
|
||||
exit
|
||||
}
|
||||
|
||||
proc noteOn {pitchVal pressVal} {
|
||||
global outID
|
||||
puts $outID [format "NoteOn 0.0 1 %f %f" $pitchVal $pressVal]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc noteOff {pitchVal pressVal} {
|
||||
global outID
|
||||
puts $outID [format "NoteOff 0.0 1 %f %f" $pitchVal $pressVal]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc patchChange {value} {
|
||||
global outID bitmappath cont1 cont2 cont4 cont11
|
||||
puts $outID [format "ProgramChange 0.0 1 %i" $value]
|
||||
if {$value==16} {
|
||||
.pretty config -bitmap @$bitmappath/KVoiceFM.xbm
|
||||
}
|
||||
if {$value==17} {
|
||||
.pretty config -bitmap @$bitmappath/KVoicForm.xbm
|
||||
}
|
||||
flush $outID
|
||||
set cont1 0.0
|
||||
set cont2 20.0
|
||||
set cont4 64.0
|
||||
set cont11 64.0
|
||||
}
|
||||
|
||||
proc printWhatz {tag value1 value2 } {
|
||||
global outID
|
||||
puts $outID [format "%s %i %f" $tag $value1 $value2]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc changePress {value} {
|
||||
global outID
|
||||
puts $outID [format "AfterTouch 0.0 1 %f" $value]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
proc changePitch {value} {
|
||||
global outID
|
||||
puts $outID [format "PitchChange 0.0 1 %.3f" $value]
|
||||
flush $outID
|
||||
}
|
||||
|
||||
# Socket connection procedure
|
||||
set d .socketdialog
|
||||
|
||||
proc setComm {} {
|
||||
global outID
|
||||
global commtype
|
||||
global d
|
||||
if {$commtype == "stdout"} {
|
||||
if { [string compare "stdout" $outID] } {
|
||||
set i [tk_dialog .dialog "Break Socket Connection?" {You are about to break an existing socket connection ... is this what you want to do?} "" 0 Cancel OK]
|
||||
switch $i {
|
||||
0 {set commtype "socket"}
|
||||
1 {close $outID
|
||||
set outID "stdout"}
|
||||
}
|
||||
}
|
||||
} elseif { ![string compare "stdout" $outID] } {
|
||||
set sockport 2001
|
||||
set sockhost localhost
|
||||
toplevel $d
|
||||
wm title $d "STK Client Socket Connection"
|
||||
wm resizable $d 0 0
|
||||
grab $d
|
||||
label $d.message -text "Specify a socket host and port number below (if different than the STK defaults shown) and then click the \"Connect\" button to invoke a socket-client connection attempt to the STK socket server." \
|
||||
-background white -font {Helvetica 10 bold} \
|
||||
-wraplength 3i -justify left
|
||||
frame $d.sockhost
|
||||
entry $d.sockhost.entry -width 15
|
||||
label $d.sockhost.text -text "Socket Host:" \
|
||||
-font {Helvetica 10 bold}
|
||||
frame $d.sockport
|
||||
entry $d.sockport.entry -width 15
|
||||
label $d.sockport.text -text "Socket Port:" \
|
||||
-font {Helvetica 10 bold}
|
||||
pack $d.message -side top -padx 5 -pady 10
|
||||
pack $d.sockhost.text -side left -padx 1 -pady 2
|
||||
pack $d.sockhost.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockhost -side top -padx 5 -pady 2
|
||||
pack $d.sockport.text -side left -padx 1 -pady 2
|
||||
pack $d.sockport.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockport -side top -padx 5 -pady 2
|
||||
$d.sockhost.entry insert 0 $sockhost
|
||||
$d.sockport.entry insert 0 $sockport
|
||||
frame $d.buttons
|
||||
button $d.buttons.cancel -text "Cancel" -bg grey66 \
|
||||
-command { set commtype "stdout"
|
||||
set outID "stdout"
|
||||
destroy $d }
|
||||
button $d.buttons.connect -text "Connect" -bg grey66 \
|
||||
-command {
|
||||
set sockhost [$d.sockhost.entry get]
|
||||
set sockport [$d.sockport.entry get]
|
||||
set err [catch {socket $sockhost $sockport} outID]
|
||||
|
||||
if {$err == 0} {
|
||||
destroy $d
|
||||
} else {
|
||||
tk_dialog $d.error "Socket Error" {Error: Unable to make socket connection. Make sure the STK socket server is first running and that the port number is correct.} "" 0 OK
|
||||
} }
|
||||
pack $d.buttons.cancel -side left -padx 5 -pady 10
|
||||
pack $d.buttons.connect -side right -padx 5 -pady 10
|
||||
pack $d.buttons -side bottom -padx 5 -pady 10
|
||||
}
|
||||
}
|
||||
|
||||
71
projects/demo/tcl/bitmaps/cokecan.xbm
Normal file
71
projects/demo/tcl/bitmaps/cokecan.xbm
Normal file
@@ -0,0 +1,71 @@
|
||||
#define cokecan_width 62
|
||||
#define cokecan_height 126
|
||||
static char cokecan_bits[] = {
|
||||
0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xc1,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,
|
||||
0xc1,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xc1,0xc0,0xff,0x02,0x00,0x00,0xea,
|
||||
0xff,0xc1,0xc0,0x2b,0xa9,0x94,0x55,0xb5,0xfe,0xc0,0xc0,0xd5,0x02,0x00,0x80,
|
||||
0x54,0xfb,0xc0,0x60,0x4b,0x09,0x21,0x5a,0xaf,0xfd,0xc1,0xe0,0x55,0x45,0x04,
|
||||
0xa9,0xa4,0xee,0xc1,0xf0,0x96,0x90,0x4a,0xa4,0xda,0xfa,0xc3,0xb0,0x49,0x04,
|
||||
0x11,0x4a,0x51,0xed,0xc3,0xf0,0x96,0x42,0x44,0xaa,0xac,0xfd,0xc3,0xb8,0x6b,
|
||||
0x12,0x05,0x80,0xf2,0xee,0xc7,0xfc,0xbd,0x81,0x10,0xa5,0xa8,0xfb,0xc7,0xfc,
|
||||
0xb7,0x24,0x42,0x00,0xf5,0xef,0xcf,0xfe,0xff,0x02,0x00,0x48,0xa0,0xff,0xdf,
|
||||
0x7e,0x6f,0x01,0x00,0x00,0x55,0xff,0xdf,0xff,0xbd,0x02,0x02,0x22,0xc0,0xff,
|
||||
0xff,0xff,0x77,0x00,0x00,0x00,0xaa,0xfe,0xff,0xdf,0x9f,0xfc,0xb7,0xdb,0xaf,
|
||||
0xbd,0xff,0xff,0x36,0x14,0x88,0x94,0x8a,0xfe,0xfe,0xff,0x2f,0xf4,0xef,0xfa,
|
||||
0x4f,0xfd,0xff,0xef,0x9d,0x04,0x00,0x02,0xa9,0xff,0xff,0xbf,0x2f,0x00,0x60,
|
||||
0x08,0xa8,0xf6,0xff,0xff,0x56,0x40,0xdc,0x23,0x42,0xff,0xff,0xff,0xbb,0x04,
|
||||
0x6c,0x83,0xa8,0xfa,0xff,0xff,0x4f,0x10,0xe8,0x23,0x44,0xdf,0xff,0xff,0x3f,
|
||||
0x00,0x00,0x00,0xa1,0xff,0xff,0xbf,0x55,0xf6,0xb5,0xbd,0x57,0xfd,0xff,0xfb,
|
||||
0x1f,0xda,0xbf,0xad,0xa7,0xff,0xff,0xff,0x2e,0x5a,0xf7,0xbf,0xcd,0xfe,0xfd,
|
||||
0xff,0x27,0x10,0x09,0xa4,0x56,0xef,0xff,0xdf,0x55,0x00,0x00,0x00,0x40,0x7f,
|
||||
0xff,0xff,0x0f,0x01,0x00,0x20,0xd5,0xfe,0xff,0xff,0x29,0x00,0xe8,0x07,0x50,
|
||||
0xff,0xff,0x7f,0x57,0x08,0xbb,0x12,0xc5,0xfb,0xff,0xf7,0xaf,0xc0,0x80,0x48,
|
||||
0x50,0xbf,0xff,0xff,0x9d,0x60,0xfc,0x63,0xd5,0xfe,0xff,0xff,0xbf,0x18,0xa3,
|
||||
0x4e,0xa0,0xff,0xff,0xbf,0xab,0xd0,0xfc,0xbf,0x75,0xfb,0xff,0xff,0x5f,0x2c,
|
||||
0xdf,0xb6,0xd2,0xef,0xff,0xfb,0xbf,0x94,0x6a,0xfb,0xb6,0xbf,0xff,0xdf,0x55,
|
||||
0xb2,0xfb,0xde,0xd6,0xff,0xff,0xff,0x3f,0x6a,0xc9,0xf6,0xed,0xff,0xff,0xff,
|
||||
0x6e,0xf3,0xff,0xb7,0xb5,0xfd,0xff,0xff,0xbb,0x1c,0xfd,0x71,0xd5,0xff,0xff,
|
||||
0xdf,0x5f,0xdc,0x7f,0x1c,0xb3,0xff,0xff,0xff,0xad,0x64,0x40,0xdf,0xeb,0xdb,
|
||||
0xff,0xff,0xbf,0x04,0xba,0x6b,0x67,0xff,0xff,0xef,0x57,0x54,0x9f,0xa2,0xa3,
|
||||
0xff,0xff,0x7f,0xbd,0x94,0x93,0x91,0xcb,0xff,0xfd,0xff,0x5f,0x04,0x10,0x05,
|
||||
0x52,0xfd,0xff,0xff,0xb7,0xec,0xff,0xff,0x8b,0xef,0xff,0xbb,0x5d,0xf1,0x98,
|
||||
0xb1,0xd1,0xfe,0xff,0xff,0xf7,0xda,0xe2,0xf7,0x49,0xff,0xfd,0xff,0x3e,0x79,
|
||||
0x6b,0xf4,0xd1,0xfd,0xff,0xff,0xb7,0xe1,0x99,0x71,0x44,0xff,0xfe,0xef,0xff,
|
||||
0xa0,0x9a,0xdd,0x68,0xf7,0xff,0x7f,0xaf,0xc0,0xff,0x3f,0xc4,0xff,0xfe,0xff,
|
||||
0xbb,0x80,0xfd,0x3b,0xa1,0xfe,0xff,0xff,0x7f,0x04,0xee,0x0f,0x54,0xdf,0xff,
|
||||
0xff,0x17,0x80,0x12,0x48,0x80,0xfe,0xfe,0x6f,0x5f,0x00,0x06,0x0e,0x2a,0xfb,
|
||||
0xff,0xff,0x5b,0x00,0x28,0x01,0x90,0xde,0xff,0xff,0x5f,0x02,0x00,0x90,0x44,
|
||||
0xfb,0xff,0xff,0x57,0x08,0x00,0x00,0xa1,0xfe,0xff,0x7d,0x6f,0x40,0x82,0x20,
|
||||
0x94,0xfb,0xff,0xef,0xb7,0xb8,0xff,0xfe,0xc1,0xfe,0xff,0xff,0xaf,0xf0,0x7f,
|
||||
0xd2,0x69,0xdf,0xff,0xbf,0xbb,0xf8,0xaf,0xee,0xa4,0xfd,0xff,0xff,0x5f,0x01,
|
||||
0x00,0x00,0xd8,0xff,0xff,0xff,0xb7,0x01,0x00,0x00,0xb6,0xfe,0xff,0xff,0xdd,
|
||||
0x04,0x00,0x00,0xfa,0xf7,0xff,0x6f,0x7f,0x57,0x55,0xa1,0xd5,0xbf,0xfb,0xff,
|
||||
0xab,0xa9,0xaa,0x8a,0xfe,0xfe,0xff,0xff,0xff,0x57,0xb5,0xf5,0xf6,0xff,0xff,
|
||||
0xff,0xbd,0xde,0xd6,0x56,0xbf,0xff,0xfb,0xff,0xef,0xb7,0x7f,0xff,0xfb,0xfb,
|
||||
0xff,0xf7,0x7f,0xe5,0xd5,0x05,0x4e,0xff,0xfb,0xbf,0xed,0x5b,0xff,0x57,0xb8,
|
||||
0xff,0xff,0xff,0xff,0xf4,0x6d,0xf9,0xcd,0xef,0xff,0xff,0xb6,0xac,0x56,0xdd,
|
||||
0xeb,0xfe,0xfb,0xff,0x7f,0x3a,0xab,0xa4,0xf3,0xff,0xff,0xef,0x57,0xb3,0x6b,
|
||||
0xfe,0xfd,0xff,0xff,0xff,0x3d,0x8b,0x74,0xb3,0x4a,0xf7,0xfb,0xfd,0x3f,0x59,
|
||||
0x20,0xdd,0xd6,0xff,0xff,0xf7,0x36,0x99,0x90,0x09,0x6e,0xff,0xff,0xdf,0x3f,
|
||||
0x7f,0x3f,0x7f,0xf9,0xff,0xff,0xff,0x2e,0x0b,0x98,0x65,0xe9,0xfb,0xfb,0xff,
|
||||
0xfb,0xfc,0x65,0x6e,0xf2,0xdf,0xff,0xff,0xbf,0xf7,0xde,0xfd,0x7f,0xff,0xff,
|
||||
0xff,0xef,0xad,0x6a,0xa7,0xfe,0xff,0xfb,0xbf,0x7d,0x7f,0xaa,0xa8,0xdb,0xff,
|
||||
0xff,0xff,0xef,0xad,0xb5,0xff,0xff,0xfd,0xff,0xff,0xbf,0xff,0xff,0x6a,0xff,
|
||||
0xf7,0xfb,0x7f,0xfb,0xb5,0xad,0xff,0xdb,0xff,0xfe,0xef,0x6f,0x7f,0xff,0xdb,
|
||||
0xfe,0xff,0xff,0xbf,0xff,0xeb,0x20,0xea,0x3b,0xfd,0xfb,0xff,0xfb,0xbd,0xdf,
|
||||
0x57,0x4f,0xff,0xff,0x7f,0x0f,0xf6,0xd6,0xee,0xf5,0xf5,0xff,0xff,0xbf,0x5d,
|
||||
0xfd,0xdd,0x9b,0x7a,0xf5,0xff,0x66,0xfd,0x73,0xdf,0x75,0xff,0xff,0xff,0xff,
|
||||
0xdb,0xaa,0x60,0xaf,0xfa,0xff,0xef,0x5b,0x77,0x29,0xdc,0xcb,0xfe,0xfe,0x7f,
|
||||
0xb7,0xdc,0x43,0xe9,0x2d,0xfe,0xff,0xff,0x8b,0x75,0xff,0xa7,0xc7,0xff,0xfb,
|
||||
0xff,0xf3,0xf6,0xd8,0xfe,0x6b,0xf3,0xff,0x7f,0x5f,0xdb,0x22,0xc5,0xf6,0xff,
|
||||
0xfe,0xfb,0x5f,0x7b,0xef,0xf7,0xeb,0xf9,0xff,0xff,0xf6,0xed,0xfe,0xdf,0x4f,
|
||||
0xfd,0xfd,0xff,0xef,0xfe,0xa2,0x6a,0xaf,0xfe,0xff,0xdf,0xff,0xaf,0xff,0xfd,
|
||||
0xff,0xff,0xff,0xff,0x7b,0xfb,0x5d,0x6f,0xfb,0xf7,0xfa,0x7f,0xef,0x6f,0xf7,
|
||||
0xfd,0xdf,0xff,0xff,0xff,0xbf,0xdf,0xbd,0xf7,0x7f,0xff,0xff,0xfb,0xff,0xfa,
|
||||
0xf7,0xde,0xfe,0xff,0xff,0xef,0xfb,0xdf,0xde,0xff,0xfb,0xff,0xff,0x7f,0x7f,
|
||||
0xbb,0xfb,0xf6,0xef,0xfd,0xff,0x97,0x80,0x00,0x00,0x00,0x14,0x55,0xff,0x7e,
|
||||
0x5b,0x6d,0x55,0xad,0xd5,0xf6,0xfd,0xf6,0xff,0xff,0xff,0xff,0xff,0xff,0xdf,
|
||||
0xfe,0xef,0xbf,0xbf,0xf7,0xff,0xff,0xdf,0xfc,0xbf,0xed,0xf6,0xbd,0xfd,0xff,
|
||||
0xc7,0xf0,0xff,0xff,0x7f,0xff,0xf7,0xff,0xc3,0xc0,0xff,0x7f,0xdb,0xff,0xff,
|
||||
0xff,0xc1,0xc0,0xff,0xee,0xff,0x77,0xff,0xff,0xc0,0x80,0xaf,0xbb,0xaa,0xfa,
|
||||
0xed,0x7f,0xc0};
|
||||
Reference in New Issue
Block a user