electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
Live streaming at radio.electro-music.com

  host / artist show at your time
<on air> Twyndyllyngs Special Monday edition of Chez Mosc
Please visit the chat
 Forum index » DIY Hardware and Software » ChucK programming language
ChucK takes long time to abort
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [15 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
larryreed



Joined: May 27, 2008
Posts: 18
Location: California

PostPosted: Tue May 27, 2008 3:18 pm    Post subject: ChucK takes long time to abort
Subject description: After Ctrl-C (on WinXP), chuck seems to take up to 5 mins to 'clean up'
Reply with quote  Mark this post and the followings unread

I am a new ChucK user, developing stuff for realtime performance.

As I've been developing my code, I have needed to abort chuck fairly often in order to make changes. I have several questions:

First, why does it take so long for the VM to "clean up" and abort after I tell it to (with Ctrl-C)? Even if I kill the process with the task manager, it still seems to take several minutes.

Second, if I were to start a second VM while the first VM is still in "Cleanup" mode, what happens to new code added? Can I assume that the first VM is effectively gone, or is it still doing stuff with programs and resources (e.g. the midi device, etc.).

-- Larry
Back to top
View user's profile Send private message Visit poster's website
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 20536
Location: The Netherlands, Enschede
Audio files: 147
G2 patch files: 318

PostPosted: Tue May 27, 2008 4:29 pm    Post subject: Reply with quote  Mark this post and the followings unread

welcome Larry

Did use ChucK really just a couple of times, but didn't see such slow aborts.

When I have programs (of my own) that won't shut down it usually is because one of the threads is still waiting for an event or a semaphore, this could be related to some device driver not behaving as expected.

_________________
Jan
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Tue May 27, 2008 6:12 pm    Post subject: Reply with quote  Mark this post and the followings unread

Hey, Larry.

This is definitely not normal, quitting should take something like half a second or so, though it can take more if there's some issue that makes it crash. What version are you using? I've had some issues with the latest ASIO version (for this board) quitting in less then clean ways.

Unless you are defining public classes (which you can only clean from the VM by quitting it) there is no real need to quite the VM to update code. This may be a workaround until we diagnose the issue.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
larryreed



Joined: May 27, 2008
Posts: 18
Location: California

PostPosted: Wed May 28, 2008 2:59 pm    Post subject: Public classes - yes Reply with quote  Mark this post and the followings unread

Yes, I am creating public classes. My goal is to create a set of public classes that can be accessed by various instantiated classes to manage my equipment. While I am getting these working, I find it necessary to quit the VM all the time. Since these classes need to refer to each other, I'm not sure how do it by updating private classes.

I am using v1.2.1.1, as downloaded during the last week.

Also, in the absence of include files, I need a way to provide a large number of standard definitions for various things like patch settings, etc, as it is really painful to have to use integer values for everything.

I'd be happiest with include files in which I could define constants private to whichever file includes them, but I'm ok with a set of public constants.

I'm coming from a C++ background, so I tend do things C++ style, although I do have Java experience as well.

Speaking of which, is there a way to specify that a particular item is a constant, so that it can't be changed?

-- Larry
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Wed May 28, 2008 4:17 pm    Post subject: Re: Public classes - yes Reply with quote  Mark this post and the followings unread

larryreed wrote:
Yes, I am creating public classes. My goal is to create a set of public classes that can be accessed by various instantiated classes to manage my equipment. While I am getting these working, I find it necessary to quit the VM all the time. Since these classes need to refer to each other, I'm not sure how do it by updating private classes.


Yes. Ok. In that case you will need to restart the VM a lot.


Quote:
I am using v1.2.1.1, as downloaded during the last week.


I see. Clearly something is is wrong here and likely it's ChucK but Blue Hell may have a point that this might have to do with some issue addressing some hardware. Could you try the ASIO version? It's in one of the sticky topics in this section, near the top. It would be interesting to see if addressing the soundcard in ASIO mode changes anything, if so it's likely a matter of the interaction with the soundcard.

Quote:
Also, in the absence of include files, I need a way to provide a large number of standard definitions for various things like patch settings, etc, as it is really painful to have to use integer values for everything.

I'd be happiest with include files in which I could define constants private to whichever file includes them, but I'm ok with a set of public constants.

I'm coming from a C++ background, so I tend do things C++ style, although I do have Java experience as well.

Speaking of which, is there a way to specify that a particular item is a constant, so that it can't be changed?

-- Larry


All of this makes perfect sense to me. I recommend emailing Ge;

ge at ccrma at stanford dot edu

With a detailed description of the "cleaning up" bug and your suggestions. Ge is always happy to look into bugs and suggestions though I do have to warn that lately he has been very bussy.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
larryreed



Joined: May 27, 2008
Posts: 18
Location: California

PostPosted: Wed May 28, 2008 4:39 pm    Post subject: Thanks! Reply with quote  Mark this post and the followings unread

Thanks! Very Happy

Quote:
I see. Clearly something is is wrong here and likely it's ChucK but Blue Hell may have a point that this might have to do with some issue addressing some hardware. Could you try the ASIO version? It's in one of the sticky topics in this section, near the top. It would be interesting to see if addressing the soundcard in ASIO mode changes anything, if so it's likely a matter of the interaction with the soundcard.


I'm using a moderately old Gateway laptop (M205 if you must know, I hate it...but that's another story.] I have not been running to date with my sound card [no built in wireless Evil or Very Mad , so I can't use my sound card and access the internet at the same time]. It's got a builtin Sigma Tel Audio, not sure if it supports ASIO. But I'll try it anyway.

I'll try getting in touch with [email addie removed by Blue Hell]. He's just down the street from me (well, 5 miles or so).

-- Larry
Back to top
View user's profile Send private message Visit poster's website
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 20536
Location: The Netherlands, Enschede
Audio files: 147
G2 patch files: 318

PostPosted: Wed May 28, 2008 5:29 pm    Post subject: Reply with quote  Mark this post and the followings unread

Larry, I edited out the email addie that was a bit too obvious in your post, I know it's probably on the internet like everywhere, but still I think we should be a bit careful with 'm here.
_________________
Jan
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Thu May 29, 2008 4:31 am    Post subject: Re: Thanks! Reply with quote  Mark this post and the followings unread

larryreed wrote:

I'm using a moderately old Gateway laptop (M205 if you must know, I hate it...but that's another story.] I have not been running to date with my sound card [no built in wireless Evil or Very Mad , so I can't use my sound card and access the internet at the same time]. It's got a builtin Sigma Tel Audio, not sure if it supports ASIO. But I'll try it anyway.


Hmmmm. It would be a rare built-in card that supports ASIO but many can be made to work with it using this; http://www.asio4all.com/

However I wonder if it would still make a difference then. Did you try whether it may have newer drivers? Are you interfacing any other hardware? Hid? MIDI?

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
larryreed



Joined: May 27, 2008
Posts: 18
Location: California

PostPosted: Thu May 29, 2008 10:32 am    Post subject: Using MidiSport 1x1 Reply with quote  Mark this post and the followings unread

Well, I'm using a midi device, since my goal is to interface to my keyboard setup. Its a USB MidiSport 1x1. That device seems to work fine - seemed responsive enough to play as a thru device without any audible glitches.

-- Larry
Back to top
View user's profile Send private message Visit poster's website
larryreed



Joined: May 27, 2008
Posts: 18
Location: California

PostPosted: Sat May 31, 2008 9:30 am    Post subject: Program causing problem Reply with quote  Mark this post and the followings unread

I've narrowed it down to the attached program. If I run chuck and then abort, or run some simple keyboard handling stuff, it quits right away. But after I run the attached program (gmidi.ck), it takes five minutes to quit.

All this program does is open the midi in and out devices for later use. I've tried putting in me.exit() calls, but this does not change the behavior.

-- Larry


gmidi.ck
 Description:

Download
 Filename:  gmidi.ck
 Filesize:  1.31 KB
 Downloaded:  88 Time(s)

Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sat May 31, 2008 11:13 am    Post subject: Re: Program causing problem Reply with quote  Mark this post and the followings unread

larryreed wrote:
I've narrowed it down to the attached program. If I run chuck and then abort, or run some simple keyboard handling stuff, it quits right away. But after I run the attached program (gmidi.ck), it takes five minutes to quit.


First of all; I don't think any harm will come of it if you simply hard-quit ChucK from the taskmanager, waiting five minutes is silly.

Second; this is good because now we know that the MIDI is the problem... but it's kinda annoying that the device is a MIDI-sport because those work quite well so we can't blame it outright. Did you try updating/reinstalling the driver for it? Does it do such things with other programs as well?

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
larryreed



Joined: May 27, 2008
Posts: 18
Location: California

PostPosted: Sat May 31, 2008 6:29 pm    Post subject: Midi shutdown issue Reply with quote  Mark this post and the followings unread

Unfortunately, I have tried the task manager approach, and it still takes the 5 minutes. This sounds like it might be one more reason to hate my Gateway.

I haven't tried updating the drivers, so I'll see if that makes a difference. But I haven't had this type of issue with any other program, and I've been using the Midi Sport for several years.

Thank you for your help!

BTW, I noticed that there are a number of methods on the MidiIn/Out ugens that aren't documented (at least in the pdf doc that comes with the distribution). (e.g. Name()). Is there a more comprehensive list of such methods?

One challenge I have at the moment is that which device is assigned to my Midisport output changes depending on the configuration of the computer. For example, if I boot with the wireless card, and plug the midisport in after startup, the output port is device 2, but if I boot from scratch with my sound card (Creative Audigy 2 ZS) and the midisport both attached, the output port is device 1.

I don't want to have to keep modifying my chuck setup program each time I run the system, so I'd like a way of enumerating the devices and getting the info from them so I can determine the correct device automatically.

I'm not sure how to do this, other than check the name string. Can I (and if so, how) compare strings or something? Or is there some other device info I can check?

It would probably be helpful to be able to do similar things with the audio devices, to make sure my adc and dac gens go exactly where I want them to.

-- Larry
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sat May 31, 2008 11:43 pm    Post subject: Reply with quote  Mark this post and the followings unread

Here you go;
Code:

"hello" => string foo;
"hello" => string bar;
"hi" => string baz;

if (foo == baz) <<< "shouldn't happen" >>>;
if (foo==bar) <<< baz >>>;


I'm really not so sure where to place the blame for the "5 minutes" issue but I too used a MIDIsport for years without issue though I think I borrowed it to a friend before I started with ChucK because now I have a soundcard that has 2x2 MIDI as well. The last thing I can think of is setting the "verbose" level as high as it'll go and hoping something useful shows up;

Code:
ghost@baido:~$ chuck --verbose9 --loop

(ghost is me, baido is the name of this desktop, the $ is the Linux prompt)

A driver update couldn't hurt.

As for the devices ans strings; that's actually what I want to do for my own performance setup as well and I think it should simply work. The order in which the MIDI devices appear should be the order they have in the Windows settings with the "preferred device" on top of the list there getting id 0. For some reason Windows sometimes mucks this up so I too have been meaning to compare the strings to deal with that.

The functions that aren't in the manual should be, I'll make a not of it on the "manual erata" WiKi page. It's too sparse on MIDI info anyway.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
larryreed



Joined: May 27, 2008
Posts: 18
Location: California

PostPosted: Sun Jun 01, 2008 6:10 pm    Post subject: Verbose output Reply with quote  Mark this post and the followings unread

Thanks for the --verbose9 tip, and the help on strings.

strings are not in the manual, which is why I got confused. At first, I thought there just wasn't any support for it, but then I realized there had to be if only to support the midi device name() method. So I tried constructing some string arrays, and voila!

Here is the verbose output after hitting ctrl-C. I run chuck --verbose9 --loop in one window, and chuck + gmidi.ck in the other. I get a bunch of output, so forgive me for including it all. The hang is while is is trying to shut down the real-time audio. Not a clue about this, I'm not doing any audio at all, and it doesn't matter whether I have my sound card installed or not.

Anyway, I've taken up too much of your time already. I found that by implementing stubs for my gmidi and midithru programs, I can develop a lot quicker, because so much of what I'm doing at the moment is the command infrastructure, and doesn't really need the midi stuff.

So I only have to deal with the timeout issue when I am testing the actual midi operations.

Thanks again!

-- Larry


chuckout.txt
 Description:
verbose output for 5-minute abort problem

Download
 Filename:  chuckout.txt
 Filesize:  6.54 KB
 Downloaded:  90 Time(s)

Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Mon Jun 02, 2008 6:48 am    Post subject: Reply with quote  Mark this post and the followings unread

Well, then... Then strings need to be on the list for inclusion in the manual as well :¬). New users of ChucK are a very valuable resource because they tend to find lots of stuff that's underdocumented that more experienced users glance over.

I'm happy to help, BTW, as long as I'm can address issues whenever I have a moment to spare it's all fun puzzles to me and considering how much ChucK has done for me it's only fair to do something back :¬)

That said; your issue here looks like it's beyond my skills to fix and you're going to need one of the Dev's. If it's really in the realtime audio that might actually point at a bug in the library that's used for that... or a issue with your soundcard... and that's beyond me, I fear.

At least we got a lot closer to pinpointing it. If you didn't already I suggest a mail to Ge and simply linking to this topic.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [15 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
e-m mkii

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use