Csound Csound-dev Csound-tekno Search About

ANN: TclCsound

Date2005-11-07 11:48
FromVictor Lazzarini
SubjectANN: TclCsound
Announcement: TclCsound frontend and Tcl/Tk wrapper

A new frontend/language wrapper has been added to Csound 5,
providing access to the Csound API for Tcl/Tk scripts. The frontend
has three basic components:

cstclsh: Tcl interpreter
cswish: Tk windowing shell
Tclcsound: Tcl dynamic-lib module (compliant with the Tcl stubs mechanism)

Basic applications:
-Interactive shell for csound accepting realtime events and controls
-Instrument GUI using Tk widgets
-Frontend development
-Client-server applications over TCP using socket connections

Some examples are provided in the CVS repository (examples/tclcsound):

test.tcl: an example of a GUI controller for a csound instrument, uses 
cswish (or wish with Tclcsound module)
csound.tcl: a command-line csound frontend;
listener.tcl: a cstclsh csound server, which accepts tclcsound commands 
through a TCP socket on port 40001
remote-gui.tcl: a client-server version of test.tcl, can be run from plain wish
remote.tcl: a client-server example, can be run from plain tclsh
remote-gui.pd: a PD client version of test.tcl, requires listener.tcl to be 
running under cstclsh
table.tcl: table writing example
graph.tcl: Tk table graphing example

Here is a list of TclCsound commands:

Performance control commands:

csCompile  : compiles an orc/sco/csd + any options
csCompileList arglist : compiles an orc/sco/csd + options given as a Tcl 
list 'arglist'
csPerform : plays the score, returning when finished
csPerformKsmps : performs one ksmps block of audio samples, returning when 
finished
csPerformBuffer : performs one buffersize block of audio samples, returning 
when finished
csPlay : starts asynchronous performance in a separate thread, returning 
immediately
csPause : pauses playback
csStop : stops performance and resets csound
csRewind : rewinds the score
csOffset secs : offsets score playback by secs
csGetoffset : returns the score offset in secs
csGetScoreTime : returns the score time in secs

Event commands:

csNote  : sends in a i-statement event
csTable  : sends in a f-statement event
csEvent opcode  : sends in a score event defined by 'opcode' plus 
p-fields
csNoteList arglist : sends in a i-statement event with p-fields as a Tcl 
list 'arglist'
csTableList arglist : sends in a f-statement event with p-fields as a Tcl 
list 'arglist'
csEventList arglist : sends in a score event defined by 'opcode' plus 
p-fields as a Tcl list 'arglist'

Invalue, outvalue, control and string channel commands:

csInChannel name : registers a csound invalue channel
csOutChannel name : registers a csound outvalue channel and creates tcl 
global variable 'name'
csInValue channel value : sets the value of a csound invalue channel
csOutValue channel : returns the value of a csound outvalue channel
csSetControlChannel channel value : sets the value of control channel 
'channel', creating it if it does not exist
csGetControlChannel channel : returns the value of control channel 
'channel'; creates the channel it if it does not exist
csSetStringChannel channel string : sets the string channel 'channel', 
creating it if it does not exist
csGetStringChannel channel : returns the string in channel 'channel'; 
creates the channel it if it does not exist

Table commands:

csGetTableSize ftn : returns the size of function table ftn (-1 if 
non-existent)
csSetTable ftn index value : sets the value of position 'index' to 'value' 
in function table 'ftn'
csGetTable ftn index : returns the value of position 'index' in function 
table 'ftn'

Environment variable commands:

csOpcodedir opcodedir : sets the opcode directory
csSetenv envvar value : sets any environment variable (eg. SFDIR, SADIR)

Here's a trivial example (csound.tcl):

The csound command-line frontend can be created by the following TclCsound 
script:

#!./usr/bin/sh
exec cstclsh "$0" "$@"
csCompileList $argv
csPerform

If saved to a file (eg. csound.tcl) and made executable (eg. chmod a+x 
csound.tcl),

% csound.tcl 

will run a full csound performance.

Author: Victor Lazzarini, 2005

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 

Date2005-11-07 19:18
FromJean Piche
SubjectRe: ANN: TclCsound
Well done! I hope to have a major new CECILIA release in the  months to 
come. TCL is a wonderful scripter. More people should be into it. It is 
easy to learn and allows just about anything. This has tremendous 
potential for closely integrating a DSP engine in a composition system. 
You guys all have my fondest regards and best wishes...


__________________________________________
http://jeanpiche.com


