Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] PortMIDI cleanup

Date2005-11-04 19:30
FromVictor Lazzarini
SubjectRe: [Cs-dev] PortMIDI cleanup
>
> Hi Victor,
>
> After some rigorous testing, I have found some interesting
> anomalies.
>
> 1) As a solution to try and not have to see the unsightly
> "libxxx.dylib  is not a Csound plugin library" I tried
> copying the tclcsound.dylib to  /usr/local/bin (in other
> words in the $PATH). What happens is that I  can run the
> test.tcl but I get
>
> SetFrontProcess failed,-606

tclcsound.dylib is a tcl module, that needs to be loaded
with something like

load tclcsound.dylib Tclcsound

or package require

this is for people to load the tclcsound commands on
a tclsh or wish. If you are using cswish or cstclsh, the
commands are statically linked to the interpreter program.

I am not sure what you are doing exactly. However I am also
not sure exactly about paths for tcl modules.

>
> When clicking on the window to try and move it. The
> buttons still  respond.
>
> Re-executing the scons command and producing another dylib
> /  executables in the same directory as Csound5 solves the
> problem.
>
> The sliders, buttons, etc seem to operate at the same
> speed / latency  as FLTK if not actually a little faster.
> This is on Mac OS 10.3.9.
>
>  From what I understand Mac OS 10.4.x is the first to
> include Tcl/Tk as  part of the OS so it is possible Apple
> has "improved" the  implementation for it's release and is
> the subsequent cause of the  latency that is being
> reported.

a-ha, so that might be the problem! I have to have a look
at it myself. On my 10.3.9 old laptop, it works as you
described.

> 2) Another curious problem I have encountered recently is
> when making a  CSD file intended for realtime performance,
> I experimented by not  initializing any f-tables in the
> score or orchestra in favor of an  attempt to try an
> initialize them purely from the csTable method.
> Unfortunately when I do csCompile and it returns 0, then I
> declare all  csTables, it aborts notes due to a missing
> f-table if I do a csPlay,  but performance is as expected
> with a csNote.

I think it is because the event function is executing
after the first call to csoundKsmps or csoundBuffer.
A solution for the above problem might be to declare the
ftables as blank tables (eg. f1 0 1024 7 0 1024 0) and
then re-initialise then as you need with csTable.

> Is this because csPlay explicitly looks to the score ?

No csPlay just sets a thread rolling with calls to
csoundKsmps
or csoundBuffer. But as I said it does not guarantee that
the ftable event call happens before it.

Thanks. I am actually quite pleased with the way this is
shaping up now. Today I tried my listener script with
pd and I can control cstclsh from it quite well (using
netsend). It might open up possibilities of client-server
csound set-ups with a variety of client programs (so far
I have a wish script and a PD patch, but it is possible
to write custom clients with a variety of languages).

Victor

>
> -David
>
> On Nov 4, 2005, at 3:31 AM, Victor Lazzarini wrote:
>
> > Good. I have been working on a few more commands
> > for it, which I'll commit next week, alongside more
> > examples.
> >
> > I have been playing with socket connections and it
> > is possible with cstlcsh to set up a server and control
> > it via network connections (as an alternative to OSC).
> >
> > By the way, would you be able to test cswish with
> > the test.tcl example script? I had reports of a
> > lag time in the slider response, but here it works
> > OK, as fas as I can see.
> >
> > Victor
> >
> >>
> >>
> >> On Nov 3, 2005, at 2:12 PM, Victor Lazzarini wrote:
> >>
> >>> Would you consider it fixed then?
> >>>
> >>> Victor
> >>
> >> I certainly would, as now the cstclsh aspect of the
> >> language makes  Csound seem comparable to something
> like >> ChucK. Only with the entire  TCL and Wish
> libraries at the >> user's disposal!
> >>
> >> IMHO, the addition of Pt_Stop() to a Csound performance
> >> makes Csound's  realtime MIDI implementation improved!
> >>
> >>
> >> -David
> >> (now to learn about CoreMIDI to write a native
> driver....)
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo
> App Server. Download it for free - -and be entered to win
> a 42" plasma tv or your very own Sony(tm)PSP.  Click here
> to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-11-04 19:40
FromSteven Yi
SubjectRe: [Cs-dev] PortMIDI cleanup
AttachmentsNone  

Date2005-11-04 21:55
FromDavid Akbari
SubjectRe: [Cs-dev] PortMIDI cleanup
On Nov 4, 2005, at 2:30 PM, Victor Lazzarini wrote:

> Today I tried my listener script with
> pd and I can control cstclsh from it quite well (using
> netsend). It might open up possibilities of client-server
> csound set-ups with a variety of client programs (so far
> I have a wish script and a PD patch, but it is possible
> to write custom clients with a variety of languages).
>
> Victor


That is an excellent idea, which also opens up the possibility of 
editing shared Csound files over a network through the use of a shared 
[textfile] object! I doubt that level of collaboration has yet been 
reached with Csound, yet it is now possible.

One thing I was having trouble with though was trying to get the 
canonical example GUI to respond to MIDI (or other) control data. What 
follows is an example; the sound reflects the change and responds to 
MIDI but the GUI does not. Registering the same invalue/outvalue 
chanels in MacCsound's GUI shows that the GUI responds. I think the 
Tclcsound idea would be amazing for implementing realtime performance 
systems where data is not passed to Csound from the TCL/Wish GUI but 
rather is just a display.


