How can I play an audio signal such that the command-to-sound delay is consistent (<1–2 us)?

Hello!
I'm looking for a way, preferably in MATLAB, to play a sound with a consistent delay between the code saying "Play!" and the sound starting to play. By "consistent," I mean a delay that doesn't differ by more than one or two microseconds from one trial to the next. Any ideas would be great, thanks very much!
Alex

2 Comments

What type of sound hardware are you planning on using. What OS?
Thanks for the reply! I'd love a cross-platform solution, but XP is all that matters for the present. It would be used on a Lenovo E420 machine (Conexant 20672 audio).

Sign in to comment.

Answers (1)

This cannot be done in MATLAB, and is unlikely to ever be supported.
MATLAB runs on general-purpose operating systems (such as MS Windows and Linux) which do not offer any promises that the process will not be swapped out or that the CPU will not be given over to another process, or that something else (e.g., disk i/o) will not take CPU's attention dealing with interrupts or DMA.
Real-time guarantees like this require OS and hardware cooperation.
One company that did a fair bit of work on making meaningful audio synchronization available through user calls, was SGI.

2 Comments

Hi Walter—OK, I'll check out SGI. Thanks for your input, much appreciated!
Unfortunately the SGI equipment I am thinking of has not been made in years. I do not know whether they brought the library in to Linux.

Sign in to comment.

Categories

Find more on Audio I/O and Waveform Generation in Help Center and File Exchange

Tags

Asked:

on 12 Jan 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!