Skip to content

Conversation

@TnTora
Copy link
Contributor

@TnTora TnTora commented Jan 14, 2026

This is my first attempt at integrating loopback recording on Mac as mentioned in #194.

For now, I placed the code necessary to generate the loopback device under the helper class _CoreAudio. Let me know if you would prefer it having its own helper class.

Based on the requirements for this sample project from Apple, I decided to check for loopback support using platform.mac_ver and setting 14.2 as a minimum requirement.

With the current implementation, once the user calls all_microphones(include_loopback=True) for the first time, a loopback device is created. Its id is used as a key in the dictionary _CoreAudio.loopback_devices while the id of the tap object is stored as its value. Whether or not a device is loopback is determined by its id being present in the dictionary.

This id values can be used to destroy the device. I am uncertain whether or not there is a need to actively destroy every device. I set them up to be private which means they are linked to, and only accessible from, the process which created them and from my observations they seem to disappear once the process is stopped.

If I can manage to make process inclusion and exclusion work under cffi, I was thinking the create_loopback_device function could be exposed to the user to give better control over the tap options. If you think it would be outside the scope of this library let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant