INTERFACING REAL-TIME AUDIO AND FILE I/O

Programming a computer to record or play a sound file in real-time is not as easy as it may seem. The naive approach is to call file I/O APIs from within the routine that handles real-time audio I/O. This leads to audible glitches whenever the time taken to access a file exceeds the time available to deliver a buffer of real-time audio. This paper describes an approach to streaming file playback and recording that operates correctly under these conditions. It performs file I/O in a separate thread, buffers audio data to mask file I/O delays, and uses asynchronous message passing and lock-free queues for interthread communication.

[1]  Carlos A. Arreola-Morales International Business Machines Corporation (IBM) , 2014 .

[2]  Dominique Fober,et al.  Lock-Free Techniques for Concurrent Access to Shared Objects , 2002 .

[3]  Bruce Powel Douglass Real-Time Design Patterns , 1999 .

[4]  Robert James Shelton A lock-free environment for computer music: concurrent components for computer supported cooperative work , 2011 .

[5]  José Carlos Brustoloni,et al.  Effects of data passing semantics and operating system structure on network i/o performance , 1997 .

[6]  Amy Wohl,et al.  Apple computer, Inc. , 2003 .

[7]  James H. Anderson,et al.  Real-time computing with lock-free shared objects , 1995, Proceedings 16th IEEE Real-Time Systems Symposium.

[8]  Calton Pu,et al.  A Lock-Free Multiprocessor OS Kernel , 1992, OPSR.

[9]  Maged M. Michael,et al.  Nonblocking Algorithms and Preemption-Safe Locking on Multiprogrammed Shared Memory Multiprocessors , 1998, J. Parallel Distributed Comput..

[10]  Willy Zwaenepoel,et al.  IO-Lite: a unified I/O buffering and caching system , 1999, TOCS.

[11]  James H. Anderson,et al.  Real-time computing with lock-free shared objects , 1997, TOCS.

[12]  Maged M. Michael The Balancing Act of Choosing Nonblocking Features , 2013, ACM Queue.

[13]  Douglas C. Schmidt,et al.  Half-sync/half-async: an architectural pattern for efficient and well-structured concurrent I/O , 1996 .

[14]  Ross Bencina,et al.  PortAudio - an Open Source Cross Platform Audio API , 2001, ICMC.

[15]  Binoy Ravindran,et al.  Lock-Free Synchronization for Dynamic Embedded Real-Time Systems , 2006 .

[16]  Donald Ervin Knuth,et al.  The Art of Computer Programming , 1968 .

[17]  M. D. MacLaren The Art of Computer Programming—Volume 1: Fundamental Algorithms (Donald E. Knuth) , 1969 .

[18]  Douglas Comer Operating System Design: The Xinu Approach Linksys Version , 2011 .

[19]  James McCartney,et al.  Rethinking the Computer Music Language: SuperCollider , 2002, Computer Music Journal.

[20]  Kaushik Velusamy,et al.  Modern Operating Systems , 2015 .