[chuck-dev] ChucKJS

Arve Knudsen arve.knudsen at gmail.com
Wed Jan 1 19:21:50 EST 2014

Hi Casper

On Sat, Dec 28, 2013 at 6:02 PM, Casper Schipper
<casper.schipper at gmail.com>wrote:
> Your implementation at first sight seems to me like like quite a thorough
> port of the complete structure of ChucK, complete with VM etc.. Does that
> mean that it will be possible to have sample accurate timing in your code
> execution just like ChucK ? Playing a little bit with JavaScript I’ve
> noticed that the JavaScript setTimeout clock is very unpredictable and
> found it to be messy even for a simple drum machine. Of course there are
> ways of dealing with that by scheduling ahead and using the WebAudio API
> clock, but that would not work very well with the way ChucK deals with
> time. But maybe your implementation doesn’t require the clock to be
> accurate ? I’m very curious to hear what your experience has been!

Your observation is quite on the money as regards setTimeout. I only made
use of it for simplicity during prototyping, and mean to replace it with
something better suited to audio scheduling, e.g. the way that
WAAClock<https://github.com/sebpiq/WAAClock> does
it (via callbacks to a custom audio processing node). I'm not sure if
timing will ever be perfect, but hopefully it'll be acceptable.

> Anyway what surprised me (shocked is maybe a better word, considering the
> bad reputation of JavaScript) while playing with the Web Audio API, is that
> JavaScript is quite interesting as an algorithmic composition scripting
> language, since it is fundamentally a functional language not that unlike
> Scheme or Lisp (and some powerful algorithmic musical tools have been built
> in those like: AC toolbox, Niquist and AthenaCL in Python). Here JavaScript
> could have an advantage above the more traditional way ChucK deals with
> types and classes. When using ChucK I found that I almost always wanted to
> add functionalities to the arrays like iterating, choosing, sorting,
> mapping functions, lambda functions etc… These are also in the LicK library
> for ChucK, but I haven’t seen many people use that, I guess because it
> complicates the syntax a bit*. In JavaScript you get those things from the
> start (or they are very simple to add). Also it’s easy to change behavior
> of objects like adding methods dynamically to objects, which is very
> interesting from the point of view of on the fly programming.

I'm quite fond of functional programming too (although I'm more of an OO
guy), which is one of the reasons I prefer CoffeeScript over raw
JavaScript, as this language lends itself better to this style of
programming, not having to reach for the underscore library all the time. I
know very little ChucK as of yet, but my main motivation is to have a
low-threshold environment for playing with the language. I'm not trying to
implement the perfect in-browser music programming experience :)


On 27 dec. 2013, at 02:58, chuck-dev-request at lists.cs.princeton.edu wrote:
> Hi guys
> I've begun work on a JavaScript (well, CoffeeScript) implementation of
> ChucK, ChucKJS <https://github.com/aknuds1/chuckjs>, for which I'm
> seeking feedback from ChucK developers in particular. Web Audio API<https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html> 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:
>     SinOsc sin => dac;
>     2::second => now;
> 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.
> 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 ChucKJS<https://github.com/aknuds1/chuckjs> (like
> ChucK it's GPL licensed)?
> 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.
> Merry Christmas,
> Arve
> _______________________________________________
> chuck-dev mailing list
> chuck-dev at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-dev/attachments/20140102/25f39145/attachment.html>

More information about the chuck-dev mailing list