Thanks so much for your reply! It is perfecto to me. <div><br></div><div>I am working in some interesting things with chuck, and I trying to use the Wavelet Transform to get pith, flux, etc.  Your reply is very useful for me.</div>

<div><br></div><div><br></div><div><br></div><div><br></div><div><br><div class="gmail_quote">2013/6/9 Perry Cook <span dir="ltr"><<a href="mailto:prc@cs.princeton.edu" target="_blank">prc@cs.princeton.edu</a>></span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Either is fine, in fact the samples would be identical in this example.<br>
<br>
However, if you wanted to apply a gain scaling to the samples coming<br>
from adc (as part of a more elaborate patch, for example), then the<br>
gain labeled "input" would be the place to do it (I'll tell you why soon).<br>
In the example I gave, we could set input.gain to 32768.0 then do the<br>
cast of input.last() to int, saving the multiply.  For that, you'd need to<br>
connect adc through the Gain UG and to blackhole, because it doesn't<br>
update/compute without that.<br>
<br>
Why wouldn't we just change the gain of adc?  Well, as a matter of best<br>
practices, that is a very bad idea.  Turns out that since adc is a persistent<br>
and unique UG (like dac and blackhole), as long as the VM runs, the<br>
gain change on adc is permanent and global!  Imagine how surprised<br>
another shred might be if it used adc and found the samples ranging<br>
from -32767 to 32768.  Bad idea, so I make my students always connect<br>
adc to a Gain UG, just avoid the temptation of operating on adc directly.<br>
<br>
Also, if you connect adc => blackhole (or adc => dac), that connection is<br>
also global and permanent, even though the shred that did it might end.<br>
So again, operating on adc directly is not good practice.  adc.last() is<br>
perfectly fine at all times, but I just make my students avoid all use of adc<br>
directly.<br>
<br>
Hope this helps,<br>
<br>
PRC<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Fernando Alonso Martín<br><a href="mailto:Lualobus@gmail.com" target="_blank">Lualobus@gmail.com</a><br><div><a href="http://www.roboticNaturalInteraction.com/famartin.html" target="_blank">http://roboticnaturalinteraction.com</a></div>

<div><br></div>
</div>