[chuck-users] cast dur to time?

pibsid at suomi24.fi pibsid at suomi24.fi
Wed Jan 9 05:37:51 EST 2008

As for casting durations or floats to time one should always ask how the newly made time relates to the one(s) we already have?
Most logical would be that:
minute $ time => time sometime;
refered to "one minute after the VM started". But it could also refer to "one minute after this shred started".
I find it more clear syntatically if we had predifined global and local time variables of VMstart and me.start (or me.birth). Then it would be clear from the syntax what is meant.

VMstart + minute => time sometime;
//As opposed to:
me.start + minute => time anothertime;

>>Kassen wrote:
>>As for actual use, I could imagine that referring to absolute moments in time could become useful when writing a score, especially with some sort of sorting, Csound style. Maybe there are other better uses, maybe it's all quite academic? I'm already enthusiastic there are people that have a position on this too. 

That's what I thought when I first read about time in the ChucK manual.
And I did make some tests with absolute time (relative to shred start time) ie. Calling:
now => time start; //1st line
And then making an array with [time,note,velocity,note_duration] float vectors to drive a score-player that would play the notes and chuck the time of the next note to now:
start + time_of_the_next_note::second => now;
But then I realized that this was a very unflexible way of doing things.
If I wanted to add a new melody in between the old notes I would have to modify all of the times after it. Also tempo changes would be virtually impossible.

So instead I went with an array of [time_separation,note,velocity,note_duration] vectors.
Now the score-player would go:
time_separation::second => now; //I recommend using a global duration of a quarter note here instead of an absolute duration of a second

...and it already felt more chuckish. :)
Now adding new notes to the score needed no modification on the ones already present.

I'm still thinking for the most effective way of changing the tempo on the fly...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20080109/f0e40f44/attachment.htm 

More information about the chuck-users mailing list