On Wed, 16 Feb 2005, Adam R. Tindale wrote:
Hi All,
When you do division on two durs a float is returned. When you divide a dur by a float you get a dur as well.
There are some examples on the reserved words page on the docs site.
Here is how you can divide two durs to make a new dur.
10::second => dur a; 5::second => dur b; a/b => float g; g::second => dur newdur;
Doing
a/b::second => dur q;
gives a parse error however.
Have you tried (a/b)::second => dur q; ? I've noticed that the parser is VERY nitpicking on arithmetic before the ::....
This works nicely though.
10::second => dur a; a/2. => dur b;
Hope that helps.
art
On Feb 16, 2005, at 3:11 PM, Philip Davidson wrote:
Micheal,
math on durs is supported, but not completely ( some revision to dur handing is needed )
dur * float => dur ; should work. not sure about float * dur => dur; I don't believe that division is properly supported.
this code would work -- 1::second => dur beat; beat * 0.5 => dur h; -or- beat * 0.5 => now; --
where it stands for now...
Phil
On Feb 16, 2005, at 5:43 PM, Michael Heuer wrote:
Hello ChucKers,
Is there any way to go from an int or float value of a variable to a duration? e.g.
1 => int value; value::second => dur some_unknown_number_of_seconds;
What I'm really trying to do is math with durations and numbers,
1::second => dur w; (w / 2) => dur h;
Thank you,
michael
_______________________________________________ chuck mailing list chuck@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck
_______________________________________________ chuck mailing list chuck@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck
_______________________________________________ chuck mailing list chuck@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck
-- Mikael Johansson | To see the world in a grain of sand mikael@johanssons.org | And heaven in a wild flower http://www.mikael.johanssons.org | To hold infinity in the palm of your hand | And eternity for an hour
Doing
a/b::second => dur q;
gives a parse error however.
Have you tried (a/b)::second => dur q; ? I've noticed that the parser is VERY nitpicking on arithmetic before the ::....
This is an issue with operator precedence - currently the :: is resolved before arithmetic, to enable things like: now + 2::second => time later; and 10::second / 5::second => float ratio; the problem is 4/2::second will result in a type error - this expression is parsed as (4) / (2::second)... (4/2)::second is currently the way to evaluate 4/2 first before ::second, as Mikael noted. We have yet to find a good balance for this part of the grammar... Best, Ge!
On Thu, 17 Feb 2005, Ge Wang wrote:
This is an issue with operator precedence - currently the :: is resolved before arithmetic, to enable things like:
now + 2::second => time later;
and
10::second / 5::second => float ratio;
the problem is
4/2::second
will result in a type error - this expression is parsed as (4) / (2::second)...
(4/2)::second is currently the way to evaluate 4/2 first before ::second, as Mikael noted.
We have yet to find a good balance for this part of the grammar...
Thanks to Ge and everyone else for the clarification. michael
A feature request, might it be possible to add a simple fader (l/r channel) to ChucK? Or what would be really useful would be a 3D spatialization generator, something like
but I haven't been able to locate an open source implementation yet. michael
Michael Heuer wrote:
A feature request, might it be possible to add a simple fader (l/r channel) to ChucK? Or what would be really useful would be a 3D spatialization generator, something like
but I haven't been able to locate an open source implementation yet.
Is there a well-defined DSP algorithm for this? I know CSound, for example, has code for the "head response transfer function". This computes what you need to put in the left headphone and the right headphone to simulate localization. If that's what you're looking for, I think it's "just a convolution" :). Can Chuck do convolutions?
Dumb question, but thought I saw on this list awhile ago the fact that Chuck
is still mono; stereo in the works. Is this true, or am I missing something?
-- Rich
----- Original Message -----
From: "M. Edward (Ed) Borasky"
Michael Heuer wrote:
A feature request, might it be possible to add a simple fader (l/r channel) to ChucK? Or what would be really useful would be a 3D spatialization generator, something like
but I haven't been able to locate an open source implementation yet.
Is there a well-defined DSP algorithm for this? I know CSound, for example, has code for the "head response transfer function". This computes what you need to put in the left headphone and the right headphone to simulate localization. If that's what you're looking for, I think it's "just a convolution" :). Can Chuck do convolutions?
_______________________________________________ chuck mailing list chuck@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck
Hi Michael, Ed, and all! The fader is already in the works for the new release. Currently ChucK is mono, for all intents and purposes, though it would be easy to "turn on" stereo/multichannel, since the underlying system is already built to support that. However, there aren't quite enough language facilities in 1.1 to support channels flexibly (i.e. ugens as members of ugens to have a clear notion of inlets and outlet, which requires the new type systems we are implementing). As for HRTF: there is a generalized Filter ugen but we would need arrays to sensibly create high order FIR filters suitable for convolving HRIR (head related impulse response). Arrays will be avaible in 1.2. (The above time-domain FIR filtering can be quite (to very) slow, depending on the length of the impulse response. As mentioned earlier, BruteFIR - a FFT-based convolver may be an eventual and much faster alternative. One tradeoff is output delay proportional to the buffer size for the FFT, which for many things is not a problem.) Also, I will send a brief progress report on chuck-1.2 soon. Best, Ge! On Feb 17, 2005, at 10:09 PM, M. Edward (Ed) Borasky wrote:
Michael Heuer wrote:
A feature request, might it be possible to add a simple fader (l/r channel) to ChucK? Or what would be really useful would be a 3D spatialization generator, something like
but I haven't been able to locate an open source implementation yet.
Is there a well-defined DSP algorithm for this? I know CSound, for example, has code for the "head response transfer function". This computes what you need to put in the left headphone and the right headphone to simulate localization. If that's what you're looking for, I think it's "just a convolution" :). Can Chuck do convolutions?
_______________________________________________ chuck mailing list chuck@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck
From: Ge Wang
Hi Michael, Ed, and all!
Ge,
The fader is already in the works for the new release.
Talking about the new release, how far off in time is it? What's happening? Is there still main hacking being done or is it in the stabilizing period? Tell us! Cheers, Magnus - really wondering when it is time to re-apply the auto* stuff
participants (6)
-
Ge Wang
-
M. Edward (Ed) Borasky
-
Magnus Danielson
-
Michael Heuer
-
Mikael Johansson
-
rjc