Ah, thanks so much-- this is very helpful. <br><br><div>How about "impending" ? ;) </div><div><br><div class="gmail_quote">2010/9/3  <span dir="ltr"><<a href="mailto:chuck-users-request@lists.cs.princeton.edu">chuck-users-request@lists.cs.princeton.edu</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Send chuck-users mailing list submissions to<br>
        <a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<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>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:chuck-users-request@lists.cs.princeton.edu">chuck-users-request@lists.cs.princeton.edu</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:chuck-users-owner@lists.cs.princeton.edu">chuck-users-owner@lists.cs.princeton.edu</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of chuck-users digest..."<br>
<br>Today's Topics:<br>
<br>
   1. Re: "Or" (David M)<br>
   2. Re: "Or" (Kassen)<br>
   3. Re: "Or" (Rebecca Fiebrink)<br>
   4. Re: "Or" (Kassen)<br>
<br><br>---------- Forwarded message ----------<br>From: David M <<a href="mailto:fimbulwintr@gmail.com">fimbulwintr@gmail.com</a>><br>To: ChucK Users Mailing List <<a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a>><br>
Date: Fri, 3 Sep 2010 12:02:24 -0400<br>Subject: Re: [chuck-users] "Or"<br>I believe that the much simpler way is to simply use "maybe"<br><br>float sampleRate<br><br>if (maybe)<br>   1.0 => sampleRate;<br>
else<br>    1.5 => sampleRate<br><br><div class="gmail_quote">2010/9/3 Mark Cerqueira <span dir="ltr"><<a href="mailto:mark.cerqueira@gmail.com" target="_blank">mark.cerqueira@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div style="word-wrap:break-word">Tim,<div>You can use rand2f to do this....</div><div><br>
</div><div><div style="margin:0px"><font color="#0034ff"><div style="margin:0px"><span style="color:rgb(0, 52, 255)">float</span> sampleRate;</div><div style="margin:0px;color:rgb(0, 52, 255);min-height:17px">
<br></div><div style="margin:0px"><span style="color:rgb(0, 52, 255)">if </span>(std.rand2f(<span style="color:rgb(222, 146, 15)">0</span>.<span style="color:rgb(222, 146, 15)">0</span>, <span style="color:rgb(222, 146, 15)">1</span>.<span style="color:rgb(222, 146, 15)">0</span>) < <span style="color:rgb(222, 146, 15)">0</span>.<span style="color:rgb(222, 146, 15)">5</span>)</div>

<div style="margin:0px">    <span style="color:rgb(222, 146, 15)">1</span>.<span style="color:rgb(222, 146, 15)">0</span> => sampleRate;</div><div style="margin:0px;color:rgb(0, 52, 255)">else</div><div style="margin:0px">

    <span style="color:rgb(222, 146, 15)">1</span>.<span style="color:rgb(222, 146, 15)">5</span> => sampleRate;</div><div style="margin:0px"><br></div><div style="margin:0px"><span style="color:rgb(0, 0, 0);font-family:Helvetica;font-size:medium">I ran this section of code 1,000,000 times in my program doing this chunk of code every 1 sample and:</span></div>

<div style="margin:0px"><span style="color:rgb(0, 0, 0);font-family:Helvetica;font-size:medium"><br></span></div><div style="margin:0px"><span style="color:rgb(0, 0, 0);font-family:Helvetica;font-size:medium">1. ChucK did not make my computer explode :)</span></div>

<div style="margin:0px"><span style="color:rgb(0, 0, 0);font-family:Helvetica;font-size:medium">2. The rate was set to 1.0 500,814 times and 1.5 499,186 times (pretty good distribution)</span></div><div style="margin:0px">

<br></div><div style="margin:0px"><span style="color:rgb(0, 0, 0);font-family:Helvetica;font-size:medium">Hope that helps!</span><span style="color:rgb(0, 0, 0);font-family:Helvetica;font-size:medium"> </span></div>
<div style="margin:0px"><br></div><div style="margin:0px"><span style="color:rgb(0, 0, 0);font-family:Helvetica;font-size:medium">Best,</span></div><div style="margin:0px"><font color="#000000" face="Helvetica"><span style="font-size:medium">Mark</span></font></div>

