[Cs-dev] Csound on the Web and in Browsers
Date | 2013-11-01 15:53 |
From | Michael Gogins |
Subject | [Cs-dev] Csound on the Web and in Browsers |
Attachments | None None |
A bit of research shows that NPRuntime (used to be NPAPI) can be used to produce C++ DLLs that are callable from Web browsers and even scriptable. Also that Node.js has a facility node-ffi for calling C/C++ code from server-side JavaScript.
Questions for you all (especially Steven Yi): Are there better solutions for these uses, i.e. running Csound in a Web browser, and running Csound in a Web server? If so what are they?
Regards, Mike =========================== Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com |
Date | 2013-11-01 16:05 |
From | Steven Yi |
Subject | Re: [Cs-dev] Csound on the Web and in Browsers |
I've been working with Ed Costello in getting Csound to compile with Emscripten[1], which compiles to Javascript. We're both working on it off and on as time allows. We got Csound to compile and Ed wrote a test program that has sound output, using Web Audio API and using Csound to generate sounds. I think this is a more promising solution than plugins, as the browser makers are moving away from NPAPI. (Chrome is going to drop next year, I think Firefox will too) Some notes: 1. I'm running the emscripten generated libcsound64.js myself in node.js. 2. Currently there is an issue we're trying to sort out where the static init modules stuff is failing in the emscripten generated code, and it looks like it has to do with some issues related to function pointers 3. We had to modify Csound such that it would allow compiling even if you did not have pthreads. We did this with some changes to CMake and some modifications of source files to #ifdef around if pthreads was available or not. 4. The basic test Ed wrote allowed creating sounds, so I think that at least as a proof of concept it works. Still plenty of further research to do. 5. This system just generates Javascript, and therefore no plugins are necessary for a user to install. 6. No measurements on performance, but emscripten has a demo where they compiled the unreal game engine and have it working. 7. We're going to look at exposing the Csound C++ API. Emscripten has a tool call embind which acts a lot like Swig. I think the idea scenario has us writing javascript code much like we would for python in terms of using the csound API. That's the latest with that research, Ed and I will report once we get a bit further. If others are interested, we had done the csound changes in a private repo shared between us, but we could also create a feature branch in CS6 and apply our changes there. Thanks! steven [1] - http://www.emscripten.org On Fri, Nov 1, 2013 at 11:53 AM, Michael Gogins |
Date | 2013-11-01 16:16 |
From | Richard Dobson |
Subject | Re: [Cs-dev] Csound on the Web and in Browsers |
This is very exciting. For school education purposes (kids learning what "iteration" means, what a "while loop" is and so on), I would be more than happy to see a "simplified" or reduced version of Csound (in terms of both language and opcodes etc) if that can expedite these developments. Richard Dobson On 01/11/2013 16:05, Steven Yi wrote: > I've been working with Ed Costello in getting Csound to compile with > Emscripten[1], which compiles to Javascript. We're both working on it > off and on as time allows. We got Csound to compile and Ed wrote a > test program that has sound output, using Web Audio API and using > Csound to generate sounds. > > I think this is a more promising solution than plugins, as the browser > makers are moving away from NPAPI. (Chrome is going to drop next year, > I think Firefox will too) > > Some notes: > > 1. I'm running the emscripten generated libcsound64.js myself in node.js. > 2. Currently there is an issue we're trying to sort out where the > static init modules stuff is failing in the emscripten generated code, > and it looks like it has to do with some issues related to function > pointers > 3. We had to modify Csound such that it would allow compiling even if > you did not have pthreads. We did this with some changes to CMake and > some modifications of source files to #ifdef around if pthreads was > available or not. > 4. The basic test Ed wrote allowed creating sounds, so I think that at > least as a proof of concept it works. Still plenty of further > research to do. > 5. This system just generates Javascript, and therefore no plugins are > necessary for a user to install. > 6. No measurements on performance, but emscripten has a demo where > they compiled the unreal game engine and have it working. > 7. We're going to look at exposing the Csound C++ API. Emscripten has > a tool call embind which acts a lot like Swig. I think the idea > scenario has us writing javascript code much like we would for python > in terms of using the csound API. > > That's the latest with that research, Ed and I will report once we get > a bit further. If others are interested, we had done the csound > changes in a private repo shared between us, but we could also create > a feature branch in CS6 and apply our changes there. > > Thanks! > steven > ------------------------------------------------------------------------------ Android is increasing in popularity, but the open development platform that developers love is also attractive to malware creators. Download this white paper to learn more about secure code signing practices that can help keep Android apps secure. http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2013-11-01 17:45 |
From | Michael Gogins |
Subject | Re: [Cs-dev] Csound on the Web and in Browsers |
Attachments | None None |
I agree, this is well worth pursuing. And I hadn't forgotten your earlier mention of Emscripten to me! But I have people asking me for things like this that will work now. Best, Mike =========================== Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Fri, Nov 1, 2013 at 12:16 PM, Richard Dobson <richarddobson@blueyonder.co.uk> wrote: This is very exciting. For school education purposes (kids learning what |
Date | 2013-11-01 17:51 |
From | Steven Yi |
Subject | Re: [Cs-dev] Csound on the Web and in Browsers |
Attachments | None None |
I think with Emscripten, it has a facility to compile libs and allow library loading to work. I would out that I a nice to have category. Otherwise, we should be able to have all of lib csound in the release. So the same Csd that runs in android and iOS will run on JavaScript. As an end goal for first release, I think it would be nice to have a simple HTML interface that allows editing Orc and sco, and might even allow live coding. That should be reasonably easy to do if/when the other work goes through and we can do csound API calls easily from JS. Lots of possibilities and options to create educational sites! On Friday, November 1, 2013, Richard Dobson wrote: This is very exciting. For school education purposes (kids learning what |
Date | 2013-11-01 17:55 |
From | Steven Yi |
Subject | Re: [Cs-dev] Csound on the Web and in Browsers |
Attachments | None None |
For things that work now, for browser I don't think we have anything currently. For server, it would depend on server technology used, and I imagine any can at the least do like netcsound and do renders to disk running csound in a process, and Use use the API otherwise.your mention of node-ffi makes me wonder if we should do a JavaScript version of hue he API examples too. ;) As for timeline on Emscripten, it could be as early as next week that we have something to start testing generally with. But it all depends on how long it takes to figure out the static init issue, and the libcsnd6 wrapping.
On Friday, November 1, 2013, Michael Gogins wrote:
|
Date | 2013-11-01 19:30 |
From | Michael Gogins |
Subject | Re: [Cs-dev] Csound on the Web and in Browsers |
Attachments | None None |
An important question. Suppose you compile Csound to JavaScript using CLang/Emscripten. Suppose you load this .js file into a browser. Can other JavaScript in the browser then call the Csound API, e.g. to load a csd and perform it? What about file access? If the API calls are possible in JavaScript, then it would make sense to do algorithmic composition in JavaScript. Obviously anything the browser can do, server-side JavaScript can do also.
Best, Mike =========================== Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Fri, Nov 1, 2013 at 1:51 PM, Steven Yi <stevenyi@gmail.com> wrote: I think with Emscripten, it has a facility to compile libs and allow library loading to work. I would out that I a nice to have category. Otherwise, we should be able to have all of lib csound in the release. So the same Csd that runs in android and iOS will run on JavaScript. As an end goal for first release, I think it would be nice to have a simple HTML interface that allows editing Orc and sco, and might even allow live coding. That should be reasonably easy to do if/when the other work goes through and we can do csound API calls easily from JS. Lots of possibilities and options to create educational sites! |
Date | 2013-11-01 19:37 |
From | Steven Yi |
Subject | Re: [Cs-dev] Csound on the Web and in Browsers |
I think that's the goal, that you can call Csound via javascript as if it was a Swig wrapped language, i.e.: and yes, having algorithmic score generation should be supported. As for resources, Ed has looked at that a little bit and might be able to comment, as I have not really looked at that part. On Fri, Nov 1, 2013 at 3:30 PM, Michael Gogins |
Date | 2013-11-02 15:23 |
From | Edward Costello |
Subject | Re: [Cs-dev] Csound on the Web and in Browsers |
Attachments | None None None None |
Date | 2013-11-02 16:29 |
From | Michael Gogins |
Subject | Re: [Cs-dev] Csound on the Web and in Browsers |
Attachments | None None |
Thanks for the information. I am very interested in this project for many reasons. Can you get files from your computer's local filesystem into this Emscripten virtual filesystem? Or do you have to download them from the Internet?
Regards, Mike =========================== Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Sat, Nov 2, 2013 at 11:23 AM, Edward Costello <edwardcostello@gmail.com> wrote:
|
Date | 2013-11-02 16:59 |
From | Edward Costello |
Subject | Re: [Cs-dev] Csound on the Web and in Browsers |
Attachments | None None None None |
Date | 2013-11-02 17:01 |
From | Dave Seidel |
Subject | Re: [Cs-dev] Csound on the Web and in Browsers |
Attachments | None None |
It might be worth looking at what Fargo (http://fargo.io) and its smaller sibling at littleoutliner.com do. They are both 100% HTML5+JavaScript. The latter uses the HTML5 localStorage facility, and the former uses DropBox as a file store. - Dave On Sat, Nov 2, 2013 at 12:29 PM, Michael Gogins <michael.gogins@gmail.com> wrote:
|
Date | 2013-11-02 17:04 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Csound on the Web and in Browsers |
How did you solve the libsndfile dependency? On 2 Nov 2013, at 16:59, Edward Costello wrote: > Yes, the example I have opens a csd file on the computers local file system. > > -- > Edward Costello > > On Saturday 2 November 2013 at 17:29, Michael Gogins wrote: > >> Thanks for the information. I am very interested in this project for many reasons. >> >> Can you get files from your computer's local filesystem into this Emscripten virtual filesystem? Or do you have to download them from the Internet? >> >> Regards, >> Mike >> >> >> =========================== >> Michael Gogins >> Irreducible Productions >> http://michaelgogins.tumblr.com >> Michael dot Gogins at gmail dot com >> >> >> On Sat, Nov 2, 2013 at 11:23 AM, Edward Costello |
Date | 2013-11-02 17:21 |
From | Edward Costello |
Subject | Re: [Cs-dev] Csound on the Web and in Browsers |
Attachments | None None None None |