<div dir="ltr"><div>I&#39;ve achieved  dreadfulness with this. Okay, will vary the rhythm etc and reduce the range, get a more interesting scale, but... hmm!</div><div>SawOsc s =&gt; JCRev r =&gt; dac;<br>.1 =&gt; s.gain;<br>.1 =&gt; r.mix;<br>1 =&gt; int incsamp;<br>0 =&gt; int ps;<br>1 =&gt; float height;<br>0 =&gt; float maxsofar;<br>0 =&gt; float freq;<br>SndBuf buf;<br><br>&quot;/home/forrest/chuck/examples/basic/om.wav&quot; =&gt; buf.read;<br><br>buf.samples()  =&gt; int numSamples;<br> Std.rand2(1, numSamples-1) =&gt; incsamp;<br>while(true){<br>        (incsamp + ps) % numSamples =&gt; ps;<br>        buf.valueAt(ps) + 0.125 =&gt; height;<br>        Std.mtof(Math.ceil(Std.fabs(500.0 * height)) ) =&gt; freq =&gt; s.freq;<br>        <br>        if(freq &gt; maxsofar) {<br>                 freq =&gt; maxsofar;<br>                &lt;&lt;&lt; maxsofar &gt;&gt;&gt;;<br>                }<br>0.75::second =&gt; now;<br>}<br><br><br><br><br><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 19, 2020 at 1:42 PM Forrest Curo &lt;<a href="mailto:treegestalt@gmail.com">treegestalt@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Um. that works.</div><div>So does this:</div><div>SndBuf s =&gt; blackhole; <br>&quot;/home/forrest/chuck/examples/basic/om.wav&quot; =&gt; s.read;<br>float samples;<br>0 =&gt; int i;<br>while (s.pos() &lt; s.samples())  {<br>    &lt;&lt;&lt; s.last() &gt;&gt;&gt;;<br>    s.pos() =&gt; i;<br>    (s.valueAt(i)) =&gt; samples;<br>    &lt;&lt;&lt; samples &gt;&gt;&gt;;<br>    samp =&gt; now;</div><div>}</div><div><br></div><div>I was having trouble trying to read a sndBuf like an array, or put its contents into an array.</div><div>Maybe I was reading numbers off the end of the file. Declaring <br></div><div>&#39;float samples[]; &#39;</div><div>and doing</div><div>&#39;s.valueAt(i) =&gt; samples[i];&#39;</div><div><br></div><div>got me a &#39;Null pointer&#39; error. <br></div><div><br></div><div>Stumbling over syntax, I guess. Thanks for help!<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 19, 2020 at 10:54 AM Perry Cook &lt;<a href="mailto:prc@cs.princeton.edu" target="_blank">prc@cs.princeton.edu</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This is truly odd.  I don’t have easy means to test it.   I don’t <br>
know why it wouldbe broken dependent on the dac, however.<br>
<br>
For fun you might try something like this, just to verify that the<br>
valueAt() function is what’s busted.<br>
<br>
SndBuf s =&gt; blackhole;  <br>
“Fred.wav” =&gt; s.read;<br>
<br>
while (s.pos() &lt; s.samples())  {<br>
    &lt;&lt;&lt; s.last() &gt;&gt;&gt;;<br>
    samp =&gt; now;<br>
}<br>
<br>
PRC<br>
<br>
&gt; On Apr 19, 2020, at 9:00 AM, <a href="mailto:chuck-users-request@lists.cs.princeton.edu" target="_blank">chuck-users-request@lists.cs.princeton.edu</a> wrote:<br>
&gt; <br>
&gt; Send chuck-users mailing list submissions to<br>
&gt;       <a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br>
&gt; <br>
&gt; To subscribe or unsubscribe via the World Wide Web, visit<br>
&gt;       <a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
&gt; or, via email, send a message with subject or body &#39;help&#39; to<br>
&gt;       <a href="mailto:chuck-users-request@lists.cs.princeton.edu" target="_blank">chuck-users-request@lists.cs.princeton.edu</a><br>
&gt; <br>
&gt; You can reach the person managing the list at<br>
&gt;       <a href="mailto:chuck-users-owner@lists.cs.princeton.edu" target="_blank">chuck-users-owner@lists.cs.princeton.edu</a><br>
&gt; <br>
&gt; When replying, please edit your Subject line so it is more specific<br>
&gt; than &quot;Re: Contents of chuck-users digest...&quot;<br>
&gt; <br>
&gt; <br>
&gt; Today&#39;s Topics:<br>
&gt; <br>
&gt;   1. sndBuf.valueAt (Forrest Curo)<br>
&gt; <br>
&gt; <br>
&gt; ----------------------------------------------------------------------<br>
&gt; <br>
&gt; Message: 1<br>
&gt; Date: Sun, 19 Apr 2020 07:30:15 -0700<br>
&gt; From: Forrest Curo &lt;<a href="mailto:treegestalt@gmail.com" target="_blank">treegestalt@gmail.com</a>&gt;<br>
&gt; To: ChucK Users Mailing List &lt;<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a>&gt;<br>
&gt; Subject: [chuck-users] sndBuf.valueAt<br>
&gt; Message-ID:<br>
&gt;       &lt;CAAn-Ecy0LKVHCWmoUL2Y7w67rsibhRAHOOkN1neZyU=az3vm=<a href="mailto:g@mail.gmail.com" target="_blank">g@mail.gmail.com</a>&gt;<br>
&gt; Content-Type: text/plain; charset=&quot;utf-8&quot;<br>
&gt; <br>
&gt; Using chuck linux-jack this gives me reasonable numbers between -1 and 1.<br>
&gt; Using chuck linux-alsa I&#39;m able to play the file I&#39;ve read into sndBuf; but<br>
&gt; trying to copy it via .valueAt gives absurdly high [&quot;out of range&quot;] numbers<br>
&gt; at each point. [It can be a different high number different times I run<br>
&gt; chuck, but the number it is turns up at every point I sample.]<br>
&gt; <br>
&gt; Is there a fix for this? Aside from using jack on a computer where it<br>
&gt; befnurgles the midi?<br>
&gt; -------------- next part --------------<br>
&gt; An HTML attachment was scrubbed...<br>
&gt; URL: &lt;<a href="http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200419/76d94eef/attachment-0001.html" rel="noreferrer" target="_blank">http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200419/76d94eef/attachment-0001.html</a>&gt;<br>
&gt; <br>
&gt; ------------------------------<br>
&gt; <br>
&gt; _______________________________________________<br>
&gt; chuck-users mailing list<br>
&gt; <a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br>
&gt; <a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
&gt; <br>
&gt; <br>
&gt; End of chuck-users Digest, Vol 176, Issue 4<br>
&gt; *******************************************<br>
<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" rel="noreferrer" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
</blockquote></div>
</blockquote></div>