</font></div></div><div><br><div><div><div></div><div><div>On Sep 3, 2010, at 8:21 AM, Timothy Leonido wrote:</div><br></div></div><blockquote type="cite"><div><div></div><div>Hallo, <div><br></div><div>
Once again, sorry for the rudimentary questions, but I can't seem to find the correct language for a very simple function: Instead of using Std.rand2f( ) for fluctuating volume or buf.rate, I'd like to simply have an either/or option. Play sample at a rate of 1.0 <i>or </i>1.5, randomly. The moses function (in pure data) was useful for this. Direction to the appropriate helpful would also be appreciated.</div>


<div><br></div><div><br></div><div><br></div><div>Thanks so much, </div><div><br></div><div>Tim </div></div></div>
_______________________________________________<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></div></div><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>
<br></blockquote></div><br><br clear="all"><br>-- <br>David M<br>
<br><br>---------- Forwarded message ----------<br>From: Kassen <<a href="mailto:signal.automatique@gmail.com">signal.automatique@gmail.com</a>><br>To: ChucK Users Mailing List <<a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a>><br>
Date: Fri, 3 Sep 2010 18:04:34 +0200<br>Subject: Re: [chuck-users] "Or"<br><br><br><div class="gmail_quote">2010/9/3 Mark Cerqueira <span dir="ltr"><<a href="mailto:mark.cerqueira@gmail.com" target="_blank">mark.cerqueira@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Tim,<div>You can use rand2f to do this....</div><div><br></div><div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><font color="#0034FF"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">

<span style="color:#0034ff">float</span> sampleRate;</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;color:rgb(0, 52, 255);min-height:17px"><br></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">

<span style="color:#0034ff">if </span>(std.rand2f(<span style="color:#de920f">0</span>.<span style="color:#de920f">0</span>, <span style="color:#de920f">1</span>.<span style="color:#de920f">0</span>) < <span style="color:#de920f">0</span>.<span style="color:#de920f">5</span>)</div>

<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">    <span style="color:#de920f">1</span>.<span style="color:#de920f">0</span> => sampleRate;</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;color:rgb(0, 52, 255)">

else</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">    <span style="color:#de920f">1</span>.<span style="color:#de920f">5</span> => sampleRate;</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">

<br></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><font color="#000000"><font face="Helvetica"><span style="font-size:medium"><br>
</span></font></font></div></font></div></div></div></blockquote><div><br></div><div>Mark is right, his code is clean, readable and correct. It could also easily be tweaked to change the distribution.... And yet I'd still be tempted to do this;</div>

<div><br></div><div>1 + (.5 * maybe) => float sampleRate;</div><div><br></div><div>Generally "maybe" is my first port of call if I want to quickly and randomly choose between two options;</div><div><br></div>

<div>if (maybe) do_stuff();</div><div>else do_things();</div><div><br></div><div>Take Mark's option for long term projects that you will need to get back to or collaborate on. Pick my first option when livecoding as it's short to type and audiences like "maybe" as a word. My second expample might be closest to the PD object that you are missing. "maybe" resolves to "true" or "false" ("1"(int) and "0" (int) in ChucK) with 50/50 chance at each call. Practically speaking it's completely equivalent to;</div>

<div><br></div><div> Std.rand2(0,1)</div><div><br></div><div>However that, unlike Mark's example, can't be tuned in case you later decide you need a 25/75 distribution instead.</div><div><br></div><div>Yours,</div>

