[chuck-users] Get audio samples of adc (fernando alonso)

fernando alonso lualobus at gmail.com
Sun Jun 9 15:13:18 EDT 2013

Thanks so much for your reply! It is perfecto to me.

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.

2013/6/9 Perry Cook <prc at cs.princeton.edu>

> Either is fine, in fact the samples would be identical in this example.
> However, if you wanted to apply a gain scaling to the samples coming
> from adc (as part of a more elaborate patch, for example), then the
> gain labeled "input" would be the place to do it (I'll tell you why soon).
> In the example I gave, we could set input.gain to 32768.0 then do the
> cast of input.last() to int, saving the multiply.  For that, you'd need to
> connect adc through the Gain UG and to blackhole, because it doesn't
> update/compute without that.
> Why wouldn't we just change the gain of adc?  Well, as a matter of best
> practices, that is a very bad idea.  Turns out that since adc is a
> persistent
> and unique UG (like dac and blackhole), as long as the VM runs, the
> gain change on adc is permanent and global!  Imagine how surprised
> another shred might be if it used adc and found the samples ranging
> from -32767 to 32768.  Bad idea, so I make my students always connect
> adc to a Gain UG, just avoid the temptation of operating on adc directly.
> Also, if you connect adc => blackhole (or adc => dac), that connection is
> also global and permanent, even though the shred that did it might end.
> So again, operating on adc directly is not good practice.  adc.last() is
> perfectly fine at all times, but I just make my students avoid all use of
> adc
> directly.
> Hope this helps,
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

Fernando Alonso Martín
Lualobus at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20130609/9495fb49/attachment.html>

More information about the chuck-users mailing list