Open the Soundflowerbed Application. It should be located in the Soundflower folder which should be in your Applications folder. A black icon resembling a flower should appear in the top right hand corner of the screen near the system time. Click on the Soundflowerbed icon click on the Audio Setup option in the drop down menu. The ATI HDMI Audio Device Driver is a software complement to your sound card. OS: Windows 7 Windows 8.

  • Electron , Javascript , MacOS ,
  • Tags: chrome, electron, javascript, macOS, soundflower
  • 28 Sep

Buildingdesktop applications used to be tedious in the past. With each platform havingits own programming language, and a different way of doing things. Windows,Mac, Linux… We used to have java with “Swing” which was great and crossplatform, but building apps with this was not really fast. Then JavaFX came which was better. But nowadays, we have awesome tools which allows us toleverage the power and ease of use of web technologies to build desktop apps.Electron provides us such capabilities and what is awesome, is that it is crossplatform.

Audio Setup Software Flowering

Recently, we’vehad a situation where I needed to record system sound on a mac alongside video to channel the resulting stream over WebRTC. The application was adesktop app, and obviously built with electron. And as most of you might know,electron apps run chromium and leverages web technologies to build desktopapps.

The Problem: How to Record System Sound on MacOS?

To stream adesktop in real-time with audio and video on electron, you will need the “desktopCapturer”.Then, precise constraints as required by Electron. Though this approach will work on Windows, itwill not work on MacOS. MacOS will simply not allow the system audio tobe captured, but has no problem with allowing the video stream afterpermissions are granted. This is a bug that has been present for years now,this post is about how to handle this issue.

This is aknown issue and while searching, I came across several complaints about thisissue. Some date back to a few years ago. Here you can find an open issue about Chrome notproviding a possible means of recording system audio without external drivers.This report dates back to 2016, now as I’m writing this, we are in 2019. Diggingdeeper into this, I found that it was due to MacOS. The operating system didn’tallow system sound to be captured by default.

In myopinion, the fact that there is no proper solution to this is because thenumber of developers who need to implement system audio capture functionality intoelectron apps is not really significant. I also think it is important tohighlight a point about various solutions to this issue found online. Most ofthe solutions I’ve seen developers bring up, were hacks which aimed at mixingtwo streams from different sources and mixing them. That is, capturingvideo from the desktop, capturing audio from the microphone. Then mixing both. This is an example of what I’m talking about.Though this is the approach we are using in this post, we will get video andaudio streams both from the system.

The Solution

Aftertrying a bunch of possible solutions, we finally came across a final solution.Though it requires a fairly complex installation of third-party software, itworks and permits us to record system sound on MacOS. Let’s dive in.

Audio setup software flowery branch

If you like this post, you can chose to follow me on Twitter or Github and subscribe to this page’s notificationsto stay updated with new articles or like my page on Facebook.

Installing Sound flower:

Sound Floweris an extension to the MacOS kernel, it is open source and it’s made to createa virtual audio output device on MacOS. To install soundflower, you need tofollow these instructions. I recommend you follow theinstructions attentively till the end. Because, after installation, you have tosetup the software so as to enable it to capture MacOS audio.

After the installation of SoundFlower, you can notice with your JavaScript that new audio output devices appear in the OS. As you can see below. The audio output device highlighted is the one we are interested in, and which we will use to record sound system on macOS.

Record System Sound on MacOS with Video

Here arethe steps we will use to record the system sound.

  • Getevery media device on the computer
  • Filterthese media devices and get only the sound flower audio output device wehighlighted above,
  • Extractthe audio stream from the sunflower virtual device we filtered out.
  • Atthis point, you have succeeded in recording system audio on MacOS, but we willadd Video to it.
  • Extractthe video stream
  • Mixthe Video stream with the previous audio stream
  • Getthe resulting stream and perform what ever you want with it.

Here is thecode performing the steps I mentioned above: