ChucK on the web: NodeJS / HTML5
Has anyone had any experience with using ChucK in a web context? For example, two things I'd be interested in as a web developer: 1) streaming ChucK audio output from a NodeJS server to the browser 2) a javascript client-side ChucK implementation utilizing the Web Audio API Has there been any work on either of these? Matt Diamond
hum..
You might be able to stream the audio by hooking chuck into a
"streaming audio" server, using something like jack.
Implementing chuck using Web Audio API sounds very unrealistic to me.
anyway, am not representing the absolute truth here
2012/4/19 Matt Diamond
Has anyone had any experience with using ChucK in a web context? For example, two things I'd be interested in as a web developer:
1) streaming ChucK audio output from a NodeJS server to the browser 2) a javascript client-side ChucK implementation utilizing the Web Audio API
Has there been any work on either of these?
Matt Diamond
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Hi Matt,
Inspired by http://sketchpad.cc, I played around with integrating
Etherpad-lite (written on node) and ChucK. My intention was to stream it
using jack + darkice, but so far have only done it with my laptop acting as
the server and running the ChucK engine into speakers for a group to hear
in person. It's still fun to be able to collaborate on the same script in
realtime, and the browser is great for that.
Trying to reimplement the ChucK VM on a Javascript engine sounds slightly
nightmarish.
noah
On Fri, Apr 20, 2012 at 9:27 AM, henrique matias
hum..
You might be able to stream the audio by hooking chuck into a "streaming audio" server, using something like jack.
Implementing chuck using Web Audio API sounds very unrealistic to me.
anyway, am not representing the absolute truth here
2012/4/19 Matt Diamond
: Has anyone had any experience with using ChucK in a web context? For example, two things I'd be interested in as a web developer:
1) streaming ChucK audio output from a NodeJS server to the browser 2) a javascript client-side ChucK implementation utilizing the Web Audio API
Has there been any work on either of these?
Matt Diamond
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On Thu, Apr 19, 2012 at 6:10 PM, Matt Diamond
Has anyone had any experience with using ChucK in a web context? For example, two things I'd be interested in as a web developer:
1) streaming ChucK audio output from a NodeJS server to the browser 2) a javascript client-side ChucK implementation utilizing the Web Audio API
Has there been any work on either of these?
Links to these projects came up on the TOPLAP mailing list (worth subscribing and perhaps asking there too): http://livecoder.net/ http://www.charlie-roberts.com/gibber/ Some friends from undergrad made a collaborative browser-based ChucK editor that sounds like Noah's, though theirs was also not published. Someone should release something! At any rate, I've found the JavaScriptAudioNode interface to be fairly friendly and somewhat performant: https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html This experiment of mine works pretty well on my computer, though for some reason falls over on Windows without a much wider window size that kills interactivity: http://people.csail.mit.edu/tl/vocal/ http://people.csail.mit.edu/tl/vocal/audio.js It's a port of this ChucK script designed for joystick control: http://smelt.cs.princeton.edu/pieces/JoyOfChant/JoyOfChant.ck Anyway, running a virtual machine on top of Javascript in the audio callback would probably not work, but if you could compile the code to Javascript then you ought to be able to get away with a lot. Maybe extend CoffeeScript? (The only reason you'd want the compile step at all is that there's no easy way to emulate ChucK's syntax for yielding time because Javascript lacks continuation support in most implementations.) -- Tom Lieber http://AllTom.com/ http://infinite-sketchpad.com/
Hum, i couldn't expect less from chuck users. High level talk here.
About the syntax you might be able to workaround the time yielding
thing with a "pre-script-language"
For instance coffee Script ( The language Tom pointed ), has a
"runtime compiler" that would parse the code and convert to javascript
almost in no time..
On 20 April 2012 16:18, Tom Lieber
On Thu, Apr 19, 2012 at 6:10 PM, Matt Diamond
wrote: Has anyone had any experience with using ChucK in a web context? For example, two things I'd be interested in as a web developer:
1) streaming ChucK audio output from a NodeJS server to the browser 2) a javascript client-side ChucK implementation utilizing the Web Audio API
Has there been any work on either of these?
Links to these projects came up on the TOPLAP mailing list (worth subscribing and perhaps asking there too):
http://livecoder.net/ http://www.charlie-roberts.com/gibber/
Some friends from undergrad made a collaborative browser-based ChucK editor that sounds like Noah's, though theirs was also not published. Someone should release something!
At any rate, I've found the JavaScriptAudioNode interface to be fairly friendly and somewhat performant:
https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html
This experiment of mine works pretty well on my computer, though for some reason falls over on Windows without a much wider window size that kills interactivity:
http://people.csail.mit.edu/tl/vocal/ http://people.csail.mit.edu/tl/vocal/audio.js
It's a port of this ChucK script designed for joystick control:
http://smelt.cs.princeton.edu/pieces/JoyOfChant/JoyOfChant.ck
Anyway, running a virtual machine on top of Javascript in the audio callback would probably not work, but if you could compile the code to Javascript then you ought to be able to get away with a lot. Maybe extend CoffeeScript? (The only reason you'd want the compile step at all is that there's no easy way to emulate ChucK's syntax for yielding time because Javascript lacks continuation support in most implementations.)
-- Tom Lieber http://AllTom.com/ http://infinite-sketchpad.com/ _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
We can even use Emscripten to convert an entire C/C++ codebase to
JavaScript:
http://emscripten.org/
Currently I'm working on a livecoding environment for Web using Audiolet:
http://github.com/automata/vivace
@Tom, impressing demo. Please, let's keep in touch.
All the best.
Em 20 de abril de 2012 13:51, henrique matias
Hum, i couldn't expect less from chuck users. High level talk here.
About the syntax you might be able to workaround the time yielding thing with a "pre-script-language"
For instance coffee Script ( The language Tom pointed ), has a "runtime compiler" that would parse the code and convert to javascript almost in no time..
On 20 April 2012 16:18, Tom Lieber
wrote: On Thu, Apr 19, 2012 at 6:10 PM, Matt Diamond
wrote: Has anyone had any experience with using ChucK in a web context? For example, two things I'd be interested in as a web developer:
1) streaming ChucK audio output from a NodeJS server to the browser 2) a javascript client-side ChucK implementation utilizing the Web Audio API
Has there been any work on either of these?
Links to these projects came up on the TOPLAP mailing list (worth subscribing and perhaps asking there too):
http://livecoder.net/ http://www.charlie-roberts.com/gibber/
Some friends from undergrad made a collaborative browser-based ChucK editor that sounds like Noah's, though theirs was also not published. Someone should release something!
At any rate, I've found the JavaScriptAudioNode interface to be fairly friendly and somewhat performant:
https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html
This experiment of mine works pretty well on my computer, though for some reason falls over on Windows without a much wider window size that kills interactivity:
http://people.csail.mit.edu/tl/vocal/ http://people.csail.mit.edu/tl/vocal/audio.js
It's a port of this ChucK script designed for joystick control:
http://smelt.cs.princeton.edu/pieces/JoyOfChant/JoyOfChant.ck
Anyway, running a virtual machine on top of Javascript in the audio callback would probably not work, but if you could compile the code to Javascript then you ought to be able to get away with a lot. Maybe extend CoffeeScript? (The only reason you'd want the compile step at all is that there's no easy way to emulate ChucK's syntax for yielding time because Javascript lacks continuation support in most implementations.)
-- Tom Lieber http://AllTom.com/ http://infinite-sketchpad.com/ _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- Vilson Vieira vilson@void.cc ((( http://automata.cc ))) ((( http://musa.cc ))) ((( http://labmacambira.sourceforge.net )))
On Fri, Apr 20, 2012 at 02:02:57PM -0300, Vilson Vieira wrote:
We can even use Emscripten to convert an entire C/C++ codebase to JavaScript:
While I find the choices made in ChucK that lead to the relatively high cpu usage quite defensible, I think those make ChucK a bad candidate for such antics... What I'd do if I were motivated; Create a custom build of ChucK; focussed on livecoding so no hid, no audio in, etc. Harden it by disabling stuff that writes to the disk to protect your server and also make sure it can only read from a given directory. Probably also limit the amount of memory a shred or user can allocate. Have this accept scripts from a editor on your site. Stream the result using some online radio streamer and have this available on the same page as the editor. Add a second field for chat. That way you keep client-side CPU usage way down, putting it in the reach of devices like netbooks and smartphones. For bonus points; pre-load a public class to act as a shared clock event and have a version of the "busses" trick to share audio, for example so I can generate some sound and send it to your bus so you can treat it before we all hear it. You may also need some custom stuff to make sure the result of failed attempts at compiling code only ends up with the person writing the code. That'd be fun but personally I'd wait a bit and hope the current situation where many simple syntax errors lead to full-on seg-faulting clears up a bit. Yours, Kas.
My mom told me to never talk to hackers, i guess i'll have to leave
those chuck lists
On 20 April 2012 18:22, Kassen
On Fri, Apr 20, 2012 at 02:02:57PM -0300, Vilson Vieira wrote:
We can even use Emscripten to convert an entire C/C++ codebase to JavaScript:
While I find the choices made in ChucK that lead to the relatively high cpu usage quite defensible, I think those make ChucK a bad candidate for such antics...
What I'd do if I were motivated;
Create a custom build of ChucK; focussed on livecoding so no hid, no audio in, etc. Harden it by disabling stuff that writes to the disk to protect your server and also make sure it can only read from a given directory. Probably also limit the amount of memory a shred or user can allocate. Have this accept scripts from a editor on your site. Stream the result using some online radio streamer and have this available on the same page as the editor. Add a second field for chat.
That way you keep client-side CPU usage way down, putting it in the reach of devices like netbooks and smartphones. For bonus points; pre-load a public class to act as a shared clock event and have a version of the "busses" trick to share audio, for example so I can generate some sound and send it to your bus so you can treat it before we all hear it. You may also need some custom stuff to make sure the result of failed attempts at compiling code only ends up with the person writing the code.
That'd be fun but personally I'd wait a bit and hope the current situation where many simple syntax errors lead to full-on seg-faulting clears up a bit.
Yours, Kas. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On Fri, Apr 20, 2012 at 06:26:22PM +0100, henrique matias wrote:
My mom told me to never talk to hackers, i guess i'll have to leave those chuck lists
Well, when I organise a event there is always some chance that a few dozen thirsty people show up. So; I tend to try to make sure the power-tools a back in storage before the door and the beers open. That's not about being paranoid, people who intend harm are a) fairly rare and b) nearly impossible to prepare for. It's more about making sure the playground a fairly safe so everyone can just have fun without anyone (especially me) needing to worry too much. Make sense? Kas.
On Fri, Apr 20, 2012 at 02:44:49PM -0300, Lucas Zawacki wrote:
Make sense?
It does and I agree with everything, except lack of audio in. That's cool to have in a live coding, or live performance environment.
Yes, but if the server is in -say- your shed and 5 people are logged in, then what would audio-in refer to? You could set up a mic if you have some especialy interesting environment at hand (say a forrest with birds). I'm all for live sampling and live treatment in livecoding, it was more of a practical issue. Kas.
On Fri, Apr 20, 2012 at 1:22 PM, Kassen
On Fri, Apr 20, 2012 at 02:02:57PM -0300, Vilson Vieira wrote:
We can even use Emscripten to convert an entire C/C++ codebase to JavaScript:
While I find the choices made in ChucK that lead to the relatively high cpu usage quite defensible, I think those make ChucK a bad candidate for such antics...
What I'd do if I were motivated;
Create a custom build of ChucK; focussed on livecoding so no hid, no audio in, etc. Harden it by disabling stuff that writes to the disk to protect your server and also make sure it can only read from a given directory. Probably also limit the amount of memory a shred or user can allocate. Have this accept scripts from a editor on your site. Stream the result using some online radio streamer and have this available on the same page as the editor. Add a second field for chat.
That way you keep client-side CPU usage way down, putting it in the reach of devices like netbooks and smartphones. For bonus points; pre-load a public class to act as a shared clock event and have a version of the "busses" trick to share audio, for example so I can generate some sound and send it to your bus so you can treat it before we all hear it. You may also need some custom stuff to make sure the result of failed attempts at compiling code only ends up with the person writing the code.
That'd be fun but personally I'd wait a bit and hope the current situation where many simple syntax errors lead to full-on seg-faulting clears up a bit.
There are also well-documented ways to intentionally and unintentionally crash ChucK that you may need to patch up. :-} -- Tom Lieber http://AllTom.com/ http://infinite-sketchpad.com/
participants (7)
-
henrique matias
-
Kassen
-
Lucas Zawacki
-
Matt Diamond
-
Noah Adler
-
Tom Lieber
-
Vilson Vieira