electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks GalleryGallery 
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
Pausing Shreds
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [7 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Stochastic



Joined: Feb 25, 2008
Posts: 32
Location: Vancouver

PostPosted: Thu Apr 03, 2008 11:22 am    Post subject: Pausing Shreds Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 6720
Location: The Hague, NL
G2 patch files: 3

PostPosted: Fri Apr 04, 2008 7:56 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail Visit poster's website
Stochastic



Joined: Feb 25, 2008
Posts: 32
Location: Vancouver

PostPosted: Fri Apr 04, 2008 10:09 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 6720
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sat Apr 05, 2008 11:08 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail Visit poster's website
Stochastic



Joined: Feb 25, 2008
Posts: 32
Location: Vancouver

PostPosted: Sat Apr 05, 2008 11:16 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
kijjaz



Joined: Sep 20, 2004
Posts: 568
Location: bangkok, thailand
Audio files: 2

PostPosted: Sun Apr 06, 2008 2:40 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 6720
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sun Apr 06, 2008 2:45 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [7 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003, 2004, 2005, 2006 and 2007 by electro-music.com