Hello, I'm using chuck under linux with jack audio server. Although it is working generally fine, sometimes I get unexpected clicks with error messages in the jack window and I'm trying to figure out what's wrong. I suspect that it is a problem with how linux handles interrupts in real time. The reason I'm posting here is that I think that the cause might be that I'm often printing on the terminal with <<< >>>; and that, I think demands an interrupt. Because the request comes from chuck which is granted real time priority by jack, it might interrupt the audio and at some points I get these clicks. Does this make sense? Has anyone encountered a similar problem with chuck and jack? In this case, has anyone used any alternative way of getting feedback from chuck? Maybe, instead of formatting a string and printing on a terminal, send a string through osc to some other interface which would update a constantly displayed message or variable which might be less demanding and not real time priority? Any ideas of what this could be? That is similar to another problem I have encountered so far, many times I would like to keep an eye to various parameters, both current values and how they change over time, but printing the value on the terminal only when it changes is not enough. Any ideas welcome. Cheers, Dimitris ___________________________________________________________ Χρησιμοποιείτε Yahoo!; Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr
you might try configuring JACK differently. I also use linux
(although I have yet to get chuck-jack to compile correctly) and have
found that JACK can be rather finnicky about the settings you use. If
you are not, I would suggest using Qjackctl to configure all of the
options. It allows much easier control of all the different settings
that simply using the command line. There are several tutorials
around for minimising xruns .
2009/8/11 Bozelos Dimitris
Hello,
I'm using chuck under linux with jack audio server. Although it is working generally fine, sometimes I get unexpected clicks with error messages in the jack window and I'm trying to figure out what's wrong. I suspect that it is a problem with how linux handles interrupts in real time.
The reason I'm posting here is that I think that the cause might be that I'm often printing on the terminal with <<< >>>; and that, I think demands an interrupt. Because the request comes from chuck which is granted real time priority by jack, it might interrupt the audio and at some points I get these clicks. Does this make sense? Has anyone encountered a similar problem with chuck and jack?
In this case, has anyone used any alternative way of getting feedback from chuck? Maybe, instead of formatting a string and printing on a terminal, send a string through osc to some other interface which would update a constantly displayed message or variable which might be less demanding and not real time priority? Any ideas of what this could be?
That is similar to another problem I have encountered so far, many times I would like to keep an eye to various parameters, both current values and how they change over time, but printing the value on the terminal only when it changes is not enough.
Any ideas welcome.
Cheers,
Dimitris
________________________________ Χρησιμοποιείτε Yahoo! Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On 12 Aug 2009, at 00:21, Bozelos Dimitris wrote:
I'm using chuck under linux with jack audio server. Although it is working generally fine, sometimes I get unexpected clicks with error messages in the jack window and I'm trying to figure out what's wrong. I suspect that it is a problem with how linux handles interrupts in real time.
The reason I'm posting here is that I think that the cause might be that I'm often printing on the terminal with <<< >>>; and that, I think demands an interrupt. Because the request comes from chuck which is granted real time priority by jack, it might interrupt the audio and at some points I get these clicks. Does this make sense? Has anyone encountered a similar problem with chuck and jack?
There seems to be a timing problem with <<< ... >>> in ChucK. So take all that away in all time critical positions, and see if the problem goes away. And report back here, if it does. Hans
2009/8/14 Hans Aberg
There seems to be a timing problem with <<< ... >>> in ChucK. So take all that away in all time critical positions, and see if the problem goes away. And report back here, if it does.
I think the main issue is that printing isn't done by the VM itself and that printing to the screen is expensive, CPU-wise. This can have some quite far-reaching effects. I'm not sure it's still like that but a long time ago I noted that when I'd print something, then immediately afterwards quit the shred the printed message sometimes wouldn't show. This could be fixed by advancing a bit of time after the print command. Of course advancing time may not always be possible in all conditions without causing timing issues to the overall program. Yours, Kas.
On 14 Aug 2009, at 14:23, Kassen wrote:
There seems to be a timing problem with <<< ... >>> in ChucK. So take all that away in all time critical positions, and see if the problem goes away. And report back here, if it does.
I think the main issue is that printing isn't done by the VM itself and that printing to the screen is expensive, CPU-wise.
If I search the Chuck sources, I find chuck_dl.cpp: #define DEBUG_PRINT(format) fprintf(stderr, (format));fflush(stderr) This fflush may be quite time consuming, at least relative Chuck sample time. Typically, the compiler implements a buffer, which is flushed onto stdout whenever fflush is called. Hans
On 14 Aug 2009, at 14:23, Kassen wrote:
There seems to be a timing problem with <<< ... >>> in ChucK. So take all that away in all time critical positions, and see if the problem goes away. And report back here, if it does.
I think the main issue is that printing isn't done by the VM itself and that printing to the screen is expensive, CPU-wise.
I have been searching the sources a bit, and it seems that the engine has to do a lot of interpretation to get the stuff printed out. Searching for "<<<" gives chuck.y: | L_HACK expression R_HACK { $$ = new_exp_from_hack( $2, EM_lineNum ); } Then "new_exp_from_hack" is defined in chuck_absyn.cpp: a_Exp new_exp_from_hack( a_Exp exp, int pos ) { a_Exp a = (a_Exp)checked_malloc( sizeof( struct a_Exp_ ) ); a->s_type = ae_exp_primary; a->s_meta = ae_meta_value; a->primary.s_type = ae_primary_hack; a->primary.exp = exp; a->primary.linepos = pos; a->linepos = pos; a->primary.self = a; return a; } Then ae_primary_hack is used in chuck_emit.cpp, where the case calls emit_engine_emit_exp(), which seems to be a function that unwinds the closure that the expression points to. Continue the chase if you so like - it would be fun to know where it is printed. So it seems a lot of stuff has to be done in real-time interpreting. Probably has nothing to do with buffering to the computer, which are so fast nowadays. It would explain other timing problems, like with audio-files. Hans
It will be a pain in the ass to remove all the <<< ... >>> I have in my code but I guess I have to... Yes, I'll report back if I see any difference.
--- Στις Παρ., 14/08/09, ο/η Hans Aberg
On 14 Aug 2009, at 18:02, Bozelos Dimitris wrote:
It will be a pain in the ass to remove all the <<< ... >>> I have in my code but I guess I have to... Yes, I'll report back if I see any difference.
It is not so slow if you have an editor that can handle regexp (regular expression) search-and-replace. Enable it, and search for something like: <<<.*>>> You might also try redirecting the output. Try chuck ... > chuck.out And then in another window tail -f chuck.out This writes the output to a file name 'chuck.out', which may have less buffering problems than a console. Then the 'tail' statement creates another process that reads the output as it is written to this file, so it cannot affect the 'chuck' process. Alternatively, if you do not need the output, you might use chuck ... > /dev/null It would be interesting to know if some of these two last options help. Hans
Hi Hans,
at last I don't thing the reason (or at least the main reason) I was getting the xruns was the <<< ... >>> printing on the terminal. I tried removing them from the code but didn't help much, what helped most was increasing the buffer size at jack. So it is probably my soundcard that is not really good.
Thanks for the help anyway.
Dimitris
--- Στις Παρ., 14/08/09, ο/η Hans Aberg
It will be a pain in the ass to remove all the <<< ... >>> I have in my code but I guess I have to... Yes, I'll report back if I see any difference.
It is not so slow if you have an editor that can handle regexp (regular expression) search-and-replace. Enable it, and search for something like: <<<.*>>> You might also try redirecting the output. Try chuck ... > chuck.out And then in another window tail -f chuck.out This writes the output to a file name 'chuck.out', which may have less buffering problems than a console. Then the 'tail' statement creates another process that reads the output as it is written to this file, so it cannot affect the 'chuck' process. Alternatively, if you do not need the output, you might use chuck ... > /dev/null It would be interesting to know if some of these two last options help. Hans ___________________________________________________________ Χρησιμοποιείτε Yahoo!; Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr
[I nearly missed this one, because the chuck list has this idiotic reply-to field.] There are more than one source of delay problems - yours is better explained by Kassen and others. Hans On 2 Sep 2009, at 02:08, Bozelos Dimitris wrote:
Hi Hans,
at last I don't thing the reason (or at least the main reason) I was getting the xruns was the <<< ... >>> printing on the terminal. I tried removing them from the code but didn't help much, what helped most was increasing the buffer size at jack. So it is probably my soundcard that is not really good.
Thanks for the help anyway.
Dimitris
participants (4)
-
Bozelos Dimitris
-
Cody Loyd
-
Hans Aberg
-
Kassen