On 05-11-07, at 06:48, Victor Lazzarini wrote:

> Announcement: TclCsound frontend and Tcl/Tk wrapper
>
> A new frontend/language wrapper has been added to Csound 5,
> providing access to the Csound API for Tcl/Tk scripts. The frontend
> has three basic components:
>
> cstclsh: Tcl interpreter
> cswish: Tk windowing shell
> Tclcsound: Tcl dynamic-lib module (compliant with the Tcl stubs 
> mechanism)
>
> Basic applications:
> -Interactive shell for csound accepting realtime events and controls
> -Instrument GUI using Tk widgets
> -Frontend development
> -Client-server applications over TCP using socket connections
>
> Some examples are provided in the CVS repository (examples/tclcsound):
>
> test.tcl: an example of a GUI controller for a csound instrument, uses 
> cswish (or wish with Tclcsound module)
> csound.tcl: a command-line csound frontend;
> listener.tcl: a cstclsh csound server, which accepts tclcsound 
> commands through a TCP socket on port 40001
> remote-gui.tcl: a client-server version of test.tcl, can be run from 
> plain wish
> remote.tcl: a client-server example, can be run from plain tclsh
> remote-gui.pd: a PD client version of test.tcl, requires listener.tcl 
> to be running under cstclsh
> table.tcl: table writing example
> graph.tcl: Tk table graphing example
>
> Here is a list of TclCsound commands:
>
> Performance control commands:
>
> csCompile  : compiles an orc/sco/csd + any options
> csCompileList arglist : compiles an orc/sco/csd + options given as a 
> Tcl list 'arglist'
> csPerform : plays the score, returning when finished
> csPerformKsmps : performs one ksmps block of audio samples, returning 
> when finished
> csPerformBuffer : performs one buffersize block of audio samples, 
> returning when finished
> csPlay : starts asynchronous performance in a separate thread, 
> returning immediately
> csPause : pauses playback
> csStop : stops performance and resets csound
> csRewind : rewinds the score
> csOffset secs : offsets score playback by secs
> csGetoffset : returns the score offset in secs
> csGetScoreTime : returns the score time in secs
>
> Event commands:
>
> csNote  : sends in a i-statement event
> csTable  : sends in a f-statement event
> csEvent opcode  : sends in a score event defined by 'opcode' 
> plus p-fields
> csNoteList arglist : sends in a i-statement event with p-fields as a 
> Tcl list 'arglist'
> csTableList arglist : sends in a f-statement event with p-fields as a 
> Tcl list 'arglist'
> csEventList arglist : sends in a score event defined by 'opcode' plus 
> p-fields as a Tcl list 'arglist'
>
> Invalue, outvalue, control and string channel commands:
>
> csInChannel name : registers a csound invalue channel
> csOutChannel name : registers a csound outvalue channel and creates 
> tcl global variable 'name'
> csInValue channel value : sets the value of a csound invalue channel
> csOutValue channel : returns the value of a csound outvalue channel
> csSetControlChannel channel value : sets the value of control channel 
> 'channel', creating it if it does not exist
> csGetControlChannel channel : returns the value of control channel 
> 'channel'; creates the channel it if it does not exist
> csSetStringChannel channel string : sets the string channel 'channel', 
> creating it if it does not exist
> csGetStringChannel channel : returns the string in channel 'channel'; 
> creates the channel it if it does not exist
>
> Table commands:
>
> csGetTableSize ftn : returns the size of function table ftn (-1 if 
> non-existent)
> csSetTable ftn index value : sets the value of position 'index' to 
> 'value' in function table 'ftn'
> csGetTable ftn index : returns the value of position 'index' in 
> function table 'ftn'
>
> Environment variable commands:
>
> csOpcodedir opcodedir : sets the opcode directory
> csSetenv envvar value : sets any environment variable (eg. SFDIR, 
> SADIR)
>
> Here's a trivial example (csound.tcl):
>
> The csound command-line frontend can be created by the following 
> TclCsound script:
>
> #!./usr/bin/sh
> exec cstclsh "$0" "$@"
> csCompileList $argv
> csPerform
>
> If saved to a file (eg. csound.tcl) and made executable (eg. chmod a+x 
> csound.tcl),
>
> % csound.tcl 
>
> will run a full csound performance.
>
> Author: Victor Lazzarini, 2005
>
> Victor Lazzarini
> Music Technology Laboratory
> Music Department
> National University of Ireland, Maynooth
> -- 
> Send bugs reports to this list.
> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>