Csound on the Web Victor LAZZARINI and Edward COSTELLO and Steven YI and John FITCH Department of Music National University of Ireland Maynooth, Ireland, {[email protected], [email protected], [email protected], jpff@codemist.co.uk } Abstract 2 Audio Technologies for the Web The current state of audio systems for world- This paper reports on two approaches to provide a wide web applications is primarily based upon general-purposeaudioprogrammingsupportforweb applications based on Csound. It reviews the cur- three technologies: Java1, Adobe Flash2, and rent state of web audio development, and discusses HTML5 Web Audio3. Of the three, Java is the some previous attempts at this. We then introduce oldest.ApplicationsusingJavaaredeployedvia a Javascript version of Csound that has been crea- the web either as Applets4 or via Java Web ted using the Emscripten compiler, and discuss its Start5. Java as a platform for web applications features and limitations. In complement to this, we has lost popularity since its introduction, pri- look at a Native Client implementation of Csound, marily due to historically sluggish start-up ti- whichisafully-functionalversionofCsoundrunning mes as well as concerns over security breaches. in Chrome and Chromium browsers. Also of concern is that major browser vendors have either completely disabled Applet loading Keywords or disabled them by default, and that NPAPI plugin support, with which the Java plugin for Music Programming Languages; Web Applications; browsers is implemented, is planned to be drop- pedinfuturebrowserversions6.WhileJavasees 1 Introduction strong support on the server-side and desktop, its future as a web-deployed application is te- The web browser has become an increasingly nuous at best and difficult to recommend for viable platform for the creation and distributi- future audio system development. on of various types of media computing appli- Adobe Flash as a platform has seen large- cations[Wyse and Subramanian, 2013]. It is no scale support across platforms and across brow- surprisethataudioisanimportantpartofthese sers.Numerouslarge-scaleapplicationshavebe- developments.Foragoodwhilenowwehavebe- en developed such as AudioTool7, Patchwork8, en interested in the possibilities of deployment and Noteflight9. Flash developers can choose to of client-side Csound-based applications, in ad- deploy to the web using the Flash plugin, as dition to the already existing server-side capa- well as use Adobe Air10 to deploy to desktop bilities of the system. Such scenarios would be andmobiledevices.Whiletheseapplicationsde- ideal for various uses of Csound. For instance, monstrate what can be developed for the web in Education, we could see the easy deployment of Computer Music training software for all le- 1http://java.oracle.com vels, from secondary schools to third-level in- 2http://www.adobe.com/products/flashruntimes. stitutions. For the researcher, web applications html 3http://www.w3.org/TR/webaudio/ can provide an easy means of creating proto- 4http://docs.oracle.com/javase/tutorial/ types and demonstrations. Composers and me- deployment/applet/index.html dia artists can also benefit from the wide reach 5http://docs.oracle.com/javase/tutorial/ of the internet to create portable works of art. deployment/webstart/index.html In summary, given the right conditions, Csound 6http://blog.chromium.org/2013/09/ saying-goodbye-to-our-old-friend-npapi.html can provide a solid and robust general-purpose 7http://www.audiotool.com/ audio development environment for a variety of 8http://www.patchwork-synth.com uses. In this paper, we report on the progress 9http://www.noteflight.com towards supporting these conditions. 10http://www.adobe.com/products/air.html using Flash, the Flash platform itself has a Csound on the server is Oeyvind Brandtsegg’s number of drawbacks. The primary tools for VLBIMusic18,whereCsoundisrunningonthe Flash development are closed-source, commer- server and publishes its audio output to an au- cial applications that are unavailable on Linux, dio stream that end users can listen to. A simi- though open source Flash compilers and IDEs lar architecture is found in [Johannes and To- do exist11. There has been a backlash against shihiro, 2013]. Since version 6.02, Csound also Flash in browsers, most famously by Steve Jobs includes a built-in server, that can be activa- andApple12,andthetechnologystackasawho- ted through an option on start up. The server le has seen limited development with the gro- is able to receive code directly through UDP wing popularity of HTML5. At this time, Flash connections and compile them on the fly. may be a viable platform for building audio ap- Using Csound server-side has both positives plications,buttheuncertainfuturemakesitdif- and negatives that should be evaluated for a ficult to recommend. project’s requirements. It can be appropriate to Finally, HTML5 Web Audio is the most re- useiftheproject’sdesigncallsforasingleaudio cent of technologies for web audio applications. stream/Csound instance that is shared by all Examplesincludethe“Recreatingthesoundsof listeners. In this case, users might interact with the BBC Radiophonic Workshop using the Web the audio system over the web, at the expen- Audio API” site13, Gibberish14, and WebPd15. se of network latency. Using multiple realtime Unlike Java or Flash, which are implemented Csound instances, as would be the case if there as browser plug-ins, the Web Audio API is a was one per user, would certainly be taxing for W3Cproposedstandardthatisimplementedby a single server and would require careful resour- the browser itself.16 Having built-in support for ce limiting. For multiple non-realtime Csound Audio removes the security issues and concerns instances, as in the case of NetCsound, multi- over the future of plug-ins that affect Java and ple jobs may be scheduled and batch processed Flash.However,theWebAudioAPIhaslimita- with less problems than with realtime systems, tions that will be explored further below in the though resource management is still a concern. section on Emscripten. An early project to employ client-side audio computationbyCsoundwasdescribedin[Casey 3 Csound-based Web Application and Smaragdis, 1996], where a sound and music Design description system was proposed for the rende- ring of network-supplied data streams. A possi- Csound is a music synthesis system that has bly more flexible way to use Csound in client- roots in the very earliest history of computer side applications, however, is to use the web music. Csound use in Desktop and Mobile app- browserasaplatform.Twoattemptsatthisha- lications has been discussed previously in [Laz- vebeenmadeinthepast.Thefirstwasthenow- zarini et al., 2012b], [Yi and Lazzarini, 2012], defunct ActiveX Csound (also known as AXC- and [Lazzarini et al., 2012a]. sound)19,whichallowedembeddingCsoundinto Prior to the technologies presented this pa- awebpageasanActiveXObject.Thistechnolo- per, Csound-based web applications have em- gy is no longer maintained and was only availa- ployed Csound mostly on the server-side. For example, NetCsound 17 allows sending a CSD ble for use on Windows with Internet Explo- rer. A second attempt was made in the Mobile file to the server, where it would render the CsoundProject[Lazzarinietal.,2012b],wherea project to disk and email the user a link to proof-of-concept Csound-based application was the rendered file when complete. Another use of developed with Java and deployed using Java 11http://www.flashdevelop.org/ Web Start, achieving client-side Csound use via 12http://www.apple.com/hotnews/ the browser. However, the technology required thoughts-on-flash/ specialpermissionstorunontheclientsideand 13http://webaudio.prototyping.bbc.co.uk/ required Java to be installed. Due to those issu- 14Available at https://github.com/ es and the unsure future of Java over the web, charlieroberts/Gibberish, discussed in [Roberts et al., 2013] 15https://github.com/sebpiq/WebPd 18http://www.researchcatalogue.net/view/55360/ 16http://caniuse.com/audio-apilistscurrentbrow- 55361 sers that support the Web Audio API 19Wewereunabletofindacopyofthisonline,butone 17Available at http://dream.cs.bath.ac.uk/ isavailablefromtheCD-ROMincludedwith[Boulanger, netcsound/, discussed in [ffitch et al., 2007] 2000] the solution was not further explored. semantic emulation in order to achieve the best The two systems described in this paper are execution performance [Zakai, 2011]. browser-based solutions that run on the client- Implementations of the C and C++ runti- side. The both share the following benefits: me libraries have been created for applicati- onscompiledwithEmscripten.Theseallowpro- • Csound has a large array of signal proces- grams written in C/C++ to transparently per- sing opcodes made immediately available form common tasks such as using the file sys- to web-based projects. tem,allocatingmemoryandprintingtothecon- sole. Emscripten allows a virtual filesystem to • They are compiled using the same source be created using its FS library, which is used code as is used for the desktop and mo- by Emscripten’s libc and libcxx for file I/O21. bile version of Csound. They only require Files can be added or removed from the virtual recompiling to keep them in sync with the filesystem using Javascript helper functions. It latest Csound features and bug fixes. is also possible to directly call C functions from • Csound code that can be run with the- Javascript using Emscripten22. These functions se browser solutions can be used on other must first be named at compile time so they platforms. Audio systems developed using are not optimised out of the resulting compi- Csound code is then cross-platform across led Javascript code. The required functions are the web, desktop, mobile, and embed- then wrapped using Emscripten’s cwrap functi- ded systems (i.e. Raspberry Pi, Beaglebo- on, and assigned to a Javascript function name. ne; discussed in [Batchelor and Wignall, The cwrap function allows many Javascript va- 2013]).Developerscanreusetheiraudioco- riablestobeusedtransparentlyasargumentsto defromtheirweb-basedprojectselsewhere, C functions, such as passing Javascript strings and vice versa. tofunctionswhichrequiretheClanguagesconst char array type. 4 Emscripten Although Emscripten can successfully compi- Emscripten is a a project created by Alon Za- le a large section of C/C++ code there are still kai at the Mozilla Foundation that compiles the a number of limitations to this approach due to assembly language used by the LLVM compi- limitations within the Javascript language and ler into Javascript [Zakai, 2011]. When used in runtime. As Javascript doesn’t support threa- combination with LLVM’s Clang frontend, Em- ding, Emscripten is unable to compile codeba- scripten allows applications written in C/C++ ses that make use of threads. Some concurrency or languages that use C/C++ runtimes to be is possible using web workers, but they do not run directly in web browsers. This eliminates sharestate.Itisalsonotpossibletodirectlyim- the need for browser plugins and takes full ad- plement64-bitintegersinJavascriptasallnum- vantage of web standards that are already in bers are represented using 64-bit doubles. This common use. results in a risk of rounding errors being intro- In order to generate Javascript from C/C++ duced to the compiled Javascript when perfor- sourcecode the codebase is first compiled into ming arithmetic operations with 64-bit integers LLVM assembly language using LLVM’s Clang [Zakai, 2011]. frontend. Emscripten translates the resulting LLVMassemblylanguageintoJavascript,speci- 4.1 CsoundEmscripten ficallyanoptimisedsubsetofJavascriptentitled CsoundEmscripten is an implementation of the asm.js. The asm.js subset of Javascript is inten- Csound language in Javascript using the Ems- ded as a low-level target language for compilers cripten compiler. A working example of Csoun- and allows a number of optimisations which are dEmscripten can be found at http://eddyc. not possible with standard Javascript20. Code github.io/CsoundEmscripten/. The compiled semantics which differ between Javascript and Csound library and CsoundObj Javascript class LLVM assembly can be emulated when accu- can be found at https://github.com/eddyc/ rate code is required. Emscripten has built-in CsoundEmscripten/. CsoundEmscripten con- methods to check for arithmetic overflow, si- gning issues and rounding errors. If emulation 21https://github.com/kripken/emscripten/wiki/ is not required, code can be translated without Filesystem-API 22https://github.com/kripken/emscripten/wiki/ 20http://asmjs.org/spec/latest/ Interacting-with-code sists of three main modules: buffer. It takes as its arguments: a pointer to the CsoundObj structure self, an integer • The Csound library compiled to Javascript inNumberFrames specifying the number using Emscripten. of samples to be copied, a pointer to a • A structure and associated functions writ- buffer containing the input samples named ten in C named CsoundObj implemented inputBuffer and a pointer to a destination on top of the Csound library that is com- buffer to copy the output samples named piled to Javascript using Emscripten. outputBuffer. • A handwritten Javascript class also named Each of the other functions that use the Cso- CsoundObj that contains the public in- undObj structure simply wrap existing functi- terface to CsoundEmscripten. The Javas- ons present in the Csound C API. The relevant cript class both wraps the compiled Cso- functions are: undObj structureandassociatedfunctions, and connects the Csound library to the • csoundGetKsmps(csound) - This function Web Audio API. takes as its argument a pointer to an in- stance of Csound and returns the number 4.1.1 Wrapping the Csound C API for of specified audio frames per control sam- use with Javascript ple. In order to simplify the interface between the Csound C API and the Javascript class contai- • csoundGetNchnls(csound) - This functi- ning the CsoundEmscripten public interface, a on takes as its argument a pointer to an structure named CsoundObj and a number of instance of Csound and returns the num- functions which use this structure were created. ber of specified audio output channels. The structure contains a reference to the cur- • csoundGetNchnlsInput(csound) - This rentinstanceofCsound,areferencetoCsound’s function takes as its argument a pointer input and output buffer, and Csound’s 0dBFS to an instance of Csound and returns the value. Some of the functions that use this struc- number of specified audio input channels. ture are: • csoundStop(csound)-Thisfunctiontakes • CsoundObj_new() - This function alloca- as its argument a pointer to an instance tes and returns an instance of the Csound- of Csound stops the current performance Obj structure. It also initialises an instan- pass. ce of Csound and disables Csound’s default • csoundReset(csound) - This function ta- handling of sound I/O, allowing Csound’s kesasitsargumentapointertoaninstance input and output buffers to be used direct- of Csound and resets its internal memory ly. and state in preparation for a new perfor- • CsoundObj_compileCSD(self, mance. filePath, samplerate, controlrate, buffersize) - This function is used • csoundSetControlChannel(csound, to compile CSD files, it takes as its name, val) - This function takes as its arguments: a pointer to the CsoundObj arguments: a pointer to an instance of structure self, the address of a CSD file Csound, a string given by name, and given by filePath, a specified sample rate number given by val, it sets the numerical given by samplerate, a specified control value of a Csound control channel specified rate given by controlrate and a buffer by the string name. size given by buffersize. The CSD file at The CsoundObj structure and associated the given address is compiled using these functions are compiled to Javascript using Em- arguments. scripten and added to the compiled Csound Ja- • CsoundObj_process(self, vascript library. Although this is not necessary, inNumberFrames, inputBuffer, keeping the compiled CsoundObj structure and outputBuffer) - This function copies functions in the same file as the Csound library audio samples to Csound’s input buffer makes it more convenient when including Cso- and copies samples from Csound’s output undEmscripten within web pages. 4.1.2 The CsoundEmscripten cessorNode and stops the audio process Javascript interface callback. If required this method also dis- ThelastcomponentofCsoundEmscriptenisthe connects any audio inputs. CsoundObj Javascript class. This class provi- • addControlChannel(name, des the public interface for interacting with the initialValue) This method adds an compiled Csound library. As well as allocating object to a Javascript array that is used an instance of Csound this class provides me- to update Csound’s named channel values. thods for controlling performance and setting Each object contains a string value given the values of Csound’s control channels. Addi- byname,afloatvaluegivenbyinitialValue tionally, this class interfaces with the Web Au- andadditionallyabooleanvalueindicating dio API, providing Csound with samples from whether the float value has been updated. the audio input bus and copying samples from • setControlChannelValue(name, value) Csound to the audio output bus. Audio I/O This method sets a named control channel andtheCsoundprocessareperformedinJavas- given by the string name to the specified cript using the Web Audio API’s ScriptProces- number given by the value argument. sorNode.Thisnodeallowsdirectaccesstoinput and output samples in Javascript allowing au- • getControlChannelValue(name) This dio processing and synthesis using the Csound method returns the current value of a library. named control channel given by the string Csound can be used in any webpage by crea- name. ting an instance of CsoundObj and calling the 4.1.3 Limitations availablepublicmethodsinJavascript.Theme- Using CsoundEmscripten, it is possible to add thods available in the CsoundObj class are: Csound’s audio processing and synthesis capa- • compileCSD(fileName) This method ta- bilities to any web browser that supports the kes as its argument the address of a CSD Web Audio API. Unfortunately this approach file fileName and compiles it for perfor- of bringing Csound to the web comes with a mance. The CSD file must be present in number of drawbacks. Emscripten’s virtual filesystem. This me- Although Javascript engines are constant- thod calls the compiled C function Csoun- ly improving in speed and efficiency, running dObj compileCSD. It also creates a Script- Csound entirely in Javascript is a processor in- ProcessorNode instance for Audio I/O. tensive task on modern systems. This is especi- • enableAudioInput()Thismethodenables allytroublesomewhentryingtorunevenmode- audio input to the web browser. When cal- rately complex CSD files on mobile computing led,ittriggersapermissionsdialogueinthe devices. host web browser requesting permission to Another limitation is due to the design of allow audio input. If permission is gran- the ScriptProcessorNode part of the Web Au- ted,audioinputisavailablefortherunning dio API. Unfortunately, the ScriptProcessorNo- Csound instance. de runs on the main thread. This can result in audio glitching when another process on the • startAudioCallback() This method main thread—such as the UI—causes a delay in connects the ScriptProcessorNode to the audioprocessing.AspartoftheW3CsWebAu- audio output and, if required, the audio dio Spec review it has been suggested that the input. The ScriptProcessorNodes audio ScriptProcessorNode be moved off of the main processing callback is also started. During thread23. There has also been a resolution by each callback, if required, audio samples the Web Audio API developers that they will from the ScriptProcessorNodes input are make it possible to use the ScriptProcessorNo- copied into Csound’s input buffer and any de with web workers24. Hopefully in a future new values for Csound’s software channels version of the Web Audio API the ScriptPro- are set. Csound’s csoundPerformKsmps() cessorNode will be more capable of running the function is called and any output samples are copied into the ScriptProcessorNodes 23https://github.com/w3ctag/ output buffer. spec-reviews/blob/master/2013/07/WebAudio. md#issue-scriptprocessornode-is-unfit-for-purpose-section-15 • stopAudioCallback() This method dis- 24https://www.w3.org/Bugs/Public/show_bug.cgi? connects the current running ScriptPro- id=17415#c94 kindcomplexaudioprocessingandsynthesisca- Csound, the pthread library. However, absent pabilities allowed by the Csound library. from the PNaCl toolchain are dlopen() and fri- This version of Csound also does not support ends,whichmeansnodynamicloadingisavaila- plugins, making some opcodes unavailable. Ad- ble there. ditionally,MIDII/Oisnotcurrentlysupported. Javascript client-side code is responsible for This is not due to the technical limitations of requesting the loading of a NaCl module. On- Emscripten, rather it was not implemented due ce the module is loaded, execution is controlled to the current lack of support for the WebMIDI through Javascript event listeners and messa- standardinMozillaFirefox25 andintheWebkit ge passing. A postMessage() method is used by library26. PeppertoallowcommunicationfromJavascript to PNaCl module, triggering a message handler 5 Beyond Web Audio: Creating in the C/C++ side. In the opposite direction, a Audio Applications with PNaCl message eventisissuedwhenC/C++codecalls As an alternative to the development of audio the equivalent PostMessage() function. applications for web deployment in pure Javas- Audio output is well supported in Pepper cript, it is possible to take advantage of the Na- with a mid-latency callback mechanism (ca. 10- tive Clients (NaCl) platform27. This allows the 11ms, 512 frames at 44.1 or 48 KHz sampling use of C and C++ code to create components rate). Its performance appears to be very uni- that are accessible to client-side Javascript, and form across the various platforms. The Audio run natively inside the browser. NaCl is descri- APIdesignisverystraightforward,althoughthe bedasasandboxingtechnology,asitprovidesa library is a little rigid in terms of parameters. It safe environment for code to be executed, in an supports only stereo at one of the two sampling OS-independent manner [Yee et al., 2009] [Sehr rates mentioned above). Audio input is not yet et al., 2010]. This is not completely unlike the available in the production release, but support use of Java with the Java Webstart Technology can already be seen in the development reposi- (JAWS), which has been discussed elsewhere in tory. relation to Csound [Lazzarini et al., 2012b]. The most complex part of NaCl is access to There are two basic toolchains in NaCl: nati- the local files. In short, there is no open access ve/gcc and PNaCl [Donovan et al., 2010]. Whi- to the client disk, only to sandboxed filesys- le the former produces architecture-dependent tems. It is possible to mount a server filesystem code (arm, x86, etc.), the latter is completely (through httpfs), a memory filesystem (memfs), independent of any existing architecture. NaCl as well as local temporary or permanent file- is currently only supported by the Chrome and systems (html5fs). For those to be useful, they Chromium browsers. Since version 31, Chrome can only be mounted and accessed through the enablesPNaClbydefault,allowingapplications NaCl module, which means that any copying created with that technology to work complete- of data from the user disk into these partitions ly out-of-the-box. While PNaCl modules can be has to be mediated by code written in the NaCl served from anywhere in the open web, native- module. For instance, it is possible to take ad- toolchain NaCl applications and extensions can vantage of the file HTML5 tag and to get data only be installed from Google’s Chrome Web from NaCl into a Javascript blob so that it can Store. be saved into the user’s disk. It is also possible 5.1 The Pepper Plugin API to copy a file from disk into the sandbox using the URLReader service supplied by Pepper. An integral part of NaCl is the Pepper Plu- gin API (PPAPI, or just Pepper). It offers va- 5.2 PNaCl rious services, of which interfacing with Javas- cript and accessing the audio device is particu- The PNaCl toolchain compiles code down to larly relevant to our ends. All of the toolchains a portable bitcode executable (called a pexe). also include support for parts of the standard Whenthisisdeliveredtothebrowser,anahead- C library (eg. stdio), and very importantly for of-timecompilerisusedtotranslatethecodein- to native form. A web application using PNaCl 25https://bugzilla.mozilla.org/show_bug.cgi? will contain three basic components: the pexe id=836897 binary,amanifestfiledescribingit,andaclient- 26https://bugs.webkit.org/show_bug.cgi?id= sidescriptinJS,whichloadsandallowsinterac- 107250 27https://developers.google.com/native-client tion with the module via the Pepper messaging system. As it starts, the PNaCl module will call a moduleDidLoad()function,ifitexists.Thiscan 5.3 Csound for PNaCl bedefinedintheapplicationscript.Alsothefol- AfullyfunctionalimplementationofCsoundfor lowing callbacks are also definable: Portable Native Clients is available from http: //vlazzarini.github.io.Thepackageiscom- • function handleMessage(message): cal- posed of three elements: the Javascript modu- led when there are messages from Csound le (csound.js), the manifest file (csound.nmf), (pnacl module). The string message.data and the pexe binary (csound.pexe). The sour- contains the message. ce for the PNaCl component is also available • function attachListeners(): this is cal- from that site (csound.cpp). It depends on the led when listeners for different events are Csound and Libsndfile libraries compiled for to be attached. PNaClandtheNaCLsdk.AMakefileforPNaCl exists in the Csound 6 sources. In addition to Csound-specific controls, the 5.3.1 The Javascript interface module also includes a number of filesystem fa- Users of Csound for PNaCl will only inter- cilities, to allow the manipulation of resources act with the services offered by the Javascript in the server and in the sandbox: module. Typically an application written in HTML5 will require the following elements to • csound.CopyToLocal(src, dest)-copies use it: the file src in the ORIGIN directory to the localfiledest,whichcanbeaccessedat./lo- • the csound.js script cal/dest.The“Complete”messageisissued on completion. • a reference to the module using a div tag with id=“engine” • csound.CopyUrlToLocal(url,dest) - co- pies the url url to the local file dest, which • a script containing the code to control can be accessed at ./local/dest. Current- Csound. ly only ORIGIN and CORS urls are allo- wed remotely, but local files can also be The script will contain calls to methods in passed if encoded as urls with the web- csound.js, such as: kitURL.createObjectURL() javascript me- thod.The“Complete”messageisissuedon • csound.Play() - starts performance completion. • csound.PlayCsd(s) - starts performance • csound.RequestFileFromLocal(src) - from a CSD file s, which can be in ./http/ requests the data from the local file src. (ORIGIN server) or ./local/ (local sand- The “Complete” message is issued on box). completion. • csound.RenderCsd(s)-rendersaCSDfile • csound.GetFileData() - returns the most s,whichcanbein./http/(ORIGINserver) recently requested file data as an ArrayOb- or ./local/ (local sandbox), with no RT au- ject. dio output. The “finished render” message is issued on completion. A series of examples demonstrating this API • csound.Pause() - pauses performance isprovidedingithub.Inparticular,anintroduc- tory example is found on http://vlazzarini. • csound.CompileOrc(s) - compiles the github.io/minimal.html. Csound code in the string s 5.3.2 Limitations • csound.ReadScore(s) - reads the score in The following limitations apply to the current the string s (with preprocessing support) release of Csound for PNaCl: • csound.Event(s)-sendsinthelineevents containedinthestrings (nopreprocessing) • no realtime audio input (not supported yet in Pepper/NaCl) • csound.SetChannel(name, value) - sends the control channel name the value • no MIDI in the NaCl module. However, it value, both arguments being strings. might be possible to implement MIDI in JavaScript (through WebMIDI), and using John ffitch, James Mitchell, and Julian Pad- the csound.js functions, send control da- get. 2007. Composition with sound web ser- ta to Csound, and respond to the various vices and workflows. In Suvisoft Oy Ltd, channel messages. editor, Proceedings of the 2007 International Computer Music Conference, volume I, pages • no plugins, as pNaCl does not support 419–422. ICMA and Re:New, August. ISBN dlopen() and friends. This means some 0-9713192-5-1. Csound opcodes are not available as they reside in plugin libraries. It might be possi- Tarmo Johannes and Kita Toshihiro. 2013. ble to add some of these opcodes statically V`a, pensiero!“ - Fly, thought! Experi- ” to the Csound pNaCl library in the future. ment for interactive internet based piece using Csound6 . http://tarmo.uuu. 6 Conclusions ee/varia/failid/cs/pensiero-files/ pensiero-presentation.pdf. Accessed: In this paper we reviewed the current state of February 2nd, 2014. support for the development of web-based au- Victor Lazzarini, Steven Yi, and Joseph Ti- dio and music applications. As part of this, we money. 2012a. Digitalaudioeffectsonmobile explored two approaches in deploying Csound platforms. In Proceedings of DAFx 2012. as an engine for general-purpose media softwa- re. The first consisted of a Javascript version VictorLazzarini,StevenYi,JosephTimoney, created with the help of the Emscripten com- Damian Keller, and Marco Pimenta. 2012b. piler, and the second a native C/C++ port for The Mobile Csound Platform. In Proceedings the Native Client platform, using the Portable of ICMC 2012. NativeClienttoolchain.Thefirsthastheadvan- Charles Roberts, Graham Wakefield, and tage of enjoying widespread support by a varie- MatthewWright. 2013. TheWebBrowserAs ty of browsers, but is not yet fully deployable. Synthesizer And Interface. Proceedings of the On the other hand, the second approach, whi- International Conference on New Interfaces le at the moment only running on Chrome and for Musical Expression. Chromium browsers, is a robust and ready-for- production version of Csound. David Sehr, Robert Muth, Cliff Bife, Victor Khimenko,EgorPasko,KarlSchimpf,Bennet 7 Acknowledgements Yee, and Brad Chen. 2010. Adapting Softwa- re Fault Isolation to Contemporary CPU Ar- ThisresearchwaspartlyfundedbytheProgram chitectures. In 19th USENIX Security Sym- of Research in Third Level Institutions (PRTLI posium. 5) of the Higher Education Authority (HEA) of Ireland, through the Digital Arts and Humani- Lonce Wyse and Srikumar Subramanian. ties programme. 2013. The Viability of the Web Browser as a Computer Music Platform. Computer Mu- References sic Journal, 37(4):10–23. Paul Batchelor and Trev Wignall. 2013. Be- Bennet Yee, David Sehr, Gregory Dardyk, aglePi: An Introductory Guide to Csound on J.BradleyChen,RobertMuth,TavisOrman- theBeagleBoneandtheRaspberryPi,aswell dy, Shiki Okasaka, Neha Narula, and Nicho- other Linux-powered tinyware. Csound Jour- las Fullagar. 2009. Native Client: A Sandbox nal, (18). for Portable, Untrusted x86 Native Code. In 2009 IEEE Symposium on Security and Pri- Richard J. Boulanger, editor. 2000. The vacy. Csound Book: Tutorials in Software Synthesis and Sound Design. MIT Press, February. StevenYiandVictorLazzarini. 2012. Csound for Android. In Linux Audio Conference, vo- Michael Casey and Paris Smaragdis. 1996. lume 6. Netsound. In On the Edge. ICMA and Alon Zakai. 2011. Emscripten: an llvm-to- HKUST, August. javascript compiler. In Proceedings of the AlanDonovan,RobertMuth,BradChen,and ACM international conference companion on David Sehr. 2010. PNaCl: Portable Native Object oriented programming systems langua- Client Executables. Google White Paper. ges and applications, pages 301–312. ACM.