Csound Csound-dev Csound-tekno Search About

tclcsound (was Re: [Cs-dev] Illegal GEN # on 43 ?)

Date2005-10-28 19:34
FromVictor Lazzarini
Subjecttclcsound (was Re: [Cs-dev] Illegal GEN # on 43 ?)
I can't test MIDI at the moment, but I'll keep that in mind
and have a look later.

By the way, I have added a summary of tclcsound commands
in frontends/tclcsound, command_summary.txt. I'll work
on a proper documentation for the csound manual.

In relation to realtime, portaudio is a little smoother with
tclcsound than coreaudio, when pausing and then
playing.  This is because of the way coreaudio works;
I might be able to sort it out in the future.

Victor

>
>
> On Oct 28, 2005, at 11:37 AM, Istvan Varga wrote:
>
> > It is possible that PortMidi does not like to be
> > initialized more than once on the Mac; to work around
> > that, try not using any -M or -Q flags, assuming that
> > you do not actually need real time MIDI for  this
> > CSD file.
>
> Here's an example of using the cstclsh command to run
> Csound5 with  realtime MIDI. I run the following CSD file
> with the following  commandline and it plays great, with
> no errors. However, while running  the cstclsh shell, it
> would seem that when running the exact same  command for
> the second time in the same shell, Port MIDI fails to
> initialize. I noticed also the DigiCoreAudioManger.app is
> still active  suggesting that the CoreAudio driver has not
> been terminated.
>
> If the -M and -Q flags are omitted how does Csound know
> where to look  for realtime MIDI? Also are there more
> methods for cstclsh than just  csOpcodedir such as
> csIncdir, csSadir, or csSfdir at present ?
>
> This shell idea is amazing, I've already set it as the
> default shell. I  feel that this is an amazing solution to
> realtime algorithmic  composition using TCL as a wrapper
> language to Csound. Honestly this  seems like the new
> functional equivalent for MacCsound on OSX as you  can
> just write a syntax coloring text editor in TCL!
>
> Here's the CSD file I used (which is != the previously
> posted one,  apologies for confusion related to that)
> assuming no environment  variables set other than
> OPCODEDIR (as indicated by absolute paths  where
> necessary).
>
> 
> 
>
>
> sr        =    44100
> kr        =    441
> ksmps    =    100
> nchnls    =    2
>
>     strset    1, "/Users/daveakbari/Desktop/adrien_2.pvx"
>
> /*--- ---*/
>
>         instr    1
>
> ilen    filelen    1
>
> kscl    ctrl7    1, 1, -12, 12
> ksc    =    (2 ^ (kscl / 12))
>
> kndx    phasor    (1 / p3)
> kndx    =    kndx * ilen
>
> fl    pvsfread    kndx, 1, 0
> fr    pvsfread    kndx, 1, 0 ; 1 if stereo source
>
> ;    printk2    ksc
> fscl    pvscale    fl, ksc
> fscr    pvscale    fr, ksc
>
> al    pvsynth    fscl
> ar    pvsynth    fscr
>
>     outs    al, ar
>
>         endin
>
> /*--- ---*/
> 
> 
> f1    0    1024  43
> "/Users/daveakbari/Desktop/adrien_2.pvx"    0
>
> i1 0 [2.72]
> s
>
> i1 0 [2.72 * 2]
> s
>
> i1 0 [2.72 * 4]
> s
>
> i1 0 [2.72 * 8]
>
> e
> 
>
> 
>
> |--- FIRST RUN, as expected
>
> cstclsh
> (c) Victor Lazzarini
>   Music Technology Lab
>   NUI Maynooth, 2005
> Localisation of messages is disabled, using default
> language. time resolution is 1000.000 ns
> % csCompile -odac:1 -idevaudio:1 -M0 -d
> -+rtaudio=CoreAudio  -+noninterleaved=1
> /Users/daveakbari/gen43.csd PortMIDI real time MIDI plugin
> for Csound CoreAudio real-time audio module for Csound
> by Victor Lazzarini
> PortAudio real-time audio module for Csound
> 0dBFS level = 32768.0
> Csound version 5.00.0 beta (double samples) Oct 27 2005
> libsndfile-1.0.11
> UnifiedCSD:  /Users/daveakbari/Desktop/gen43.csd
> STARTING FILE
> Creating orchestra
> Creating score
> orchname:  /var/tmp/tmp.orc
> scorename: /var/tmp/tmp.sco
> rtaudio: CoreAudio module enabled
> rtmidi: PortMIDI module enabled
> **** OSC: liblo started ****
> orch compiler:
> 36 lines read
>          instr   1
> Elapsed time at end of orchestra compile: real: 0.017s,
> CPU: 0.010s sorting score ...
>          ... done
> Elapsed time at end of score sort: real: 0.021s, CPU:
> 0.010s Csound version 5.00.0 beta (double samples) Oct 27
> 2005 midi channel 1 using instr 1
> midi channel 2 using instr 1
> midi channel 3 using instr 1
> midi channel 4 using instr 1
> midi channel 5 using instr 1
> midi channel 6 using instr 1
> midi channel 7 using instr 1
> midi channel 8 using instr 1
> midi channel 9 using instr 1
> midi channel 10 using instr 1
> midi channel 11 using instr 1
> midi channel 12 using instr 1
> midi channel 13 using instr 1
> midi channel 14 using instr 1
> midi channel 15 using instr 1
> midi channel 16 using instr 1
> displays suppressed
> 0dBFS level = 32768.0
> Strsets[1]: '/Users/daveakbari/Desktop/adrien_2.pvx'
> *** malloc[672]: error for object 0x511530: Double free
> *** malloc[672]: error for object 0x511530: Double free
> PortMIDI: selected input device 0: 'Oxygen 8: Port 1'
> (CoreMIDI) orch now loaded
> audio buffered in 1024 sample-frame blocks
> =====================================================
=====
> CoreAudio Module: found 4 device(s):
> => CoreAudio device 0: Built-in Audio
> => CoreAudio device 1: Digidesign HW ( MBox )
> => CoreAudio device 2: Soundflower (2ch)
> => CoreAudio device 3: Soundflower (16ch)
> selected device: 1
> CoreAudio module: opening Digidesign HW ( MBox )
> CoreAudio module: sr set to 44100 with 2 audio channels
> CoreAudio module: device open with 4 buffers of 1024
> frames
> =====================================================
=====
> reading 4096-byte blks of shorts from devaudio:1 (RAW)
> writing 4096-byte blks of shorts to dac:1 SECTION 1:
> 0
> % csPlay
> 0
> % ftable 1:
> file /Users/daveakbari/Desktop/adrien_2.pvx (1986336
> bytes) loaded into  memory
> new alloc for instr 1:
> B  0.000 ..  2.720 T  2.720 TT  2.720 M:  12023.4  12023.4
> end of section 1         sect peak amps:  12023.4  12023.4
> inactive allocs returned to freespace
> SECTION 2:
>
> ..etc
>
> csStop
> inactive allocs returned to freespace
> end of score.              overall amps:  18521.9  18521.9
>             overall samples out of range:        0
> 0 0 errors in performance
> Elapsed time at end of performance: real: 58.428s, CPU:
> 4.760s coreaudio module: closing device...
> coreaudio module: device closed
> 513 4096-byte soundblks of shorts written to dac:1
> Removing temporary file /var/tmp/tmp.2.eqwYNS ...
> Removing temporary file /var/tmp/tmp.sco ...
> Removing temporary file /var/tmp/tmp.orc ...
>
> |--- SECOND RUN, "Fails to initialize Port MIDI" ?
>
> % csCompile -odac:1 -idevaudio:1 -M0 -d
> -+rtaudio=CoreAudio  -+noninterleaved=1
> /Users/daveakbari/Desktop/gen43.csd PortMIDI real time
> MIDI plugin for Csound CoreAudio real-time audio module
> for Csound by Victor Lazzarini
> PortAudio real-time audio module for Csound
> 0dBFS level = 32768.0
> Csound version 5.00.0 beta (double samples) Oct 27 2005
> libsndfile-1.0.11
> UnifiedCSD:  /Users/daveakbari/Desktop/gen43.csd
> STARTING FILE
> Creating orchestra
> Creating score
> orchname:  /var/tmp/tmp.orc
> scorename: /var/tmp/tmp.sco
> rtaudio: CoreAudio module enabled
> rtmidi: PortMIDI module enabled
> **** OSC: liblo started ****
> orch compiler:
> 36 lines read
>          instr   1
> Elapsed time at end of orchestra compile: real: 0.018s,
> CPU: 0.020s sorting score ...
>          ... done
> Elapsed time at end of score sort: real: 0.020s, CPU:
> 0.020s Csound version 5.00.0 beta (double samples) Oct 27
> 2005 midi channel 1 using instr 1
> midi channel 2 using instr 1
> midi channel 3 using instr 1
> midi channel 4 using instr 1
> midi channel 5 using instr 1
> midi channel 6 using instr 1
> midi channel 7 using instr 1
> midi channel 8 using instr 1
> midi channel 9 using instr 1
> midi channel 10 using instr 1
> midi channel 11 using instr 1
> midi channel 12 using instr 1
> midi channel 13 using instr 1
> midi channel 14 using instr 1
> midi channel 15 using instr 1
> midi channel 16 using instr 1
> displays suppressed
> 0dBFS level = 32768.0
> Strsets[1]: '/Users/daveakbari/Desktop/adrien_2.pvx'
> *** malloc[672]: error for object 0x520b70: Double free
> *** malloc[672]: error for object 0x520b10: Double free
>   *** error initialising PortTime
>   *** error opening MIDI in device: -1 (Unknown MIDI
> error) inactive allocs returned to freespace
> end of score.              overall amps:      0.0      0.0
>             overall samples out of range:        0
> 0 0 errors in performance
> Elapsed time at end of performance: real: 0.031s, CPU:
> 0.030s Removing temporary file /var/tmp/tmp.5.EOCHKM ...
> Removing temporary file /var/tmp/tmp.sco ...
> Removing temporary file /var/tmp/tmp.orc ...
> -1
>
>
> -David
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.
> Get Certified Today * Register for a JBoss Training Course
> Free Certification Exam for All Training Attendees Through
> End of 2005 Visit
> http://www.jboss.com/services/certification for more
> information
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-10-28 20:20
FromDavid Akbari
Subject[Cs-dev] Re: tclcsound
On Oct 28, 2005, at 2:34 PM, Victor Lazzarini wrote:

> I can't test MIDI at the moment, but I'll keep that in mind
> and have a look later.

Thanks Victor!

As mentioned, it just seems like a problem in completely terminating 
previous instances of the PortMIDI and Port/Core Audio drivers. I would 
think that the expected behavior should be to completely deallocate all 
drivers / resources loaded at csCompile time when cstclsh receives the 
csStop method.

> By the way, I have added a summary of tclcsound commands
> in frontends/tclcsound, command_summary.txt. I'll work
> on a proper documentation for the csound manual.

Your contribution to canonical Csound is nothing less than 
extraordinary. This information was also easily obtained by looking in 
the source code, but a Manual entry would be quite nice!

> In relation to realtime, portaudio is a little smoother with
> tclcsound than coreaudio, when pausing and then
> playing.  This is because of the way coreaudio works;
> I might be able to sort it out in the future.

I highly value all of your contributions and use most of them 
regularly. This bit of advice does certainly produce less breakups than 
with the CoreAudio driver.


More questions regarding tclcsound:

1) Is it possible to trigger line events with cstclsh ? (-Lstdin)

2) Is it possible to have nested instances of cstclsh ? (If say the 
binary lives in /usr/bin != /usr/local/bin; to run multiple instances 
within itself)

3) Is it possible to append the PATH variable for specifically the 
cstclsh shell to include /usr/local/bin, /usr/local/include 
/usr/local/lib, other ?

4) From the sources I can see that csOpcodedir implements setting the 
OPCODEDIR environment variable. Will there be more facilities for the 
other variables in the shell ? Is it easy to implement a wrapper for 
this API function ?

... If so I can see colleagues as well as myself using *only* this 
shell (as the default) for most _time intensive_ purposes of music 
production. It allows a smooth and efficient wrapper for the canonical 
language that lends itself nicely to integration with commercial and 
proprietary applications as well as others that are not proprietary. 
(Nonlinear OSC responder scores to SuperCollider, Pd, Native 
Instruments Reaktor, others)


-David



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net