MMultibandDynamics AU latency
-
- KVRer
- 16 posts since 30 Nov, 2013
Hi all.
I just bought the Free Bundle upgrade and the Mixing Bundle today, and I just caught this issue.
This is absolutely a deal-breaker for me. There was no documentation about non-fixable delay, and there was no way for me to know given that upsampling is not allowed in the free versions of the basic audio units.
That being said, I'm not going to bail just yet. These are fantastic plugins, and I'd like to help in any way I can.
I only started to get into the framework many months ago and never really followed up, so I can't claim to know what I'm talking about... BUT... From what I know about Logic, latency compensation is "automatic". I think that means that each plugin reports its latency to the next plugin, which then reports total latency to some property/function/object in the project scope, and the project automatically matches each channel up, delaying them by the appropriate amount. Do you know if that's the case?
Anyways, I'm not sure what all you're using in the plugins, but it seems like you're bypassing the audio units framework as much as possible. If that's the case, this may not be too applicable.
I found this in the documentation:
https://developer.apple.com/library/mac ... #jumpTo_53
and this:
https://developer.apple.com/library/mac ... #jumpTo_84
Seems to me like it's a just a simple float value associated with the audio unit object that lets something in a broader scope do the latency adjustments.
Now that I've typed all that, it occurs to me that you've probably seen all of this already. I could go back and delete all of what I typed, but just in case, I'll leave it all there. And please pardon me if you've already seen all this. I can understand the frustration.
-QC
I just bought the Free Bundle upgrade and the Mixing Bundle today, and I just caught this issue.
This is absolutely a deal-breaker for me. There was no documentation about non-fixable delay, and there was no way for me to know given that upsampling is not allowed in the free versions of the basic audio units.
That being said, I'm not going to bail just yet. These are fantastic plugins, and I'd like to help in any way I can.
I only started to get into the framework many months ago and never really followed up, so I can't claim to know what I'm talking about... BUT... From what I know about Logic, latency compensation is "automatic". I think that means that each plugin reports its latency to the next plugin, which then reports total latency to some property/function/object in the project scope, and the project automatically matches each channel up, delaying them by the appropriate amount. Do you know if that's the case?
Anyways, I'm not sure what all you're using in the plugins, but it seems like you're bypassing the audio units framework as much as possible. If that's the case, this may not be too applicable.
I found this in the documentation:
https://developer.apple.com/library/mac ... #jumpTo_53
and this:
https://developer.apple.com/library/mac ... #jumpTo_84
Seems to me like it's a just a simple float value associated with the audio unit object that lets something in a broader scope do the latency adjustments.
Now that I've typed all that, it occurs to me that you've probably seen all of this already. I could go back and delete all of what I typed, but just in case, I'll leave it all there. And please pardon me if you've already seen all this. I can understand the frustration.
-QC
-
- KVRer
- 16 posts since 30 Nov, 2013
Hey great. It disabled my links temporarily.
These are the audio unit properties I was linking to:
kAudioUnitProperty_PresentationLatency
kAudioUnitProperty_Latency
Maybe one day I'll have live links.
These are the audio unit properties I was linking to:
kAudioUnitProperty_PresentationLatency
kAudioUnitProperty_Latency
Maybe one day I'll have live links.
-
MeldaProduction MeldaProduction https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=176122
- KVRAF
- 14325 posts since 15 Mar, 2008 from Czech republic
quietcreep, don't worry
. But of course I know all this. The plugins report latency, in fact most of them don't have any. The problem are the advanced features which can cause latency - this is basically linear-phase upsampling and linear-phase crossovers. Still working on it, but if you don't use these features you will be fine anyway.
About the upsampling - please check the docs and this video. Many people think it's some kind of super-cure to make everything sound better, which is absolutely not true, so people should understand what it is all about:
About the upsampling - please check the docs and this video. Many people think it's some kind of super-cure to make everything sound better, which is absolutely not true, so people should understand what it is all about:
-
- KVRer
- 16 posts since 30 Nov, 2013
Cool cool. I figured you'd be through all this before.
Yah, I know about aliasing, etc. I wouldn't necessarily call upsampling and linear phase algorithms "advanced". Anymore, most decent effects do at least 2x upsampling, though they may not advertise it.
What I haven't seen is many plugins that do selectable upsampling rates. There is one, though:
http://vladgsound.wordpress.com/plugins/molot/
Maybe they'd have some thoughts on the matter.
Seems like you'd want to report a dynamically determined latency property based on the processing going on. Again, I'm sure it's more complicated than that. Makes me want to get back into AU dev.
Good luck on all this.
Yah, I know about aliasing, etc. I wouldn't necessarily call upsampling and linear phase algorithms "advanced". Anymore, most decent effects do at least 2x upsampling, though they may not advertise it.
What I haven't seen is many plugins that do selectable upsampling rates. There is one, though:
http://vladgsound.wordpress.com/plugins/molot/
Maybe they'd have some thoughts on the matter.
Seems like you'd want to report a dynamically determined latency property based on the processing going on. Again, I'm sure it's more complicated than that. Makes me want to get back into AU dev.
Good luck on all this.
-
MeldaProduction MeldaProduction https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=176122
- KVRAF
- 14325 posts since 15 Mar, 2008 from Czech republic
Well, setting sampling rate or oversampling factor is questionable. One thing is sure, integral multiplicators for upsampling are more effective and less prone to errors, so it would end up more or less the same.
About the latency - it's not a problem of reporting, but changing it. Since you did develop AU stuff, maybe you know the answer
. This is a piece of code contacting host about it:
Unfortunately Logic ignores it...
About the latency - it's not a problem of reporting, but changing it. Since you did develop AU stuff, maybe you know the answer
Code: Select all
AudioUnitEvent e;
MMEMSET(&e, 0, sizeof(AudioUnitEvent));
e.mArgument.mProperty.mAudioUnit = Instance;//GetComponentInstance ();
e.mArgument.mProperty.mPropertyID = kAudioUnitProperty_Latency;
e.mArgument.mProperty.mScope = kAudioUnitScope_Global;
e.mArgument.mProperty.mElement = 0;
e.mEventType = kAudioUnitEvent_PropertyChange;
AUEventListenerNotify (paramListenerRef, NULL, &e);-
- KVRer
- 16 posts since 30 Nov, 2013
Can't say I've actually developed any AU stuff, just dabbled a bit.
In the implementations I've seen (the example AudioUnits Apple provides), kAudioUnitProperty_Latency just returns the value of a function called GetLatency().
I don't know if you are subclassing the AUBase class, but if you are, it looks like there should be a method in there somewhere called GetLatency() that you may be able to override to return the correct latency. The default of that method is just to return 0.0 (in seconds).
Looks like you determine the latency and return yourself in that method, and the host will reference it when needed; you may not need an event listener for changes in latency. You may need a listener for other events (e.g. changing up sampling factor) to re-get the latency, but I'm not sure.
Here's a link to the sample code:
https://developer.apple.com/library/mac ... TS40013969
Doesn't look like any of these examples introduce latency, so an actual implementation is a bit fuzzy for me.
Any of that helpful?
In the implementations I've seen (the example AudioUnits Apple provides), kAudioUnitProperty_Latency just returns the value of a function called GetLatency().
I don't know if you are subclassing the AUBase class, but if you are, it looks like there should be a method in there somewhere called GetLatency() that you may be able to override to return the correct latency. The default of that method is just to return 0.0 (in seconds).
Looks like you determine the latency and return yourself in that method, and the host will reference it when needed; you may not need an event listener for changes in latency. You may need a listener for other events (e.g. changing up sampling factor) to re-get the latency, but I'm not sure.
Here's a link to the sample code:
https://developer.apple.com/library/mac ... TS40013969
Doesn't look like any of these examples introduce latency, so an actual implementation is a bit fuzzy for me.
Any of that helpful?
-
- KVRer
- 16 posts since 30 Nov, 2013
** determine and return the latency yourself.
-
MeldaProduction MeldaProduction https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=176122
- KVRAF
- 14325 posts since 15 Mar, 2008 from Czech republic
The trouble is we are not using the AU libs here as they were conflicting with some allocator, other interface, or something, that's actually quite sad... Anyway as I said the latency reporting is just fine. We just do it manually, not using GetLatency but directly using kLatency or how is it called. But the updating doesn't work in some hosts...
Now that makes me think why the hell Logic doesn't ask for latency on every plaback resume... Computing latency is very fast...
Now that makes me think why the hell Logic doesn't ask for latency on every plaback resume... Computing latency is very fast...
-
- KVRer
- 16 posts since 30 Nov, 2013
Bummer. They have some nice little convenience features that would probably make this easier.
Looks like you're not really supposed to use AUEventListenerNotify for property changes.
I don't know what parts you are and aren't using of the AU libraries, but have you tried registering an event listener with AudioUnitAddPropertyListener or AUBase::AddPropertyListener?
https://developer.apple.com/LIBRARY/IOS ... tyListener
Once the listener is registered with a callback, looks like you can call PropertyChanged( kAudioUnitProperty_Latency, kAudioUnitScope_Global, 0 ) where you are expecting latency changes (like changing the upsampling parameter), and it will trigger the registered callback to do something, like recalculate and update the latency.
In the meantime, I'm going to make 2 or 3x the default upsampling factor in some of the plugs, and see if initializing with the upsampled factor fixes the issue.
Looks like you're not really supposed to use AUEventListenerNotify for property changes.
I don't know what parts you are and aren't using of the AU libraries, but have you tried registering an event listener with AudioUnitAddPropertyListener or AUBase::AddPropertyListener?
https://developer.apple.com/LIBRARY/IOS ... tyListener
Once the listener is registered with a callback, looks like you can call PropertyChanged( kAudioUnitProperty_Latency, kAudioUnitScope_Global, 0 ) where you are expecting latency changes (like changing the upsampling parameter), and it will trigger the registered callback to do something, like recalculate and update the latency.
In the meantime, I'm going to make 2 or 3x the default upsampling factor in some of the plugs, and see if initializing with the upsampled factor fixes the issue.
-
MeldaProduction MeldaProduction https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=176122
- KVRAF
- 14325 posts since 15 Mar, 2008 from Czech republic
Hmmm, it doesn't make sense to me - if I register a listener, I'll be informed about parameter changes, but I don't want to be informed, I want to notify that it has changed.
-
- KVRer
- 16 posts since 30 Nov, 2013
Yeah, I'm having some trouble with it, too.
I'm thinking there's probably a callback already associated with the kAudioUnitProperty_Latency since it's a global scope audio unit property of some importance. You might try firing PropertyChanged( kAudioUnitProperty_Latency, kAudioUnitScope_Global, 0 ) in parameter change view methods that you know will result in a latency change.
If there's no pre-existing callback registered with an event listener, you might register a callback function that re-initializes the plugin with the current settings. It's a little hacky, but it may get you closer to a working solution.
-qc
I'm thinking there's probably a callback already associated with the kAudioUnitProperty_Latency since it's a global scope audio unit property of some importance. You might try firing PropertyChanged( kAudioUnitProperty_Latency, kAudioUnitScope_Global, 0 ) in parameter change view methods that you know will result in a latency change.
If there's no pre-existing callback registered with an event listener, you might register a callback function that re-initializes the plugin with the current settings. It's a little hacky, but it may get you closer to a working solution.
-qc
-
MeldaProduction MeldaProduction https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=176122
- KVRAF
- 14325 posts since 15 Mar, 2008 from Czech republic
Ok, so good news is I spent some more time hacking CoreAudio and found it! So it will work.
Bad news: You'll need to restart playback 2x in Logic. The plugin informs about the change in initialization, that makes perfect sense since we want to minimize CPU usage (despite AU is far from ideal in CPU management...), but at that moment Logic doesn't care anymore... Well, at least it works
.
Bad news: You'll need to restart playback 2x in Logic. The plugin informs about the change in initialization, that makes perfect sense since we want to minimize CPU usage (despite AU is far from ideal in CPU management...), but at that moment Logic doesn't care anymore... Well, at least it works
-
- KVRer
- 16 posts since 30 Nov, 2013
That's great news. Glad you got it working. Hope I helped.
Will this be an update for the whole line of plugins?
Will this be an update for the whole line of plugins?
-
MeldaProduction MeldaProduction https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=176122
- KVRAF
- 14325 posts since 15 Mar, 2008 from Czech republic
Sure you helped
.
And yes it will be a huge major update for all plugins - several fixes, but mostly a brand new GUI engine with GPU optimization etc.... But it will need quite some more development, especially on Macs as usual
.
And yes it will be a huge major update for all plugins - several fixes, but mostly a brand new GUI engine with GPU optimization etc.... But it will need quite some more development, especially on Macs as usual
-
- KVRist
- Topic Starter
- 33 posts since 21 Aug, 2009
Thanks for your input, quietcreep!quietcreep wrote:Hope I helped.
Dreams come true.MeldaProduction wrote:Ok, so good news is I spent some more time hacking CoreAudio and found it! So it will work.
The same with PatchWork even after loading project - double start to correct latency.MeldaProduction wrote: You'll need to restart playback 2x in Logic.
