Automatic Program Specialization for Interactive Media Scott Draves This dissertation introduces and analyzes techniques for writing programs that manipulate interactive media. By "media" I mean audio, images, and video flowing through a personal computer. By "interactive" I mean that there is an impatient and unpredictable user who produces and consumes this media. Historically, such systems that provide low latency and remain highly flexible have been rare and difficult to build. I propose treating media systems as programming languages and bringing the techniques of semantics-based program transformation to bear. One part of this solution is the use of compiler generation as an interface to run-time code generation. The idea is to use automatic specialization to convert flexible programs into fast programs. This idea has already been developed by the partial evaluation community. In order to make it work better with media, I extend the known techniques for specialization with partially static integers and equality constraints. I demonstrate the effectiveness of these techniques by using a prototype implementation to benchmark kernels such as wave-table audio synthesis and color-to-grayscale conversion.