Hello, I was having some fun with delays in ChucK when I should have been paying attention in a meeting and ran into something I may have asked about before -- is there (or should there be) any way any way to soft kill a shred, either by ramping down its gain or by waiting until the shred is no longer sending output to dac? If I $ chuck - 1 something that is running it kills it immediately, and if I don't advance time long enough explicitly at the end of a delay example, the nice feedback tail gets abruptly cut off. E.g. https://github.com/heuermh/lick/blob/master/examples/mfm2.ck (doesn't require LiCK to run) michael
Hi Michael, killing a thread means means immediate de-scheduling. There is not such a thing as "soft kill" in any software because the scheduler is not the place where that kind of functionality belongs to. What you want is a "quit"-mechanism for your program: Threads that run "forever" contain a while(true) loop. A thread without that loop will stop running after finishing its commands. You need to use some kind external trigger be able to set that while loop condition to false (your "soft kill" button). Then you can place the "running out" code below the main loop, e.g. another while(signalStillActive)-loop with some kind of signal detector for your delay. regards, Basti Am 15.08.2012 um 00:18 schrieb Michael Heuer:
Hello,
I was having some fun with delays in ChucK when I should have been paying attention in a meeting and ran into something I may have asked about before -- is there (or should there be) any way any way to soft kill a shred, either by ramping down its gain or by waiting until the shred is no longer sending output to dac? If I
$ chuck - 1
something that is running it kills it immediately, and if I don't advance time long enough explicitly at the end of a delay example, the nice feedback tail gets abruptly cut off. E.g.
https://github.com/heuermh/lick/blob/master/examples/mfm2.ck (doesn't require LiCK to run)
michael _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On 18 August 2012 19:47, Bastian Schumacher
Hi Michael,
killing a thread means means immediate de-scheduling. There is not such a thing as "soft kill" in any software because the scheduler is not the place where that kind of functionality belongs to. What you want is a "quit"-mechanism for your program:
Yes, indeed. It'd need to be a static member of a public class, in practice; environment variable checking is too slow for this. Sadly this means quite a bit of planning ahead, making it unsuitable for spontaneous improvisation. There has also been some talk about "crossfading" when replacing shreds; also a appealing idea if we ignore the CPU cost. I think these are sufficiently sound and universal ideas to think about a framework/library for them. I'd like to help with something like that, but personally I'd like to first see a bit of the cleanup to the type system, particularly as it relates to arrays. I see no way of doing anything like this without arrays of UGens and assigning to those, combined with functions returning UGen references. There's a notorious amount of dragons there, currently. Yours, Kas.
Just piping in... I do think it would be useful and important to have a soft-kill button in the miniAudicle virtual machine monitor by default. Any system that involves running (and possibly writing in live performance) another Chuck shred just to kill another Chuck shred seems cumbersome to me. The button in the virtual machine monitor could talk to a special ShredEvent class, specific to each shred. A compile-time check could let Chuck now whether a given pile of code referenced that event or not. If it didn't then the - button could be the normal immediate de-scheduling. If it did, instead of doing the de-scheduling it could broadcast the message. The syntax might look like this then (: while(!Shred.rcvdStop) { // do something repeatedly } // make a graceful exit As a completely different point, in my own live coding and with the Cybernetic Orchestra I have often found it useful to sidestep this problem by tending towards code that doesn't loop indefinitely, but rather needs to be retriggered/re-sporked each time. Certainly keeps the fingers busy! Yours truly, David On 2012-08-18, at 5:47 PM, Kassen wrote:
On 18 August 2012 19:47, Bastian Schumacher
wrote: Hi Michael,
killing a thread means means immediate de-scheduling. There is not such a thing as "soft kill" in any software because the scheduler is not the place where that kind of functionality belongs to. What you want is a "quit"-mechanism for your program:
Yes, indeed. It'd need to be a static member of a public class, in practice; environment variable checking is too slow for this.
Sadly this means quite a bit of planning ahead, making it unsuitable for spontaneous improvisation. There has also been some talk about "crossfading" when replacing shreds; also a appealing idea if we ignore the CPU cost.
I think these are sufficiently sound and universal ideas to think about a framework/library for them. I'd like to help with something like that, but personally I'd like to first see a bit of the cleanup to the type system, particularly as it relates to arrays. I see no way of doing anything like this without arrays of UGens and assigning to those, combined with functions returning UGen references. There's a notorious amount of dragons there, currently.
Yours, Kas. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
--------------------------------------------------------------------------------
Dr. David Ogborn,
Am 18.08.2012 um 23:47 schrieb Kassen:
On 18 August 2012 19:47, Bastian Schumacher
wrote: Hi Michael,
killing a thread means means immediate de-scheduling. There is not such a thing as "soft kill" in any software because the scheduler is not the place where that kind of functionality belongs to. What you want is a "quit"-mechanism for your program:
Yes, indeed. It'd need to be a static member of a public class, in practice; environment variable checking is too slow for this.
Sadly this means quite a bit of planning ahead, making it unsuitable for spontaneous improvisation.
Why shouldn't it be possible to write a class for the pre-planned part which you can use to include your live code and pass the parameters during runtime (directly after leaving the loop). At least this would be an adequate solution from the theoretic standpoint. One could use a key from the keyboard as trigger button and the code may alter the parameters of the exit code if the tail may vary. I don't see anything that chuck can do now that could not be done using that technique.
In my live performance setup, I had the concept of an "active patch". I never directly killed the shred that ran the patch (except in emergencies), but rather sent it a "cease and desist" message via semaphore. The patch was then responsible for ramping down, gracefully fading out, deallocating resources and -- only after all that completed -- the patch would exit the loop that ran its shred. If I understand the original post, this is the effect you're looking for. I don't see a practical way to build that into the core of ChucK, but writing a couple of general classes make it easy to implement across different patches. Make sense? - Rob
P.S.: Regarding "spontaneity" and "planning ahead": I should have mentioned that when I switched patches, the new patch would start right away while the old one was ramping down. This means that there were more shreds running in that interval between the new patch starting and the old one completing, but that turned out never to be an issue in my live performances -- I always had enough reserve CPU cycles to handle the transition.
On Sun, Aug 19, 2012 at 03:10:50AM +0200, Bastian Schumacher wrote:
Why shouldn't it be possible to write a class for the pre-planned part which you can use to include your live code and pass the parameters during runtime (directly after leaving the loop). At least this would be an adequate solution from the theoretic standpoint. One could use a key from the keyboard as trigger button and the code may alter the parameters of the exit code if the tail may vary. I don't see anything that chuck can do now that could not be done using that technique.
You are right, of course; all the features are there. Ideally we'd insert something like a ENvelope between the shred and the dac, then write our own code for hotkey-based launching and updating. Could be done -in theory- in a weekend, especially if we'd involve our favourite scriptable editor. My comment wasn't base don the theory, but on the fear that this would run into the issues the type-system has. I see no way around storing the shreds and the representation of the shred's audio output(s) in a array, then re-assigning to that as stuff gets updated and that is where, in my experience, so nasty bugs are hiding. You are totally right about the possibility feature-wise and I may well be wrong; maybe it'd all work without a hitch. Maybe I'm getting old; it's not very ChucKist to fear a few bugs. ;-) Yours, Kas.
I am very intrested in this as well once sketched a system which detected
inactivity on shred output to trigger in action.
Would be intrested in helping with a hacking session and cip has some of
this functionality in place but I think driven through OsX mini audicle GUI
interface elements
All the best
Scott
On Aug 19, 2012 1:56 PM, "Kassen"
Why shouldn't it be possible to write a class for the pre-planned part which you can use to include your live code and pass the parameters during runtime (directly after leaving the loop). At least this would be an adequate solution from the theoretic standpoint. One could use a key from
On Sun, Aug 19, 2012 at 03:10:50AM +0200, Bastian Schumacher wrote: the keyboard as trigger button and the code may alter the parameters of the exit code if the tail may vary. I don't see anything that chuck can do now that could not be done using that technique.
You are right, of course; all the features are there. Ideally we'd insert something like a ENvelope between the shred and the dac, then write our own code for hotkey-based launching and updating.
Could be done -in theory- in a weekend, especially if we'd involve our favourite scriptable editor.
My comment wasn't base don the theory, but on the fear that this would run into the issues the type-system has. I see no way around storing the shreds and the representation of the shred's audio output(s) in a array, then re-assigning to that as stuff gets updated and that is where, in my experience, so nasty bugs are hiding.
You are totally right about the possibility feature-wise and I may well be wrong; maybe it'd all work without a hitch. Maybe I'm getting old; it's not very ChucKist to fear a few bugs. ;-)
Yours, Kas. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On 19 August 2012 15:11, Scott Hewitt
I am very intrested in this as well once sketched a system which detected inactivity on shred output to trigger in action.
Also cool might be shreds that can check whether the file they came from was updated and if so machine.add() the new one and kill themselves. The advantage here would be that we could pick the method of them leaving the VM, for example using a fade-out or only restarting at a particular point in a repeating music structure. Just thinking out loud here. Kas.
When you say fadeout are you meaning very quick 10::ms or more
musically creative length like a dim.?
----------
visit me
http://www.scotthewitt.co.uk
@scotthewitt
http://www.theaudiopodcast.co.uk
http://www.ablelemon.co.uk
http://www.inclusiveimprov.co.uk/
On 19 August 2012 14:24, Kassen
On 19 August 2012 15:11, Scott Hewitt
wrote: I am very intrested in this as well once sketched a system which detected inactivity on shred output to trigger in action.
Also cool might be shreds that can check whether the file they came from was updated and if so machine.add() the new one and kill themselves. The advantage here would be that we could pick the method of them leaving the VM, for example using a fade-out or only restarting at a particular point in a repeating music structure.
Just thinking out loud here.
Kas. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On 19 August 2012 15:27, Scott Hewitt
When you say fadeout are you meaning very quick 10::ms or more musically creative length like a dim.?
Well, whatever is more suitable. I'm trying to work towards more fluid updating of shreds, with a minimum of (unpleasant) artefacts. That might work in a slightly different way for different applications. Just getting rid of a "click" might be easier than full on 16bars crossfading in a techno performance if we accept some hackishness, I'd personally prefer a open-ended general approach. Kas.
On 15 Aug 2012, at 00:18, Michael Heuer wrote:
...is there (or should there be) any way any way to soft kill a shred, either by ramping down its gain or by waiting until the shred is no longer sending output to dac?
I used a technique to cause shread delay when the computer keyboard keys are released in these files: https://www-lagring.telia.se/Shares/Home.aspx?ShareID=f2f70b60-a7f7-4d15-9c3... (Click on the folder, and ignores those starting with '._'.) Hans
participants (7)
-
Bastian Schumacher
-
David Ogborn
-
Hans Aberg
-
Kassen
-
Michael Heuer
-
Robert Poor
-
Scott Hewitt