I opened a Stack Overflow question associated with this. https://stackoverflow.com/questions/68621251/routechangenotification-and-os-media-reset-lost-not-working-after-setpreferredi
Post
Replies
Boosts
Views
Activity
I recently found there's a Wiener filter inside vDSP. I wonder if they use this inside Voice Memos.
I can easily reproduce this crash when I call AVAudioSession.sharedInstance().setPreferredInput(...) over a wired headset mic.
By calling setPreferredInput over a wired microphone, my AVAudioSession.routeChangeNotification do not notificate when I unplug a wired headset while this headset is both the preferredInput and the active input, as seen in session.currentRoute.inputs.first.
All the notification handlers (OS Media Reset, OS Media Lost, Interruption, etc) do not fire when I unplug a headset in the condition above.
To protect my audio graph, I stop the audio engine and reroute it when I set the headset mic as the preferred input, in a attempt to not be in the mercy of route change notifications in this particular case.
Finally, node.play() crashes when called.
The crash above happens when my engine is active, since I must activate a engine before playing any player node.
Hi fritza, sorry about being a little late for answering.
Their (labyrinthine) pseudocode appears to slide a snippet ("template;" kernel?) across a data stream looking for goodness-of-fit by correlation coefficient. This is for each of several templates, so performance is at a premium.
In the way you describe it, looks like a convolution - https://en.wikipedia.org/wiki/Convolution of two signals. Since you are trying to find a cross-correlation - https://en.wikipedia.org/wiki/Cross-correlation when sliding both signals, you must perform a cross-correlation.
It's similar to a convolution process. Theoretically, a cross-correlation is a convolution without reversing one of the signals before sliding it (the point is that, in my experience, there are more already-written code for convolution than for cross-correlation).
You must consider some situations: in most algorithms, the length of both discrete-time signals must be the same, so you may need to append zeros in the end to match it.
you can reverse one of the signals and use the convolution function from vDSP.