Re: CoreAudio: Calculate total latency between input and output with kAudioUnitSubType_VoiceProcessingIO
Re: CoreAudio: Calculate total latency between input and output with kAudioUnitSubType_VoiceProcessingIO
- Subject: Re: CoreAudio: Calculate total latency between input and output with kAudioUnitSubType_VoiceProcessingIO
- From: Arshia Cont via Coreaudio-api <email@hidden>
- Date: Mon, 20 Jan 2020 21:58:51 +0100
Jonathan,
First of all: Paul Davis is right. Both “internalLatency” and “outputLatency”
values from AVAudioSession are estimations and not exact. They are most
reliable when used without any external audio. Least reliable of course with
Bluetooth!
Now:
I was also surprised to see the ‘4’ factor instead of ‘2’! My only raw guess is
because my stream is stereo (which doesn’t make sense!).
The formula you sent is more or less correct. It actually depends on the values
of ioBufferDuration and the other two latencies. Think of it this way: If the
outputLatency is higher than the ioBuffer it probably means that the output
buffer is also longer, then in a Pull system you need more of the system
buffers to fill out that buffer. In most real-time scheduling mechanisms we
introduce lags to make sure underflow or overflow doesn’t occur.
Arshia
www.antescofo.com <http://www.antescofo.com/>
PS: Nice Apps! ;)
> On 20 Jan 2020, at 19:24, Jonatan Liljedahl <email@hidden> wrote:
>
> On Mon, Jan 20, 2020 at 6:36 PM Arshia Cont via Coreaudio-api
> <email@hidden> wrote:
>
>> You get the following from AVAudioSession:
>> inputLatency
>> outputLatency
>> ioBufferDuration
>>
>> Then your throughput latency, assuming a Stereo Stream, would be:
>> inputLatency + outputLatency + 4*ioBufferDuration
>
> I did the same, but I arrived at inputLatency + outputLatency + 2 *
> ioBufferDuration!
>
>> In case inputLatency > ioBufferDuration, you add one more ioBufferDuration.
>> Same with outputLatency! This means that when lowering your
>> ioBufferDuration, your Session mode becomes important (which directly
>> affects input and output latencies). The lowest you can achieve would thus
>> be with the Measurement Mode.
>
> So you mean the formula would be:
>
> inputLatency + outputLatency + (inputLatency > ioBufferDuration ? 5 :
> 4) * ioBufferDuration
>
> Do you have an explanation why?
>
> --
> /Jonatan
> http://kymatica.com
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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