Music Programming with the new Features of Standard C
Object-oriented programming using C++ classes is established practice in the general programming community and is beginning in computer music applications (Chaudhary, Freed et al. 1988; Chaudhary 1998). However, large components of computer music systems are still commonly written in the C programming language, either because object-orientation is felt unnecessary or more often because of efficiency concerns. Such concerns are central to successful implementations of reactive performance-oriented computer music systems. By judicious use of new features of the recently established ISO Standard C++ (Becker 1998; Stevens 1998), real-time computer music applications may be developed that are more efficient and reliable than typical C programs, easier to understand and write, and easier to optimize for a particular operating environment. This paper reviews new features of ISO C++ relevant to reactive music system programming and illustrates by example a new programming style for musical applications that exploits unique strengths of C++. 1 Introduction The recently completed standardization effort for C++ was not a formal codification of existing practice with the language. Many years of the effort involved the introduction of entirely new features (Stroustrup 1995) many of which directly address efficiency issues that have prevented C++ from use in reactive music software. Section 2 summarizes these new features and hints at their relevance to reactive music systems. References to particular sections of a friendly description of the standard C++ (Stroustrup 1997) language are offered since space limitations prevent a complete exposition of each new feature. We are developing a new programming system for musical applications, the "Open Sound System" (OSS). We have rejected the approach of simply translating an existing library of primitives (Freed 1994) or building C++ wrappers around one of the C-based music languages (Pope 1993) for two reasons. Firstly, these legacy systems were designed for computer architectures very different from those in use today. In modern computers arithmetic is much faster than table indexing. The key to good performance these days is exploitation of parallelism, data and code locality and the multi-level register/primary/secondary/main memory hierarchy (Dowd and Loukides 1993). The second reason to start from scratch is that by exploring the rich abstraction facilities of standard C++, we have identified a promising new approach for developing musical signal processing and synthesis applications that is fundamentally different from the traditional unit generator/wiring model. Section 3 illustrates this new approach by example. 2 Standard C++ features for Music Programming
Functional reactive programming,Procedural programming,System programming,Programming language,Programming paradigm,Computer science,Imperative programming,Extensible programming,Programming,Reactive programming
Adrian Freed129063.64
Amar Chaudhary24713.75