• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: achieving very low latency
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: achieving very low latency


  • Subject: Re: achieving very low latency
  • From: Brian Willoughby <email@hidden>
  • Date: Fri, 06 Jul 2012 11:40:00 -0700

Dedicated audio hardware has the lowest latency. General purpose hardware, such as a Mac running CoreAudio, cannot achieve the same low latency as dedicated hardware due to the buffering of multiple samples before they are played.

What I find confusing is that you are using dedicated hardware to interface to the physical button, and yet you are not using dedicated hardware to play the sound. The Arduino uses USB to communicate with the Mac, and thus you have a minimum of 1 ms of latency, often more than 1 ms due to scheduling of USB Interrupt endpoint traffic.

I suggest that you change your system to some kind of dedicated hardware. Maybe an Akai MPC sample player with MIDI input (or maybe just use the buttons on the Akai with MIDI output for recording the user input timing, but use a USB-MIDI interface like MOTU which has a custom CoreMIDI driver for more accurate timing information). An alternative would be to add an audio shield to the Arduino that can play sounds under direct control of the firmware that reads the button.

Basically, I hate to say this on the CoreAudio list, but you're trying to use the wrong tool for your task. You need a laboratory test equipment setup, not general purpose computing equipment.

Brian Willoughby
Sound Consulting


On Jul 4, 2012, at 08:42, Daphne Ippolito wrote:
In the experiment, a physical pushbutton is pressed (the old system used a National Instruments card to record this; I am using an Arduino) that plays a sound. I am referring to latency as the time between when the physical button is pressed and when the sound outputs from the audio jack. I have been measuring this with an oscilloscope.

With Core Audio, I have not been able to get this time gap lower than 30 ms. I have tested the Arduino independently and it is not contributing more than 1 ms of delay.

This is my first time programming with audio, so I am still a bit unclear on how it works. I've been told that I can't have more than 10 ms delay between when the pushbutton is pressed and when the sound leaves the speakers, and preferably less than 1 ms.

Any advice on how I can accomplish this?

On Wed, Jul 4, 2012 at 9:49 AM, Daphne Ippolito <email@hidden> wrote:
I am writing software for a psychology lab that needs to play sounds with sub-millisecond latency for one of its experiments. The original software the lab used runs on OS 8/9 and makes use of the old SndManager system. It loads all sounds into memory at the beginning of the experiment, and is later able to start the sounds with sub-millisecond latency. I have not been able to replicate with Core Audio the low-latency levels achieved with the old system. Is it possible to play sounds with sub-millisecond or even <5-10 ms latency in OS X? Is the "load all sounds into memory" approach still a good one?

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • iOS: Multiple AUs versus everything in one render callback
      • From: Hari Karam Singh <email@hidden>
    • Re: achieving very low latency
      • From: Paul Davis <email@hidden>
References: 
 >achieving very low latency (From: Daphne Ippolito <email@hidden>)
 >Re: achieving very low latency (From: Paul Davis <email@hidden>)
 >Re: achieving very low latency (From: Daphne Ippolito <email@hidden>)

  • Prev by Date: Re: achieving very low latency
  • Next by Date: Re: achieving very low latency
  • Previous by thread: kAudioUnitSubType_AudioFilePlayer not Sandbox Safe
  • Next by thread: Re: achieving very low latency
  • Index(es):
    • Date
    • Thread