[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] Re: calling the stream upon EventStreamPlayer-stop

- patterns are not good at resource management. Any pattern that
relies on external resources (or, to an extent, any resource defined
outside the pattern constructor that needs to be maintained across
is risky in performance because you might create or destroy
the resources at the wrong time.
Monophonic or effect synths qualify
as "resource[s] defined outside the pattern constructor" because they
exist only in the context of the embedInStream method.

The only difference between Pmono and Pfx and normal note generation
is that the note off is not scheduled at the moment the note sounds, but blocked until
the stream that created the note terminates.

I could use your argument  to insist that note events
should not rely on scheduling a separate "gate" message but should instead send "sustain" as an argument to synth(s) it creates. (After all, the clock could be stopped.) But then the duration of the note event will not be affected by tempo
changes of the clock.

My way of thinking of this is that Patterns are "scores", eventstreams are "performances" Early termination of a stream (whether by user intervention or a time control pattern) is
a "performance" decision.

BTW: creating a separate clock to play an eventstream can give some access to the state of the EventStream. It is guaranteed that the clock talks to the root of the tree of streams created by the tree of patterns, so you do not have to worry about unknown modifications. (PatternConductor does this so it can flush pending note offs when the eventstream is stopped. Of course, this is not actually modifying
the stream in any way.)

This may seem a disjointed response. My basic point is that Pmono and Pfx are not creating any special resources, they are just scheduling a gate message that was computed when the event was generated.


My solution in my chucklib framework is to create a container for an
event pattern and event stream. The stream remains immutable, but it
can refer to environment variables that the user can access and
change. The container also handles resource management (there are user
hooks to release resources on stop and free). It's a heavier structure
(too heavy to be a general solution for the class library) but it
opens up a lot of possibilities that are otherwise impossible or
prohibitively inconvenient.

So I wonder if there's a way to decouple resource management in Pmono
and Pfx? It may not be possible, but I've obtained massive benefits by
using patterns and streams for what they're good at it and creating
other structures for the things they don't do so well.


James Harkins /// dewdrop world

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman

sc-dev mailing list