[chuck-users] the novice chucKster trying to navigate the Event class

Tom Lieber tom at alltom.com
Tue Dec 1 02:44:17 EST 2009

On Mon, Nov 30, 2009 at 9:47 PM, Ryan Wieghard <ryan.wieghard at gmail.com> wrote:
> So I am trying to design a data structure that is a list of musical
> events that are composed of duration, amplitude, and a list of four
> pitches to be
> assigned to SinOsc's . When I was constructing the idea, I called the
> atomic units of the lists "events" not knowing that there existed
> an Event class in chucK. When I researched the Event class, however, I
> become confused as to whether or not extended that class would
> be appropriate for what I am trying to achieve. I was wondering if
> someone could advise me the easiest way of going about creating a list
> of lists of two ints and a list:
> ["Event"Object1, "Event"Object2, ...,"Event"ObjectN]
> where "Event"Object[i] = [int amplitude, int duration,
> [pitch1,pitch2,pitch3,pitch4]]
> The idea is that one can simply iterate across the above list of
> "Event"Objects and assign a bank of four SinOsc's the pitchs 1 through
> 4;
> assign an envelope's gain to the amplitude, and advanced time by duration.
> I apologize if the above is an ugly articulation of my idea.

You probably don't want to extend the Event class for that. Events are
ChucK's way of allowing you to sleep a shred for an indeterminate
amount of time (until an "event" occurs and you call

I recommend making your own distinct class for note events.

class NoteEvent {
    float amplitude;
    dur duration;
    float pitches[4];

(and probably a factory function to get closer to the event array
syntax you mentioned)

Tom Lieber

More information about the chuck-users mailing list