<div>Kas.</div></div>
<br><br>---------- Forwarded message ----------<br>From: Rebecca Fiebrink <<a href="mailto:fiebrink@princeton.edu">fiebrink@princeton.edu</a>><br>To: <a href="mailto:chuck-users@lists.cs.Princeton.EDU">chuck-users@lists.cs.Princeton.EDU</a><br>
Date: Fri, 3 Sep 2010 12:09:53 -0400<br>Subject: Re: [chuck-users] "Or"<br><div style="word-wrap:break-word">OR, because it's chuck and therefore more fun than your average language:<div><br></div><div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;color:rgb(51, 0, 255)">
if<span style="color:#144fae"> </span><span style="color:#000000">(</span>maybe<span style="color:#000000">)</span></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><span style="color:#144fae">   </span><span style="color:#e89200">1</span>.<span style="color:#e89200">0</span><span style="color:#144fae"> </span>=><span style="color:#144fae"> </span>sampleRate;</div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;color:rgb(51, 0, 255)">else</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><span style="color:#144fae">   </span><span style="color:#e89200">1</span>.<span style="color:#e89200">5</span><span style="color:#144fae"> </span>=><span style="color:#144fae"> </span>sampleRate;</div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><br></div><div><blockquote type="cite"><div><font color="#000000"><br></font><br>Message: 2<br>Date: Fri, 3 Sep 2010 11:21:34 -0400<br>From: Timothy Leonido <<a href="mailto:timothy.leonido@gmail.com" target="_blank">timothy.leonido@gmail.com</a>><br>
To: <a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br>Subject: [chuck-users] "Or"<br>Message-ID:<br><span style="white-space:pre-wrap"> </span><<a href="mailto:AANLkTikKmHj+557HnyR5wB3Mpd1owLc+D8zhwrKrFFZT@mail.gmail.com" target="_blank">AANLkTikKmHj+557HnyR5wB3Mpd1owLc+D8zhwrKrFFZT@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br><br>Hallo,<br><br>Once again, sorry for the rudimentary questions, but I can't seem to find<br>the correct language for a very simple function: Instead of using<br>
Std.rand2f( ) for fluctuating volume or buf.rate, I'd like to simply have an<br>either/or option. Play sample at a rate of 1.0 *or *1.5, randomly. The moses<br>function (in pure data) was useful for this. Direction to the appropriate<br>
helpful would also be appreciated.<br><br><br><br>Thanks so much,<br><br>Tim<br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL: <<a href="http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20100903/a938743d/attachment-0001.html" target="_blank">http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20100903/a938743d/attachment-0001.html</a>><br>
<br>------------------------------<br><br>Message: 3<br>Date: Fri, 3 Sep 2010 08:46:08 -0700<br>From: Mark Cerqueira <<a href="mailto:mark.cerqueira@gmail.com" target="_blank">mark.cerqueira@gmail.com</a>><br>To: ChucK Users Mailing List <<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a>><br>
Subject: Re: [chuck-users] "Or"<br>Message-ID: <<a href="mailto:7C3AA188-1842-4494-A6B5-613D133C1C9F@gmail.com" target="_blank">7C3AA188-1842-4494-A6B5-613D133C1C9F@gmail.com</a>><br>Content-Type: text/plain; charset="us-ascii"<br>
<br>Tim,<br>You can use rand2f to do this....<br><br>float sampleRate;<br><br>if (std.rand2f(0.0, 1.0) < 0.5)<br>    1.0 => sampleRate;<br>else<br>    1.5 => sampleRate;<br><br>I ran this section of code 1,000,000 times in my program doing this chunk of code every 1 sample and:<br>
<br>1. ChucK did not make my computer explode :)<br>2. The rate was set to 1.0 500,814 times and 1.5 499,186 times (pretty good distribution)<br><br>Hope that helps! <br><br>Best,<br>Mark<br><br></div></blockquote></div><br>
</div></div><br><br>---------- Forwarded message ----------<br>From: Kassen <<a href="mailto:signal.automatique@gmail.com">signal.automatique@gmail.com</a>><br>To: ChucK Users Mailing List <<a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a>><br>
Date: Fri, 3 Sep 2010 18:29:10 +0200<br>Subject: Re: [chuck-users] "Or"<br><br><br><div class="gmail_quote">2010/9/3 Rebecca Fiebrink <span dir="ltr"><<a href="mailto:fiebrink@princeton.edu" target="_blank">fiebrink@princeton.edu</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">OR, because it's chuck and therefore more fun than your average language:<div><br></div></div></blockquote><div><br></div><div>Ok, that's it. </div><div><br></div><div>Let's have "probably" and "perhaps" at 75% and 25% as well. Everyone loves "maybe" so much, we might as well have more of it.</div>

<div><br></div><div>Does English have single words describing indeterminate times and/or durations that aren't already reserved or would be confusing? We talk about "in a bit" or "in a while" but those sound like they would be cause for confusion. "soon" might be a good one?</div>

<div><br></div><div>Kas.</div></div>
<br>_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu">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>
<br></blockquote></div><br></div>