<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">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; font: normal normal normal 12px/normal Helvetica; 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; font: normal normal normal 12px/normal Helvetica; "><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; font: normal normal normal 12px/normal Helvetica; color: rgb(51, 0, 255); ">else</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; "><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; font: normal normal normal 12px/normal Helvetica; "><br></div><div><blockquote type="cite"><div><font class="Apple-style-span" 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">timothy.leonido@gmail.com</a>><br>To: <a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>Subject: [chuck-users] "Or"<br>Message-ID:<br><span class="Apple-tab-span" style="white-space:pre">        </span><<a href="mailto:AANLkTikKmHj+557HnyR5wB3Mpd1owLc+D8zhwrKrFFZT@mail.gmail.com">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">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">mark.cerqueira@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>Subject: Re: [chuck-users] "Or"<br>Message-ID: <<a href="mailto:7C3AA188-1842-4494-A6B5-613D133C1C9F@gmail.com">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></body></html>