0

I wish to create an app that will preprocess microphone input before sending it on to the rest of the system.

Something like this:

[Mic Audio Unit] -> (...)

[Mic Audio Unit] -> [My app transforms audio] -> (...)

Now my guess is that this is most likely impossible on iOS. My guess is that any app can access raw microphone input, and that apps aren't allowed system-level permissions on the audio pipeline.

But I'm not sure, and I can't find a definitive yes or no anywhere.

P i
  • 29,020
  • 36
  • 159
  • 267
  • This better not be possible. What a security nightmare this would be. – HangarRash Jan 28 '23 at 17:50
  • I think you’re assumption is probably correct. You only ever recover a copy of the input device buffer, never the original. This means you can have lots of processes accessing the memory workout cross talk. see https://developer.apple.com/documentation/avfaudio/avaudionodetapblock?language=objc – fdcpp Jan 28 '23 at 17:57
  • In the depths of core audio you might be able to access a pointer to the input memory, but any attempt to edit the data I imagine would be picked up and crash the program as bad memory access. My understanding is that since this is low level data , it’s the kernel dealing with it. My question is “Would writing into input buffers cause a kernel panic or just a crash ?” – fdcpp Jan 28 '23 at 18:01

1 Answers1

1

The stock iOS security sandbox does not allow an app to intercept audio to other apps. An app can write to its audio input buffers, but these audio input buffers are private between iOS and each apps, and not visible to other apps (as each app can have its own audio input buffer format, data type, and sample rate, etc.). There is an old deprecated inter-app audio API still available in iOS, but all apps involved have to include and participate in this API to exchange audio data.

hotpaw2
  • 70,107
  • 14
  • 90
  • 153