Jagernot: Difference between revisions

From Toplap
Jump to navigation Jump to search
(Created page with 'livecoding with [http://code.google.com/p/din din] din has an integrated tcl/tk interpreter.')
 
(tcl/tk example.)
Line 1: Line 1:
livecoding with [http://code.google.com/p/din din]
livecoding with [http://code.google.com/p/din din]


din has an integrated tcl/tk interpreter.
din has an integrated Tcl/Tk interpreter for livecoding sound and gui. Tcl/Tk is a convenient choice for livecoding in din because din commands have the form: command_name ?arg ?arg ?arg which is the same as a Tcl/Tk command.
 
an example:
 
set code1 {set_bpm fm $v; set_bpm gate-l $v; set_bpm gate-r $v} ;# to change FM bpm and gater bpm.
set code2 {key $v} ;# changes the key of din.
set code3 {set_delay all feedback [expr $v/100.0]} ;# changes feedback of L and R delay lines
 
# set_bpm, key and set_delay are built-in din commands.
 
set code $code1
 
# slider handler
proc slide {code v} {
eval $code
}
 
# we will control this with a simple Tk based slider
package require Tk;
 
scale .s -from 0 -to 240 -command {slide $code} ;# slider changes bpm of FM and gaters from 0 to 240.
grid .s ;# packs into Tk window and displays on screen
 
# other possibilities
 
# to change key of din
set code $code2
.s configure -from 261 -to [expr 4*261] ;# slider range from middle C to 2 octaves above middle-C
 
# to change feedback on all delays
set code $code3
.s configure -from 0 -to 100 ;# slider range from 0 to 100

Revision as of 17:52, 18 May 2010

livecoding with din

din has an integrated Tcl/Tk interpreter for livecoding sound and gui. Tcl/Tk is a convenient choice for livecoding in din because din commands have the form: command_name ?arg ?arg ?arg which is the same as a Tcl/Tk command.

an example:

set code1 {set_bpm fm $v; set_bpm gate-l $v; set_bpm gate-r $v} ;# to change FM bpm and gater bpm. set code2 {key $v} ;# changes the key of din. set code3 {set_delay all feedback [expr $v/100.0]} ;# changes feedback of L and R delay lines

  1. set_bpm, key and set_delay are built-in din commands.

set code $code1

  1. slider handler

proc slide {code v} { eval $code }

  1. we will control this with a simple Tk based slider

package require Tk;

scale .s -from 0 -to 240 -command {slide $code} ;# slider changes bpm of FM and gaters from 0 to 240. grid .s ;# packs into Tk window and displays on screen

  1. other possibilities
  1. to change key of din

set code $code2 .s configure -from 261 -to [expr 4*261] ;# slider range from middle C to 2 octaves above middle-C

  1. to change feedback on all delays

set code $code3 .s configure -from 0 -to 100 ;# slider range from 0 to 100