ICMC 2009 Proceedings
Total Page:16
File Type:pdf, Size:1020Kb
Proceedings of the International Computer Music Conference (ICMC 2009), Montreal, Canada August 16-21, 2009 SONIFYING SIEVES: SYNTHESIS AND SIGNAL PROCESSING APPLICATIONS OF THE XENAKIS SIEVE WITH PYTHON AND CSOUND Christopher Ariza Massachusetts Institute of Technology Music and Theater Arts, 4-246 77 Massachusetts Avenue Cambridge, MA 02139 USA ABSTRACT signals [4] is extended herein by using Python for collecting, mapping, and interpolating sieve-derived This paper introduces applications of the Xenakis sieve values. Exploring the sonic relevance of particular sieves for sound synthesis and signal processing with Python and is enabled by these techniques, and offers a rich avenue Csound. Using Python to collect, interpolate, and map for further study. sieve-derived values, sieves are employed in Csound for additive and subtractive synthesis, amplitude and The Sieve class, distributed within athenaCL [2], is frequency modulation, and waveform segment synthesis. employed in this study. As an open-source, cross-platform Approaches to multi-dimensional interpolation of multiple Python system with no required software dependencies, sieve segments are demonstrated. athenaCL integrates well within Csound and offers diverse tools for computer-aided algorithmic composition. This paper demonstrates using components of athenaCL tools 1. INTRODUCTION within Python scripts; the use of athenaCL’s interactive command-line interface is not discussed. Iannis Xenakis (1922-2001) envisioned broad applications for sieves: “sieve theory is very general and consequently This paper briefly reviews the use of Python in Csound is applicable to any other sound characteristics that may as well as the basic operation of the Xenakis Sieve object be provided with a totally ordered structure” [20]. Xenakis and logic string. After introducing Python interpolation employed sieves as a way of generating ordered sequences objects, numerous practical applications of sieves for of integers out of periodicities. As summarized in Ariza synthesis and signal processing are provided. All [3], Xenakis describes the use of sieves in numerous examples are presented in the Csound Unified File acoustic compositions: Nomos Alpha (1965-1966) [18] Format, or CSD. Complete CSD files and rendered audio and Jonchaies (1977) [17], for example, are described as examples are available for download at the following having sieve-based pitch structures; Psappha (1975) [8] URL: http://www.flexatone.net/docs/sspaxspc.zip. Users and Komboï (1981) [17] are described as having sieve- must install Csound version 5 or later, Python, and based rhythmic structures. athenaCL version 1.4.9 or later to render these examples. The athenaCL directory must be within Python’s search In his later discussions of sieves, Xenakis noted that “… it is quite conceivable to apply this theory to the directory or, alternatively, installed within the Python site- packages directory. Consult Python and athenaCL synthesis of sounds by computer” [19]. While suggested, documentation for more information on installing Python Xenakis provides no documented examples of this modules. approach. Other writers, discussing diverse applications of sieves, have also focused on pitch and rhythm parameters [1, 5, 3, 10, 11, 16]. This paper introduces applications of 2. USING PYTHON WITHIN CSOUND the Xenakis sieve for sound synthesis and signal processing with Python and Csound. The Csound Python opcodes permit Python objects to be instantiated and manipulated in the Csound orchestra. The expansion of Python scripting into Csound Values from these Python objects can be accessed within provides new opportunities for instrument control and instruments both at instrument initialization or as control design [7]. Used within the Csound orchestra, the Python- rate value generators. Within the Csound orchestra, the based Xenakis Sieve object [3] permits applying sieve- opcode must be called. Next, the block is derived values to a wide range of sonic parameters. The pyinit pyruni used to execute Python code, creating objects and use of Python methods and functions to create control-rate functions for use in Csound instrument definitions. 367 Proceedings of the International Computer Music Conference (ICMC 2009), Montreal, Canada August 16-21, 2009 Within the Csound instrument, the pycall1i opcode >>> a = sieve.Sieve('3@0|3@1') >>> a(0, range(0,10), 'int') (for values assigned to i-rate initialization variables) or [0, 1, 3, 4, 6, 7, 9] pycall1 opcode (for values assigned to k-rate control Figure 2. The Union of Two Residual Classes rate variables) call the previously-instantiated Python functions or object methods with one or more arguments. Sieves define infinite number sequences. A sieve Depending on the number of values returned by the segment is a finite contiguous section of a sieve sequence. instantiated Python function or object method, different A sieve can be thought of as a filter applied to a finite pycall opcodes are used. The Csound pycall opcodes range of contiguous integers, labeled z. The generation of require the Python function or object method to return a z values is facilitated in Python with the range() floating-point value. function. The range function returns a list of contiguous integers from the minimum to one less than the maximum specified value. Changing the z provided to a sieve results 3. USING XENAKIS SIEVES AS PYTHON in different sizes and ranges of sieve segments. The sieve OBJECTS created in Figure 2, for example, can be used in Figure 3 The notation and definition of Sieve objects presented in to generate a sieve segment between -100 and -80 by Ariza [3] will be used in this paper. A brief introduction of calling the instantiated Sieve object with a different z. Sieve object functionality is provided using Python's interactive mode. The Python primary prompt is . >>> a = sieve.Sieve('3@0|3@1') >>> >>> a(0, range(-100,-80), 'int') After installing athenaCL, the sieve.py module can be [-99, -98, -96, -95, -93, -92, -90, -89, -87, -86, -84, -83, -81] imported. After importing, a basic Sieve object is created from a logic string and a sieve segment is extracted. The Figure 3. Creating Sieve Segments sieve segment is extracted by calling the Sieve object with Sieve segments can be represented in a variety of three arguments: a transposition n, a z, and a format string. formats. Ariza [3] defines four: integer, width, binary, and These concepts will be explained below. unit. This paper makes use of integer and unit sieve >>> from athenaCL.libATH import sieve segments. Integer segments are demonstrated above: these >>> a = sieve.Sieve('2@0') are the integer values extracted from the supplied z. Unit >>> a(0, range(0,10), 'int') [0, 2, 4, 6, 8] segments map z to the unit interval and return segment points as proportionally-spaced, floating-point values Figure 1. Importing sieve.py between 0 and 1. Figure 4 demonstrates both integer In Figure 1 the Sieve object “a” is instantiated using a (using the “int” argument) and unit (using the “unit” logic string. The logic string is a symbolic representation argument) sieve segments. of a sieve and consists of one or more residual classes >>> a = sieve.Sieve('3@0|5@4') combined by logic operators. A residual class defines an >>> a(0, range(0,16), 'int') infinite number sequence as a modulus (M) and a shift (I), [0, 3, 4, 6, 9, 12, 14, 15] >>> a(0, range(0,16), 'unit') notated as M@I. Each value in the sequence modulus M is [0.0, 0.20000000000000001, 0.26666666666666666, equal to I: thus 2@0 specifies all integers x where x % 2 0.40000000000000002, == 0, or, between 0 and 9, the values 0, 2, 4, 6, 8. 0.59999999999999998, 0.80000000000000004, 0.93333333333333335, 1.0] Similarly, 3@2 specifies all integers x where x % 3 == 2, or, between 0 and 9, the values 2, 5, 8. Specified sieve Figure 4. Unit and Integer Sieve Segments values can be thought of as active points on a grid of Given only a sieve logic string and a z, the number of integers. values obtained in the resulting sieve segment may not be Residual classes can be combined with logic operators immediately apparent. For this reason, rather than calling to produce more complex sequences. The permitted logic the Sieve object with a z value, the collect() method operators and their symbolic representation is as follows: may be employed. This method, given a minimum z value union (|), intersection (&), symmetric difference (^), and and a desired segment length, will continue to expand z complementation (-). As defined in Ariza [3], upward as necessary to collect as many values as combinations of residual classes and logic operators can specified. The method requires four arguments: a result in simple and complex sieves. Maximally simple transposition n, a minimum z, a length, and a format. In sieves use residual classes combined only by union; for Figure 5 the first 10 values from a sieve segment starting clarity, this paper makes use only of maximally simple at 30 are collected. sieves. The example below demonstrates a simple sieve, combining two residual classes by union. >>> a = sieve.Sieve('3@0|5@4') >>> a.collect(0, 30, 10, 'int') [30, 33, 34, 36, 39, 42, 44, 45, 48, 49] Figure 5. Using the Sieve Collect Method 368 Proceedings of the International Computer Music Conference (ICMC 2009), Montreal, Canada August 16-21, 2009 The flexible representation of sieves as logic strings provides a clear representation of sieve structures. Logic >>> from athenaCL.libATH.omde import bpf >>> a = bpf.LinearSegment([(0,50),(1,60)]) strings permit creating both simple and complex sieves. >>> a(0) Xenakis, using a similar notation, describes the goal of 50.0 >>> a(.75) creating “… symmetries which are as complex as one 57.5 might want” [19]. >>> a(.95) 59.5 Alternatively, Xenakis describes the need “to retrieve from a given series of events or objects in space or time Figure 7.