<div dir="ltr">Hi guys<div><br></div><div>Thought I'd let you know I've rewritten <a href="https://github.com/aknuds1/chuckjs">ChucKJS</a> to work in a sample accurate way. To make this work, I had to forego Web Audio API's built-in nodes, e.g. oscillators, and write everything from scratch. So far I've only implemented a sine oscillator, but that's all I need for my current examples anyway :) To be able to generate sound sample by sample, I've used the <a href="https://developer.mozilla.org/en-US/docs/Web/API/ScriptProcessorNode">ScriptProcessorNode</a> interface, which allows you to register a callback in which you can write to its output buffers.</div>
<div><br></div><div>This approach, with generating every sample in JavaScript, is probably horrible for performance, but it's the only option I can see for re-implementing ChucK properly. Hopefully, the performance is good enough for demonstration purposes.</div>
<div><br></div><div>So far, I've got three examples for you to try, examples/example1.html, examples/example2.html and examples/basic/demo0.html. Make sure you build ChucKJS first (as described in the <a href="https://github.com/aknuds1/chuckjs#build">README</a>), as the examples are generated. I'm planning on porting more of ChucK's own examples as time permits. Also playing with the idea of making a dedicated site for the project (via GitHub Pages), where the examples are displayed.</div>
<div><br></div><div>Would love some feedback on the current state of affairs!</div><div><br></div><div>Best,</div><div>Arve</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Dec 27, 2013 at 2:36 AM, Arve Knudsen <span dir="ltr"><<a href="mailto:arve.knudsen@gmail.com" target="_blank">arve.knudsen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi guys<div><br></div><div>I've begun work on a JavaScript (well, CoffeeScript) implementation of ChucK, <a href="https://github.com/aknuds1/chuckjs" target="_blank">ChucKJS</a>, for which I'm seeking feedback from ChucK developers in particular. <a href="https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html" target="_blank">Web Audio API</a> is used to produce sound. Very little of the language is implemented so far, I've just today finished end-to-end support (including a VM) for playing back a sine tone for a certain interval of time as in the following program:</div>

<div><br></div><div>    SinOsc sin => dac;</div><div>    2::second => now;<br></div><div><br></div><div>Even though this may seem minor, I'm pretty happy that this is at all possible just from within the browser :) As explained in the project's README, there is a self-contained example (examples/example1.html) which demonstrates the aforementioned sine wave playback capability.</div>

<div><br></div><div>What do you guys think, are anyone else interested in being able to run ChucK programs in the browser? Anyone interested in helping out on <a href="https://github.com/aknuds1/chuckjs" target="_blank">ChucKJS</a> (like ChucK it's GPL licensed)?</div>

<div><br></div><div>My motivation for writing ChucKJS is to develop an online development environment for ChucK where one can execute the programs directly in the browser, I figure this will lower the threshold and make the language more fun to work with.</div>

<div><br></div><div>Merry Christmas,</div><div>Arve</div></div>
</blockquote></div><br></div>