<div dir="ltr">Hey Mario,<div><br></div><div>Thanks so much for your work on the manual, its looking great! </div><div><br></div><div>SndBuf/SndBuf2 are designed to resample the audio file to the native rate when doing audio playback, although off the top of my head I don&#39;t know if valueAt()/samples() are also resampling (seems like they shouldn&#39;t, to allow true sample-level access).  </div><div><br></div><div>Generally speaking, comparing two floats for exact equality is too rigorous for digital audio. Its preferred to test that they are &quot;close enough&quot; within a desired order of magnitude, e.g. Math.fabs(f1-f2) &lt; Math.fabs(f1)*<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">0.0001 (see e.g. [1]). </span></div><div><br></div><div>Secondly, there are at least two resamplings involved in this test (when you created perc2.wav, it was resampled from perc1.wav at 44100 to 48000, and then ChucK might be resampling it back to 44100). Under certain conditions resampling can be theoretically &quot;perfect,&quot; but otherwise its just making a guess what the sample would be at the new rate. Even under perfect conditions, the inexact nature of floating point arithmetic means that resampling from 44100 -&gt; 48000 -&gt; 44100 will most likely result in a different series of actual values. </div><div><br></div><div>Spencer</div><div><br></div><div>[1] <a href="http://floating-point-gui.de/errors/comparison/" target="_blank">http://floating-point-gui.<wbr>de/errors/comparison/</a></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 24, 2018 at 8:59 AM, mario buoninfante <span dir="ltr">&lt;<a href="mailto:mario.buoninfante@gmail.com" target="_blank">mario.buoninfante@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I forgot to say, that the program I posted in the previous mail returns a lot of errors, basically 97% of the file length. I suppose the samples which are the same are all 0. btw the bit depth is the same, they&#39;re both 16 bit.<br>
<br>
<br>
cheers,<br>
<br>
Mario<div class="HOEnZb"><div class="h5"><br>
<br>
______________________________<wbr>_________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton<wbr>.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank">https://lists.cs.princeton.edu<wbr>/mailman/listinfo/chuck-users</a><br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div style="font-family:arial;font-size:small"><div style="font-family:arial,sans-serif;font-size:12.8px"><font size="2">Spencer Salazar, PhD</font></div><div style="font-family:arial,sans-serif;font-size:12.8px"><font size="2">Special Faculty</font></div><div style="font-family:arial,sans-serif;font-size:12.8px"><font size="2">Music Technology: Interaction, Intelligence, and Design</font></div><div style="font-family:arial,sans-serif;font-size:12.8px"><font size="2">California Institute of the Arts</font></div><div style="font-family:arial,sans-serif;font-size:12.8px"><font size="2"><br></font></div><div style="font-family:arial,sans-serif;font-size:12.8px"><font size="2"><a href="mailto:ssalazar@calarts.edu" target="_blank">ssalazar@calarts.edu</a> | +1 831.277.4654</font></div><div style="font-family:arial,sans-serif;font-size:12.8px"><font size="2"><a href="https://spencersalazar.com/" target="_blank">https://spencersalazar.com</a> </font></div><div><font size="2"><br></font></div></div></div></div>
</div>