# "remote_test.tcl" - display test
# script to test cswish
# use csOpcodedir to set OPCODEDIR in your system
# if needed
# Tcl/Tk 8.4
# VL, 2005

global filename fval aval ffval qaval
set aval 1000
set fval 300
set filename "remote_sliders.csd"
csCompile -odac:1 -iadc:1 -+noninterleaved=1 -+rtaudio=CoreAudio -M0 -d 
$filename
csInChannel freq
csInChannel amp
csInChannel filfreq
csInChannel filq
csOutChannel freq

labelframe .middle -text "csound control panel" -padx 20 -pady 20
frame .bottom -padx 20 -pady 20
frame .sliders -padx 20 -pady 20

proc newOrc { } {
global filename
set filename [tk_getOpenFile -filetypes "{{CSD} {.csd} TEXT}"]
if { $filename != "" } {
csStop
csCompile -odac:1 -iadc:1 -+noninterleaved=1 -+rtaudio=CoreAudio -M0 -d 
$filename
}
}

pack .middle .sliders .bottom
button .bottom.open -text "open new csd" -command newOrc
button .middle.run -text "play" -command csPlay
button .middle.stop -text "stop" -command csStop
button .middle.pause -text "pause" -command csPause
button .bottom.quit -text "quit" -command exit
scale .sliders.freq -variable fval -orient horizontal -from 200 -to 400 
-command [list csInValue freq] -label "frequency" -length 300
scale .sliders.amp -variable aval -orient horizontal -from 0 -to 10000 
-command [list csInValue amp]   -label "amplitude" -length 300
scale .sliders.ffreq -variable ffval -orient horizontal -from 200 -to 
4000 -command [list csInValue filfreq]  -label "filter cf" -length 300
scale .sliders.q -variable qval -orient horizontal -from 1 -to 100 
-command [list csInValue filq]   -label "filter Q" -length 300
pack .middle.run .middle.pause .middle.stop -side left
pack .bottom.open   .bottom.quit -side left
pack .sliders.amp .sliders.freq .sliders.ffreq .sliders.q
## EOF ##



sr=44100
ksmps=10
nchnls=1

instr 1

;k1 invalue "amp"
;k1 tonek k1, 10
;k2 invalue "freq"
k3 invalue "filfreq"
k4 invalue "filq"

k8	ctrl7	1, 1, 200, 400
k9	ctrl7 1, 7, 0, 10000
k9 tonek k9, 10

asig oscili k9,k8,1
afil resonz asig, k3, k3/k4, 1

outvalue "amp", k9
outvalue "freq", k8

;;  uncomment for use with MacCsound
;outvalue "dispfreq", k8
;outvalue "dispamp", k9
;outvalue "dispfilfreq", k3
;outvalue "dispfilq", k4

     out afil

endin



f1 0 16384 10 1 .5 .33 .25 .2 .16 .14 .12 .1 .9 .8 .7 .6 .5
i1 0 600





Version: 3
Render: Real
Ask: Yes
Functions: Window
WindowBounds: 404 44 1077 789
Options: -b1024 -A -s -m7 -R


ioView nobackground {65535, 65535, 65535}
ioListing {10, 10} {400, 500}
ioSlider {427, 64} {190, 34} 200.000000 400.000000 200.000000 freq
ioSlider {432, 160} {190, 34} 0.000000 10000.000000 8113.000000 amp
ioSlider {433, 258} {190, 34} 200.000000 4000.000000 1704.799927 filfreq
ioSlider {436, 357} {190, 34} 1.000000 100.000000 53.915501 filq
ioText {502, 96} {46, 26} display 200.000000 0.001000 "dispfreq" left 
"Lucida Grande" 10 {0, 0, 0} {65535, 65535, 65535} nobackground 
noborder 
ioText {511, 192} {46, 26} display 8112.965820 0.001000 "dispamp" left 
"Lucida Grande" 10 {0, 0, 0} {65535, 65535, 65535} nobackground 
noborder 
ioText {513, 289} {46, 26} display 1705.559937 0.001000 "dispfilfreq" 
left "Lucida Grande" 10 {0, 0, 0} {65535, 65535, 65535} nobackground 
noborder 
ioText {516, 389} {46, 26} display 53.915501 0.001000 "dispfilq" left 
"Lucida Grande" 10 {0, 0, 0} {65535, 65535, 65535} nobackground 
noborder 
ioText {496, 36} {49, 34} label 0.000000 0.001000 "" left "Lucida 
Grande" 10 {0, 0, 0} {65535, 65535, 65535} nobackground noborder freq
ioText {500, 134} {49, 34} label 0.000000 0.001000 "" left "Lucida 
Grande" 10 {0, 0, 0} {65535, 65535, 65535} nobackground noborder amp
ioText {514, 241} {49, 34} label 0.000000 0.001000 "" left "Lucida 
Grande" 10 {0, 0, 0} {65535, 65535, 65535} nobackground noborder 
filfreq
ioText {516, 336} {49, 34} label 0.000000 0.001000 "" left "Lucida 
Grande" 10 {0, 0, 0} {65535, 65535, 65535} nobackground noborder Q



-David



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net