• Register
  • Help
Results 1 to 4 of 4

Topic: Audio Buffer Question

  1. #1

    Audio Buffer Question

    Sorry for such a basic question but I'm trying to understand a latency issue in OS X software I'm writing. Apparently I don't have a good model of where audio buffers exist in the audio signal chain.

    When I adjust the Steinway buffer size (in Steinway Preferences, also shows up in the Info menu), where is that buffer? Is it part of the Steinway Aria program (standalone) or part of the Mac OS X built-in audio output? i.e. if I pickoff the digital audio at the Steinway output should I see a Midi to audio latency as specified by the buffer size in the preferences?

  2. #2

    Re: Audio Buffer Question

    I'm not sure if this answers your question, but on Mac when you set the buffer size in the Steinway preferences (for the stand-alone application), this is sufficient in my experience for you to be sure that your audio interface is running at the requested buffer size. As an example of what latency the buffer sizes represent - a buffer size of 32 samples at 44100 sample rate would be about 0.75 milliseconds, a buffer size of 64 at 44100 would be about 1.5 milliseconds, 128/44100 3 ms, 256/44100 6ms, 512/44100 12 ms.
    There is also probably going to be some added latency in association with the MIDI device internally - I would guess that this amount of further latency is independent of the audio buffer size.

    I'm not actually a good person to try to answer your CoreAudio/Mac internals question, since I don't have experience with the CoreAudio application interface to the audio drivers. But what follows is my educated guess based on analogy to driver work I have done. My expectation is that the audio driver sets up the buffer(s) at the requested size - and that the audio driver creates and 'owns' the buffer(s), and that the application gives requests to the driver through the CoreAudio API and that these requests include a request for callbacks so that the application can be called (back) by the driver to fill the audio buffer(s) periodically (for example approximately once every 3ms at a buffer size of 256 and samplerate 44100). All pure speculation!

  3. #3

    Re: Audio Buffer Question

    Thanks for replying Jeff. I was trying to keep the question simple, but maybe that made it seem more complex. I'm really asking if the Aria program (standalone) sets up its own buffer according to the size set in its preferences.

    When I pick off the audio output stream from the Aria engine (prior to the internal Mac sound "card") I see the effect of a buffer. For instance, if I set the buffer size to 1024 (long buffer to swamp other delays) I'm measuring a latency between the Midi input (which my program generates and sends directly to the Aria engine) and the digital audio output of Aria (which I plot on a graph) that is equivalent to slightly more than 2 buffers (over 2100 samples). The latency appears to be randomly slightly more than 1 or 2 buffer lengths for buffer sizes of 64 points. All of this is happening prior to the Mac built in output (which the Aria engine is set up to not drive). So it seems like the Aria engine establishes its own buffer(s) and outputs with a latency that is 2x the buffer length for long buffers and 1 or 2 buffer lengths for short buffers. It's quite possible that something in my program is responsible for the measured variation in the shorter sample buffer latency (but if so I haven't found the cause yet), but the 2x latency for the 1024 sample buffer would be much harder to explain. (I'm capturing the audio data from the Aria engine with a 32K buffer).

    Sorry for adding all this detail, but I'm just trying to find out if the Aria engine in standalone mode creates it own buffer (independent of a Mac built-in audio output buffer) and is it possible the latency could be 2x that buffer length (for a 1024 sample buffer)?


  4. #4

    Re: Audio Buffer Question

    It's probably because of double buffering. I don't know whether prospectively this double buffering is handled internal to CoreAudio (where CoreAudio/the drivers 'own' the buffers) and transparent to the applications, or whether the double buffering is set up in the application (where the application 'owns' the buffers). Again I am only guessing - I didn't write any of the stand-alone Steinway app.
    I'd strongly suggest for you to read the CoreAudio docs from Apple if you're interested in correctly doing or understanding low latency audio on Mac. For a very dated but decent quick read on issues involved in low latency audio, RME has an article from 2000 you could scan through http://www.rme-audio.de/english/techinfo/lola_latec.htm

Go Back to forum


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts