Oh sorry, you also need to start up voicePlayer once. Insert:<br><br>spork ~ voicePlayer();<br><br>before the last while loop.<br><br>/Stefan<br><br><div class="gmail_quote">On Thu, Sep 24, 2009 at 8:41 AM, Stefan Blixt <span dir="ltr">&lt;<a href="mailto:stefan.blixt@gmail.com">stefan.blixt@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I would definitely use events here instead of sporking:<br><br>Instead of this:<br><br>fun void voice(){<br>
    ...<div class="im"><br>}<br><br>while (15::ms =&gt; now){<br>    spork ~ voice();<br>}<br><br></div>do this:<br><br>Event voiceEvent;<br>
fun void voicePlayer() {<br>    while (true) {<br>        voiceEvent =&gt; now;<br>        ...<br>    }<br>}<br><br>while (15::ms =&gt; now){<br>    voiceEvent.signal();<br>}<br><br>Besides losing any overhead that sporking causes, it also makes it a bit easier to manage variables - this way you can keep the SndBuf in the the voidePlayer function, before the while loop starts.<br>

<br>/Stefan<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Wed, Sep 23, 2009 at 10:39 PM, Kassen <span dir="ltr">&lt;<a href="mailto:signal.automatique@gmail.com" target="_blank">signal.automatique@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
kurt<br>
<div><br>
&gt; I guess I am wondering if there is a way to release Ugen references or do I<br>
&gt; need to wait for garbage collection to liberally spork Ugens?<br>
<br>
<br>
</div>I think you can assign &quot;null&quot; to objects to have them garbage<br>
collected forcefully but I&#39;m not sure there.<br>
<br>
However in this particular case there is a easy way out. Since you are<br>
dealing with linear envelope segments and sample-based grains LiSa<br>
will suit your needs perfectly (see /examples/special for docs and<br>
tutorials). LiSa will contain a single buffer for you that can be<br>
played back multiple times at various rates with per-voice start, loop<br>
and so on settings. It will handle most voice cycling for you.<br>
<br>
For a more general case there are questions here. I think grains are a<br>
especially interesting case for resource cycling as we will likely be<br>
doing rather a lot of that in the case of grains. Off list i talked<br>
with Mike (probably our residential expert on using grains in ChucK)<br>
about proposing a sensible way for using non-linear envelopes with<br>
LiSa however neither of us could come up with a coherent approach.<br>
<br>
Perhaps somebody else has ideas; the exact volume envelope of grains<br>
matters a lot for the resulting spectrum.<br>
<br>
There are, BTW, no free rides here. For voices or grains (and assuming<br>
finite computational power) we will need to somehow cycle resources.<br>
This is unavoidable. The question is how much of that should be build<br>
in and how much we will need to do ourselves. I don&#39;t think all of<br>
this can be build into ChucK without sacrificing versatility and so I<br>
don&#39;t think that arrays with some infrastructure need be such a bad<br>
option here. It may be laborious but it also forces us to contemplate<br>
in depth what we need and gives us power to specify that in a very<br>
precise way.<br>
<br>
Yours,<br>
Kas.<br>
_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
</blockquote></div><br><br clear="all"><br></div></div><font color="#888888">-- <br>Release me, insect, or I will destroy the Cosmos!<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Release me, insect, or I will destroy the Cosmos!<br>