0

I want to record audio from multiple microphones simultaneously (Macbook built-in microphone + connected external microphone).

However, AVAudioEngine has only one inputNode. Is it possible to create and attach other nodes that represent specific input device?

msmialko
  • 1,439
  • 2
  • 20
  • 35

1 Answers1

1

You can go into Audio Midi Setup.app create an aggregate device containing the two devices you want to record from, then set that aggregate device as the default input.

Tapping the input node will give you buffers that contain audio recorded from both devices, and as a bonus the audio will be synchronised!

The manual aggregate setup can also be done via Core Audio.

Alternatively you could simply record from the two separate devices using Core Audio's RemoteIO AudioUnits. You will be responsible for timestamp matching in this case. There are pros and cons to both approaches. My own anti-pattern is to write an AVAudioEngine solution then replace it with Core Audio.

aggregate device containing two devices, set as default input

Rhythmic Fistman
  • 34,352
  • 5
  • 87
  • 159