chuck output to console on stdout
Hi All, Here below are 3 lines of code in chuck. How could I modify it to output the value of T in the chout? // this synchronizes to period 0.75::second => dur T; T - (now % T) => now; // output to console on stdout chout <= 1 <= " foo " <= 5.5 <= IO.newline(); Regards, Stephane
Hi, I don't know for sure if this applies to your version but in the doc it says chout and stdout have been disabled http://chuck.cs.princeton.edu/doc/language/overview.html "For the time being, stdout and chout have been temporarily disabled for the present release. In their place we have provided a debug print" Aurélien On Thu, 13 Dec 2012, stephane.poirier@oifii.org wrote:
Hi All,
Here below are 3 lines of code in chuck. How could I modify it to output the value of T in the chout?
// this synchronizes to period 0.75::second => dur T; T - (now % T) => now; // output to console on stdout chout <= 1 <= " foo " <= 5.5 <= IO.newline();
Regards,
Stephane
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
two ways to do it that I know of: put it on its own line with this: <<< T >>> or just divide by one sample, because that's the base unit of duration: T / 1::samp will yield the number of samples in the duration. That's how it's normally printed with <<< T >>> anyway. Getting the human time like having it say 1.5s would mean you'd have to factor in the current sampling rate, not sure if that's accessible from ChucK code itself. -jordan On Wednesday, December 12, 2012 at 9:44 PM, Aurélien Bondis wrote:
Hi,
I don't know for sure if this applies to your version but in the doc it says chout and stdout have been disabled
http://chuck.cs.princeton.edu/doc/language/overview.html "For the time being, stdout and chout have been temporarily disabled for the present release. In their place we have provided a debug print"
Aurélien
On Thu, 13 Dec 2012, stephane.poirier@oifii.org (mailto:stephane.poirier@oifii.org) wrote:
Hi All,
Here below are 3 lines of code in chuck. How could I modify it to output the value of T in the chout?
// this synchronizes to period 0.75::second => dur T; T - (now % T) => now; // output to console on stdout chout <= 1 <= " foo " <= 5.5 <= IO.newline();
Regards,
Stephane
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu (mailto:chuck-users@lists.cs.princeton.edu) https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu (mailto:chuck-users@lists.cs.princeton.edu) https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Im not sure why it says chout is disabled, as far as I know it works fine
(maybe that page is outdated?).
As Jordan said, to print, divide by a duration, which will be the "units".
So to get it in seconds you could do:
chout <= "now: " <= now/second <= " seconds" <= IO.newline();
or even e.g.
chout <= "now: " <= now/day <= " days" <= IO.newline();
This does raise the question, should times and durations be naturally able
to print through FileIO/chout/cherr.
spencer
On Wed, Dec 12, 2012 at 6:48 PM, Jordan Orelli
two ways to do it that I know of:
put it on its own line with this:
<<< T >>>
or just divide by one sample, because that's the base unit of duration:
T / 1::samp
will yield the number of samples in the duration. That's how it's normally printed with <<< T >>> anyway. Getting the human time like having it say 1.5s would mean you'd have to factor in the current sampling rate, not sure if that's accessible from ChucK code itself.
-jordan
On Wednesday, December 12, 2012 at 9:44 PM, Aurélien Bondis wrote:
Hi,
I don't know for sure if this applies to your version but in the doc it says chout and stdout have been disabled
http://chuck.cs.princeton.edu/doc/language/overview.html "For the time being, stdout and chout have been temporarily disabled for the present release. In their place we have provided a debug print"
Aurélien
On Thu, 13 Dec 2012, stephane.poirier@oifii.org wrote:
Hi All,
Here below are 3 lines of code in chuck. How could I modify it to output the value of T in the chout?
// this synchronizes to period 0.75::second => dur T; T - (now % T) => now; // output to console on stdout chout <= 1 <= " foo " <= 5.5 <= IO.newline();
Regards,
Stephane
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On Wed, Dec 12, 2012 at 09:48:15PM -0500, Jordan Orelli wrote:
will yield the number of samples in the duration. That's how it's normally printed with <<< T >>> anyway. Getting the human time like having it say 1.5s would mean you'd have to factor in the current sampling rate, not sure if that's accessible from ChucK code itself.
It is. Dividing by a second will give you the duration in seconds, regardless of the sample-rate. In fact; second / sample => float sample_rate; is valid and the easy way to detect the sample-rate from inside of ChucK, potentially useful for custom DSP stuff that needs to be tuned. Hope that helps, Kas.
participants (5)
-
Aurélien Bondis
-
Jordan Orelli
-
Kassen
-
Spencer Salazar
-
stephane.poirier@oifii.org