A Free Open-Source Mobile App for Multi-Touch Interaction with Faust Generated Modules Hyung-Suk Kim, Julius Smith
Total Page:16
File Type:pdf, Size:1020Kb
FaustPad : A free open-source mobile app for multi-touch interaction with Faust generated modules Hyung-Suk Kim, Julius Smith To cite this version: Hyung-Suk Kim, Julius Smith. FaustPad : A free open-source mobile app for multi-touch interaction with Faust generated modules. Proceedings of the 10th International Linux Audio Conference (LAC- 12), Apr 2012, Stanford, United States. hal-03162971 HAL Id: hal-03162971 https://hal.archives-ouvertes.fr/hal-03162971 Submitted on 8 Mar 2021 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. FaustPad : A free open-source mobile app for multi-touch interaction with Faust generated modules Hyung-Suk Kim Julius O. Smith Dept. of Electrical Engineering, Center for Computer Research in Music and Stanford University Acoustics. Palo Alto, CA 94305, USA (CCRMA) Stanford University [email protected] Palo Alto, CA 94305, USA [email protected] Abstract Mobile devices have become computationally In this paper we introduce a novel interface for powerful enough for audio synthesis directly on the mobile devices enabling multi-touch interaction with device. The MoMu toolkit [2] used by the Stanford sound modules generated with Faust1 (Functional Mobile Phone Orchestra (MoPho) is a toolkit for Audio Stream) and run in SuperCollider. The music synthesis on iOS devices. Unfortunately most interface allows a streamlined experience for audio SDKs for mobile devices are OS dependent, experimentation and exploration of sound design. requiring separate learning for each new mobile OS. The computation power of mobile devices is still Keywords limited compared to desktop systems. Computationally complex modules are hard to run Faust, mobile music, SuperCollider, music app. on mobile devices. Mobile devices can be used as a music controller 1 Introduction via OSC. TouchOSC, Control OSC2 are examples. Faust (Functional Audio Stream)[1] is a functional Such apps are general purpose OSC controllers that domain-specific language for real-time signal are highly customizable. The price of customizability processing and synthesis. Programs written in Faust is that it takes time to set up a module. This can are translated in to highly efficient C++ code which become very cumbersome if the sound module has a can then be compiled into modules for various lot of controls. Physical modeling synthesis architectures and synthesis environments including programs can easily have over 20 parameters which SuperCollider, PureData and Chuck. Faust separates can be very time consuming to setup. the specification from the underlying implementation In this paper we present an OSC music controller and the UI, allowing the programmer to focus on the app, FaustPad,3 that automatically creates the design of signal processing or synthesis modules. interface and necessary OSC settings based on the Quick testing of a module is possible by compiled results from Faust. This approach reduces compiling the program as a standalone program. the complicated setup process, allowing a However integrating a UI for a synthesis streamlined experience for experimenting with the environment such as SuperCollider or PureData is generated sound module. not that trivial. In either case, the user interaction is limited to mouse-pointer interaction. 2 Overview Mobile devices introduce a tangible, interactive Setting up a module for interaction requires the experience compared to that of the traditional following steps: 1) compiling the program with desktop. Recent mobile devices, i.e. smart phones, Faust, 2) setting up the synthesis environment, and 3) enable multi-touch interaction as well as other setting up the mobile device. features, e.g. accelerometer, GPS, gyroscope, which allow novel methods of interacting with sound. 2http://charlie-roberts.com/Control/ 3Code and documentation for FaustPad, can be found at 1http://faust.grame.fr/ https://github.com/hskim08/FaustPad SynthDef.new("sitar", { arg freq = 440.0, gain = 1.0, gate = 0.0, resonance = 0.7, damp = 0.72, roomsize = 0.54, wet = 0.141, pan_angle = 0.6, spatial_width = 0.5; Out.ar(0, FaustSitar.ar(freq, gain, gate, resonance, damp, roomsize, wet, pan_angle, spatial_width)); }).load(s); Figure 2: Output example of FaustScParser. It is easy to import custom synthesis modules into SuperCollider as “extensions” by copying the .sc Figure 1: Overview flowchart of FaustPad setup. The and .scx files into the SuperCollider extension file in parentheses may change depending on the folder. environment used. Here we show the case for a Synth definition (SynthDef) files need to be SuperCollider Extension. defined and loaded to create instances of the synth modules. Control parameter names are also defined In this paper we cover setting up a Faust synthesis in the SynthDef files. The parameter names of the module with SuperCollider. In the last section we SynthDef files must match those of the app. This can look at an example of installing all the modules in be achieved by parsing the UI definition XML-file Faust-STK[3], the Synthesis Toolkit port for Faust. from Faust to create the SynthDef file. The Java We use Faust to create a SuperCollider extension project in the FaustPad github repository creates an which is loaded into scsynth, the SuperCollider executable jar-file, FaustScParser.jar, that does this. server. FaustPad is used as an alternative scsynth In sclang, a SynthDef is compiled into byte client, replacing sclang, the SuperCollider code which is then sent to scsynth as an OSC interpreter. message. As of the time of writing the SynthDef needs to be loaded once manually by the script 3 Compiling with Faust created by the FaustScParser. Once loaded the SynthDef is saved on the server and will be loaded Recent Faust releases include scripts to compile each time scsynth boots. We plan to port programs into various environments. For SynthDef compiling into FaustPad to further reduce SuperCollider extensions, we used the setup process. faust2supercollider to create a SuperCollider class file (.sc) and a SuperCollider 5 FaustPad extension (.scx). The Faust compiler can create an abstract “user FaustPad is an OSC controller app with auto interface” definition in XML format with the --xml generated UIs tailored to Faust created modules. option. This XML-file is used to create the UI for the Ease of setup comes at the price of customizability. mobile app. The app will only work for Faust generated modules. For an in-depth description see “Audio Signal Given the expandability of Faust, it is a tradeoff Processing in FAUST”4. worth making. One advantage of using a mobile device is multi- 4 SuperCollider touch. Multiple sliders and buttons can be modified simultaneously. FaustPad currently supports iOS SuperCollider consists of two parts, the client, devices only. An iPhone or iPod Touch can handle up sclang, and the server, scsynth. The two parts to 5 touches and an iPad can handle up to 11 touches communicate via OSC. FaustPad acts as an at once. alternative client to sclang. 5.1 Building the UI A typical Faust user interface definition has two parts, 1) the definition of widgets, i.e. the control 4https://ccrma.stanford.edu/~jos/spf/Using_FAUST_Su parameters both passive and active, and 2) the layout perCollider.html Figure 3: Screenshots of FaustPad for iPad and iPod Touch. The FaustPad UI works for any orientation. In the iPod Touch screenshot, groups are folded to show only controls of interest. definition. The separation of components and layout environments. The OSC messaging object also frees the UI builder from a static layout. listens for incoming OSC messages that can be used In the current implementation of FaustPad, the app for automation and feedback from the server. maintains the given layout, creating foldable “group views”. The automated building of the UI has two 6 Example: Faust-STK phases accordingly, 1) the creation of widgets and 2) We have tested FaustPad with Faust-STK, included the creation of groups which form the layout. in the Faust release. The example files come with a 5.2 Layout principles Makefile for each environment including SuperCollider. Creating the UI description files is Faust generated modules may have many control less trivial, because the Makefile removes the parameters. This is especially true for physical files at the end of the compilation. This can be modeling synthesis modules such as many of the avoided by modifying modules in Faust-STK. For many parameters, once a faust2supercollider value is set there may be little need to change it and Makefile.sccompile. After setting up the during a performance. In FaustPad, unused groups aforementioned scripts then loading all SynthDefs, can be folded so that the user can focus on the we could use all 21 Faust-STK modules in FaustPad parameters of interest. by simply copying the files to the FaustPad FaustPad also allows multiple modules to be documents directory. created. Each module is created in a separate tab. 7 Extending FaustPad Tabs are always visible in the tab bar at the bottom of the UI, allowing quick change of synth module. The FaustPad user interface only adheres to the 5.3 OSC messaging user interface description file and makes no assumption of the underlying structure until the Each UI component holds its own data, e.g. label, moment a OSC message is sent in the OSC min/max values, from the UI description file. When messaging object. Thus it is possible to extend the there is a user interaction event, it sends an event to FaustPad to other OSC enabled synthesis the OSC messaging object which parses the event environment such as PureData or Chuck.