| Author |
Message |
Stochastic

Joined: Feb 25, 2008 Posts: 32 Location: Vancouver
|
Posted: Thu Apr 03, 2008 11:22 am Post subject:
Pausing Shreds |
 |
|
So I'm wondering if there's a way to (at any given time) pause a loop or a shred (it'd be awesome if it could happen half way through an ADSR envelope) then trigger it to continue where it left off?
The best idea I've had for this is to insert a bunch of
Event e => now;
bits throughout the code, then spork a shred that does:
e.broadcast();
in a loop, then kill the sporked shred, then bring it back to life again.
This seems a bit like sloppy code writing and has some issues for implementation. But maybe it's the best method. |
|
|
Back to top
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 6720 Location: The Hague, NL
G2 patch files: 3
|
Posted: Fri Apr 04, 2008 7:56 am Post subject:
|
 |
|
Events (probably suported by some flow-control) are great for pausing the code but I'm not sure how to pause a ADSR. Unchucking it may do so as it's supposed to stop calculation but that might also reset it. I fear you'll have to experiment but it's a interesting line of thought.
I could see "pausing" being a important aspect of "strong timing" in the future if we could just define exactly what we mean by it. _________________ Modern technology offers an endless field day to any deviant strains in our personalities. --J.G.Ballard |
|
|
Back to top
|
|
 |
Stochastic

Joined: Feb 25, 2008 Posts: 32 Location: Vancouver
|
Posted: Fri Apr 04, 2008 10:09 am Post subject:
|
 |
|
I don't think anything of this sort is implemented yet - though I'm entirely new to this - but something like:
1.2::second => pause p;
p => now;
1.2::second => spause s;
s => now;
would be quite useful. Where during the 1.2 seconds the shred's timer and audio processing halt. The spause would be a pause that forces silence during its halt.
I guess for now, provided the ADSR envelope is long enough and the pause is quick enough, a simple un-chucking from the dac would be somewhat of a solution - though not as flexible as the event-based solution. |
|
|
Back to top
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 6720 Location: The Hague, NL
G2 patch files: 3
|
Posted: Sat Apr 05, 2008 11:08 am Post subject:
|
 |
|
I have to think about this. It might be useful as a new feature idea or maybe there's some way to do this already (in a non-ugly way...). We could make our own pausable-ADSR out of Envelopes, for example but that doesn't help for Ugens that have a ADSR build in or where the envelope follows from the algorithm (like the physical modelling stuff).
I'll get back to it, it's a very interesting idea that makes a lot of sense to me. _________________ Modern technology offers an endless field day to any deviant strains in our personalities. --J.G.Ballard |
|
|
Back to top
|
|
 |
Stochastic

Joined: Feb 25, 2008 Posts: 32 Location: Vancouver
|
Posted: Sat Apr 05, 2008 11:16 am Post subject:
|
 |
|
| How would you build a pausable envelope-based ADSR? I can vaguely see one that has the pause points pre-determined and event clauses inserted in them, but is the a more flexible/elegant way? |
|
|
Back to top
|
|
 |
kijjaz

Joined: Sep 20, 2004 Posts: 568 Location: bangkok, thailand
Audio files: 2
|
Posted: Sun Apr 06, 2008 2:40 am Post subject:
|
 |
|
I see one way to do the pause for ADSR (but not as CPU-Effective as we hope):
first, chuck the ADSR to blackhole,
and use a function to update its .last() value to the place we want to use it.
for pausgin,
unchuck ADSR from blackhole, so it stops calculating (and the .last() remain the same all the time it's still unchucked),
but the function still updates the same .last(), so it'd appear to be pause by this way.
the update function can be set to a more flexible control rate also. |
|
|
Back to top
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 6720 Location: The Hague, NL
G2 patch files: 3
|
Posted: Sun Apr 06, 2008 2:45 am Post subject:
|
 |
|
| kijjaz wrote: |
the update function can be set to a more flexible control rate also. |
Yeah, in many cases we could pause the whole update function as well, using something like;
| Code: |
Event unpause;
int pause;
//stuff.
fun void update()
{
//more stuff
if(pause)
{
unpause => now;
}
//yet more stuff
} |
_________________ Modern technology offers an endless field day to any deviant strains in our personalities. --J.G.Ballard |
|
|
Back to top
|
|
 |
|