<div dir="ltr">Ronni,<div><br></div><div>It is hard to answer because it is hard to know what question you are asking. Here are some possible answers:</div><div><br></div><div>1) The code examples can be translated to ChucK. Without context it is hard to understand the point of the examples but all of the math is standard stuff; supported by any programming language including ChucK.</div>


<div>2) ChucK supports calculated output, i.e. where the output data stream is a mathematical function of time. That's pretty much what ChucK does.</div><div>3) You can pass a reference to a function as an argument to another function.</div>


<div><br></div><div>Note: Turing proved that all programming languages complex enough to be useful are basically equivalent. In other words you can translate an algorithm written in one programming language into any other language. "Can you do it" is therefore not a really useful question because the answer is generally yes. That doesn't mean all languages are the same. Some are clearer than others or are useful for organizing code in a particular way. More interesting questions might be "Does ChucK running on my computer have enough horsepower to do algorithm XYZ in real time?" Or maybe "Does the expressive power of ChucK fit well with algorithm style XYZ or will the result be hacky and hard to read?"</div>


<div><br></div><div>All of that said the real problem in ChucK is that the capability is there but almost totally undocumented. In ChucK a chunk of code that generates sound is called a ugen. There is plenty of documentation about how to use the builtin ugens but almost no documentation about how to make your own in ChucK. The most likely approach seems to be what is called a ChuGen. A ChuGen is an extensible class which is a ugen. You can add your own code (by overriding the tick() method) to generate sound samples. There are three kinds of documentation about this. 1) The release notes barely admit the existence of ChuGens. 2) The following paper discusses them briefly. 3) ChucK is open source. You can download the source code and try to figure it out on your own.</div>


<div><br></div><div><a href="https://ccrma.stanford.edu/~spencer/publications/CCC2012.pdf" target="_blank">https://ccrma.stanford.edu/~spencer/publications/CCC2012.pdf</a><br></div><div><br></div><div>It is a mystery to many of us exactly why users are not allowed to know how to do this. Questions to this list are basically ignored except by other users. I suspect that ChucK developers don't read this list and the real point of this list is to hope users will support each other and stop bothering the developers. It is also possible that there are no real developers, that ChucK development consists of an occasional  grad student who shows interest for a while then moves on to more productive endeavors.</div>


<div><br></div><div>I hope this helps. If you learn anything useful pass it along.</div><div><br></div><div>-steve</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra">

<br><br><div class="gmail_quote">On Fri, Dec 27, 2013 at 2:46 AM, Ronni Montoya <span dir="ltr"><<a href="mailto:ronni.montoya@gmail.com" target="_blank">ronni.montoya@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi list, i been reading a paper that talks about an approach for<br>
generating sound that uses functions to directly shape waveforms. The<br>
function receives "expresions" as argument and it generates different<br>
kind of 8 bit waveforms from the expressions.<br>
<br>
An expression can look like this:<br>
<br>
f(t) = t * ( t >> 8 * ( t >>15 | t >> 8) & 20 | ( t >>19) * 5 >> t | t >> 3))<br>
<br>
<br>
<br>
The paper describes the algorithm in this way:<br>
<br>
<br>
algorithm 1 :<br>
Construction of an 8-bit waveform of 8000Hz  sample rate:<br>
<br>
The function has 2 inputs :<br>
<br>
Input 1) a functional expresion f(t)<br>
Input  2 ) time durations in seconds (d)<br>
Output: the waveform of an audio signal with seconds duration<br>
<br>
<br>
for t = 1 to d8000 do<br>
     if f(t) ==NaN then<br>
         q(t)  <-- 0<br>
      else<br>
         q(t) <-- mod(f(t)), 256)<br>
     end if<br>
     s(t) <-- 2 q(t)/255 - 1<br>
end for<br>
<br>
<br>
If its possible to implement this approach for generating sound in chuck??<br>
<br>
<br>
<br>
<br>
cheers<br>
<br>
<br>
R.<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>
</blockquote></div><br></div>