Page  00000001 Siren: Software for Music Composition and Performance in Squeak Stephen Travis Pope Center forResearch in Electronic Art Technology (CREATE) MusicBuildng, University of California, Santa Babara, California, 93106 USA stp@aeateucsb.ech http /www.create ucsb. edu/-stp/ Abstract Squeak is a new implementation of the Smalltalk programming enviionment. It was dveloped at Apple Labs, and has been ported to a variety of omputers. Compared to other Smalltalk systems, Squeak has four important featues: (1) portability (to the Macintosh, Windows PCs, and many flavos of UNIX), (2) speed (it uses native C for computeintensive cod), (3) price(fiee, indudng all source cod!); and(4) sophistication (full Smalltalk-80 language, libraies, and tools, with many useful extensions). The Siren system is a new object-oriented(OO) software tool kit for music applications. Siien's d&sign was drived from the authers 14-years of experience buildng Smalltalk-basedmusic tools. The intention is to support music composition, dgital soundsynthesis andprocessing, and live pefomanacs within a free, portable, high-level software tool kit. This paperwill briefly introdcae the Squeak system, and then dscuss the d&sign of Siren. An on-line d&monstration of Siteniunning on a lap-top computer is planned for the presentation at ICMC. Both Squeak and Siren are available in source codw free via Internet ftp from the site 1 Introduction The Squeak implementation of Smalltalk was dbveloped at Apple Labortories by a group that consisted of several of the original &dsigners of the Smalltalk system (Alan Kay, Dan Ingalls, Ted Kaehler, et al.). Squeak is a "full-scale" Smalltalk implementation, and inducds all of the stancdrd dass libraies and dvelopment tools. The Silen package in Squeak is a member of the DoubleTalk/HypeiScoreMODE family of systems dbveloped by the author since 1983. (The name Silen was suggested by Curtis Roads; it is not an acronym.) Siteninducbs the following components: * the Smokemusiciepresentation language; musicmagnitucd modils (time, pitch, loudness, etc) events and event lists, event genertIors (pitoodural or stochastic stieam-like composite events), event modfieis (functions that can be applied to event lists) and software to iead/write Smoke from/to many othermusic formats, * dasses for ieal-time soundsynthesis; 00 modls for synthesis andprocessing, * soundandMIDI /FO support; ieal-time /FO voices for many interchange formats, * note list I/O for non-teal-time synthesis packages; lead/writecmusic, cmix, or csound scores, * GUI-basedtools for score/soundmanipulation pitchtimedagrams, hierarchies,DSP, etc Compatedto eadier Smalltalk music kits, Siten has moie sophisticated modls of the basicmusic magnituwbs, flexible eager or lazy function application, a new user interface paradgm, and a complete mocdl of objects for mochlar soundsynthesis a la Music V. 2 The MODE History The Musical Object Development Enviionment (MODE) was written cdling the authors sojourn at the STEIM Institute in Amsterthn in 1990; it was &dived from the eardier HypeiScore ToolKit (see ICMC 1987) The intention was to provicb a portable system that couldperform leal-time MIDI and sampled soundFO on a number of platforms (Macintosh, Sun, andPC). The MODE inducbd a simple object-oriented music representation language, dives for MIDI and sound/O, and a collection of graphical user interfaces for various musical applications. Throughout its life, the MODE was plagued by dfficulties supporting the I/O dives on moie than one platform The Macintosh MIDI dives weie only partially functional, and Sun failed to support MIDI at all on its new Solaris operating system. The complexity of buildng interfaces to C codc in the PatcPlace Systems, Inc VisualWorks Smalltalk implementation madc it even haider to perfoim dgital sound synthesis or processing from within the MODE. During 1991 and 1992, a group of language dsigners met at the CCRMA Center at Stanford University and the CNMAT Center at U. C., Beikdeey to formalize and extendthe MODE's representation language This project ledto the Smoke language, which was dbscribedin a paperby the author in the 1992 ICMC Proceedings. 3 Siren Extensions to the MODE Over the past five years, a number of weaknesses in the Smoke language and the MODE's implementation of it have become appaient Otherproblems surfaedin the MODE's built-in applications andinterfaces. Thesewill each be introdicedbelow.

