logo
On this page
2022-11-15

How to implement system sound card capture on Mac?

Products / Plugins:Video Call / Audio Call / Live streaming
Platform / Framework:macOS

Background

On Windows and Mac platforms, ZEGO SDK supports using the enableMixSystemPlayout interface to capture through the system sound card and mix the sound played by the system into the stream publishing. For example, sound played by a browser, sound played by third-party player software, etc.

Limitations

Windows supports this feature by default, but Mac requires the use of plugins such as SoundFlower or BlackHole, and has the following limitations:

  • MAC Intel chip series: supports SoundFlower and BlackHole plugins.
  • MAC M1 chip series: only supports BlackHole plugin.

Usage

Installation and Use of Soundflower

Note

Soundflower only supports installation and use on MAC Intel series.

  1. Download Soundflower, get the Soundflower-2.0b2.dmg installation file, and double-click to open it.
  2. Double-click Soundflower.pkg to start the installation.
  1. (Optional) If you encounter permission issues during installation, you need to select "Security & Privacy" > "Open Anyway" in "System Preferences" and reinstall.
  1. Configure "Audio MIDI Settings".
    1. Use the shortcut key command + space (SpotLight), enter "MIDI" in the search box to search, and enter the "Audio MIDI Settings" interface.
  1. Create a new multi-output device. In the lower left corner of the audio device interface, select "+" > "Create Multi-Output Device".
  1. Select "Built-in Output" as the main device, select 44.1kHz as the sample rate, and check both "Built-in Output" and "Soundflower(2ch)".
  1. In the left navigation of the audio device interface, right-click "Multi-Output Device" and select "Use this device for sound output" and "Use this device for alerts and sound effects" respectively to set the system default sound output and alert output.

At this time, the "speaker" icon on the built-in output will be displayed on the multi-output device.

Installation and Use of BlackHole

Note

BlackHole supports installation and use on MAC Intel series and MAC M1 series.

  1. Download BlackHole, get the BlackHole2ch.v0.4.0.pkg installation file, and double-click to start the installation.
  2. (Optional) If you encounter permission issues during installation, you need to select "Security & Privacy" > "Open Anyway" in "System Preferences" and reinstall.
  1. Configure "Audio MIDI Settings".

    1. Use the shortcut key command + space (SpotLight), enter "MIDI" in the search box to search, and enter the "Audio MIDI Settings" interface.
    2. Create a new multi-output device. In the lower left corner of the audio device interface, select "+" > "Create Multi-Output Device".
  1. Select "Built-in Output" as the main device, select 48kHz as the sample rate, and check both "Built-in Output" and "BlackHole 2ch".
  1. In the left navigation of the audio device interface, right-click "Multi-Output Device" and select "Use this device for sound output" and "Use this device for alerts and sound effects" respectively to set the system default sound output and alert output.

At this time, the "speaker" icon on the built-in output will be displayed on the multi-output device.

Enable System Sound Card Capture

After completing the installation and configuration of Soundflower or BlackHole, we can capture the sound played by the system while also hearing the local playback sound through speakers or headphones.

Mac can enable sound card capture by calling the SDK interface enableMixSystemPlayout and setting the parameter enable to YES, mixing the sound played by the system into the stream publishing.

Set the volume of system sound card capture

Note

After creating a multi-output device and setting the multi-output device as the system default sound output, the Mac keys "F10"/"F11"/"F12" will not be able to adjust the volume, because these 3 keys are only valid when the system default sound output device is a "non-aggregated device".

After using Soundflower or BlackHole, you can set the volume of system sound card capture in the following ways:

  • Method 1: Use the SDK interface setMixSystemPlayoutVolume to set the volume of system sound card capture.
  • Method 2: In the MIDI interface, separately adjust the input or output volume of Soundflower or BlackHole. Both can reduce the volume captured from the system.

Previous

Why can't I make calls through a Bluetooth device after connecting a Bluetooth device to iOS or Android?

Next

How to switch between screen sharing stream and camera video stream?

On this page

Back to top