[chuck-users] running chuck as a process with no terminal?

altern altern2 at gmail.com
Tue Nov 14 13:45:27 EST 2006


Spencer Salazar wrote:
> Hi Enrike,
> 
> On Nov 13, 2006, at 7:23 PM, altern wrote:
> 
>> hi
>>
>> i am launching chuck from python (i have a python GUI and chuck  
>> works as
>> sound engine). When I run chuck from python it opens a terminal, I  
>> would
>> like to hide this. I use python os.spawnv command for this.
>>
>> In PD there is a startup flag -nogui that launches pd as a process  
>> with
>> no console whatsoever, only visible via top or process list. Anything
>> like that in ChucK? i have checked the documentation for the virtual
>> machine but i could not see anything in this direction.
> 
> You might try using os.popen; I don't really know Python but looking  
> through the docs that function seems geared for use with console  
> apps, so it might work better for your purposes.
> 
> ChucK doesn't have a -nogui flag, because it doesn't really have  
> control over its gui; it just gets the default command line gui on  
> win32 because its compiled as a console app.

but this does not work as i need. Python and ChucK need to run 
concurrently. Maybe I am wrong (there are a lot of them and the docs are 
not very descriptive for non the non savvy like me) but I found that the 
only way to do this was with os.spawn family of functions passing 
os.P_NOWAIT as mode argument. This triggers the process and does not 
wait for it to return or exit. On the contrary popen seems to trigger 
the process and wait for it to finish, i just did one more test.

So if i would compile ChucK not to be a console app then it could run as 
a process? how difficult is that? I never compiled before under XP, i 
dont like the idea very much but maybe it is worth the pain ...

>> Another important issue i am having is that as soon as the chuck
>> terminal loses the focus the sound stops. So when I select the python
>> window the sound stops. Is there any way to avoid this?
> 
> Yikes, I have come across this as well.  Does this happen when  
> switching to any window, or just your python window?

aha! yes i does it only when selecting the python window. Any ideas why?

> Past recommended solutions have been to increase the audio buffer  
> size with --bufsize1024 or --bufsize2048, but on my XP SP2 system  
> those don't even produce audio... so I can't vouch for those.

I see, i will try to experiment with different values. The funny thing 
about this is that it does not do it when running the python application 
from .py file. I mean it only does this when I 'compile' the app with 
py2app as exe. Similar things happens with opening the terminal, when 
python opens a terminal (always when the file run is a .py) then ChucK 
uses the Python terminal to print the errors and messages. This is 
*really* cool as it helps a *massively* with dealing with debugging both 
programs at the same time. This is one of the reasons why I decided to 
try ChucK instead of PD. But when python does not open its terminal 
(when the file is .pyw or is an .exe) then ChucK opens the terminal :(

>> I am working on xp at the moment, so i havent tested if this  
>> happens as
>> well on linux or osx.
> 
> I would expect you to have much better success on either of those  
> platforms...
> 
>> I have very limited access to internet for a few days so i cannot  
>> search
>> on the mailing list archive or the forum about this issue. Sorry.
> 
> No worries!  Hope this helps...
> 
> spencer
> 
>> thanks
>>
>> enrike
>>
>>
>>
>> _______________________________________________
>> chuck-users mailing list
>> chuck-users at lists.cs.princeton.edu
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> 
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> 




More information about the chuck-users mailing list