Page  00000002 Smokehad no explidcit notion of intervals. Pitches are represented using a flexible franewoik of objects, but intervals were only seen as sid-effects of pitch arithmetic. Taking a hint from Francois Pachdet's MusES system (desaibedin recent ICMC Proce~dings), the Siren version of Smoke has both reified intervals and more powerful tonal chordmodls. Smoke's modls of event modfiers (e.g., crescencb or acelerancb) were typically "eager, " tha is, they applied themselves to an event list vwhen they were &Acaed In Siren, event modfiers can be ttached to an event list for 'lavy" (i.e., perfofmance-time) application. The MODE indudd a large "voi&a framewoik that sepanted (abstract) event propeties from (conaete) parameters of synthesis methoc (such as the settings of a MIDI dvice or the mappings neededby an out-board synthesis package such as cmix). In ordr to support real-time soundsynthesis in Squeak, this architectue had to be revisited, leading to a new voicemodel. Lastly, the graphical libray used for Siren GUIs is dffeent from the MODE's simple dsplay list graphics dasses. Squeak indudbs John Maloney's 'Morphic" user interface framewoik. 4 Squeak Compilation Technology The Squeak system has an integral Smalltalk-to-C translator, this is usedto generte the Squeak virtual machine (VM), the source for whichis atually written in Smalltalk and then translated to C and compiled using a standrd C compiler. The translator supports a subset of the full Smalltalk language, exdudng (a) the fancy Smalltalk control structures tha are not expressible in C in a stmrightfoiwardway, and (b) the Smalltalk dass libraies beyond thosetha represent basicC types and dita stiuctures. The translatorcan also be used, for example, to acelerte the inner loops of signal processing functions. Informal benchmaiks d&monstrate the ability to peifoim 10 voices of real-time FM or plucked string synthesis at a 44.1 kHz sampling rate on modest hardware (Apple Powedrook 1400cs). A Smalltalk method tha is to be translatedinto C may indudb Cstyle&cdlaations of sharedvariables, and a Smalltalk method body. The translator genertes C co&d that is compiled and linked to the Squeak virtual machine, whereafter the method body can be replaced by a Smalltalk primitive message-send 5 Sound Synthesis in Siren Part of the Squeak dass libray is a dgital sound synthesis package &dveloped by John Maloney using the Smalltalk-to-C translator dscribed above Each dass tha represents a synthesis technique implements a synthesis method called mb(Sanpb~Cou ntn t dou ndBufferstath gAtstalhdex pan:panV ie. TIhis method sums the given number of samples (n) into the given soundoutput buffer using the approprqxiate synthesis technique. As an exanple, John's implmentation of FM in Squeak uses the following method(slightly simplified monophonic). FMSo und melhodsFo rsoun dge ne tb n mb(SampbCou ntn hb N Sou ndB ufferstagAtstalhdex 'A dmpb in pleme ntlon of Ch ownh g'sfeq uen cymo du lb n synthess ~dch nlue.Thecenterrequencyivaied ashe so undplaysby chaghg he h creme ntbywhihbsteph o ughh ewavelable." 'Vabbdedaaions.' |lsthd exisamp b I "Dectre vaitles b be shared between Sq uek and C-o uput bu fer an d wavelable. seofvar#aSound Bu e rdedae C:tho t*aSo und Bufe t. se fvar#wateTabde dae C:tho th t*waeTable "Setupbopoountr.' sthd ex-.tlahd ex+ n)-1. "S a pboo mp uton bop." stalh de xb:sthd exdo: [i| 'Getsamp b vah e;h de ih e wave obleb okup h dex" sampb b mptude* NateTablea:hdex)). 'W1bsampbbouputbuter" 6 ou ndB ufferd:ipu t ((S oun dB uferat:)+ (an pb*pan)) "U pd &blebh dioesbrn mextb op." h de x.- h de x+ h creme nt+ (mo dulAbn * NaeTableat:offs etlnd ex)). hdex>wave TAb bSk e fTrue:ndex- hndex-waTaveTbbSke] hdex<l fTrue:1ndex-h dex+ wave TdbSke]. offsethdex-offsethdex+offsethcement offsethdex>wave TbbSke frue: [o fsethdex -offsethd ex-wave Tdb Ske]l "E ndofsampibbop." count--ount-n. The curret dass hierachy of souncds is as follows (whereby the in&ntation implies subclassing and the names in paientheseses are the dass's instance variables). ObjdO AbstelSoun d am pbsU nNeAContol) MbiedSo un d(oun ds'panSethg s'nou ndDon e') PluckedSound(h tiCount'b un tmpltude'ti g'tig Size"i gIndx') Re stSou nd (ni dCou nt'oo unt') Se quentSo un d(Soun ds'cu e nthd ex) Wav T blSou nd (waveT b"w'aeTbleSe'lnh~Counfbou nt h7itmplIude'amp lIid e'decay'Rat"hc ment hdex) FMSound (hiModulabn'hiodultb n"mod uion Deca' offsethcemenfofsethdex)

Page  00000003 A SouncPlayer dass supports buffer-orientedsoundoutput to the native operating system's play routines. It has variable sample rate andblocksize; these can be set up using a configuration message of the following form. SoundPlaerstalPaheP DcoessBufterSke:22 05a 44100 stereo:tue. This sound synthesis system has been merged with the Siren event/voice framewoik in tha events can have voices tha represent sound dasses, and these are triggered vwhen the events are performed 6 The Morphic User Interface Another important Squeak extension over "standud' Smalltalk implementations is the 'Morphic" user interface franmewoik, originally &veloped for the Self language by John Maloney. Driven by the &site for easy portability, the MODE's user interfaces have been basedon a simple dsplay list dass libray for some time, and it was relatively easy to move these onto Moiphic. The larger transition was ad1pting the MODE's "tool-centric" GUI to the Morphic "object-centric" interaction paradgm. 7 Still To Do As with previous MODE veisions, Siren is still weak in terms of MIDI support, and in terms of true portability of the sound I/O interfacs. Between the time of this writing and the 1997 ICMC, we hope to have MIDI running on the Macintosh platform, and the sound lO cod& ported to run on UNIX (using the NetAudo libraies for portability and dvie indpennce). 8 Conclusions Squeak is an exciting &velopment in the Smalltalk worddbecause of its level of sophistication, pefoimnanm, portability, and cost. Siren is a significant improvement over the previous Smalltalk musicpackages such as the HyperScole ToolKit andthe MODE.