Triforce – a beamformer for Apple Silicon laptops

(github.com)

Comments

derhuerst 24 March 2025
blog post with the background story why this was created: https://asahilinux.org/2025/03/progress-report-6-14/#is-this...
com2kid 24 March 2025
Over 20 years ago I had a Toshiba Tablet PC convertible that had a beam forming array of microphones and it came with software that let you point where you wanted to record from.

The use case was for lectures, you could tell the laptop to just record from behind it, pointing the beam in the direction of the professor.

Amazing idea and something I haven't seen since.

Tade0 24 March 2025
My (never finished) master's thesis was about something similar - taking advantage of the fact that (almost) all smartphones have at least two microphones I wanted to locate and separate a speaker in 3D.

A few takeaways:

-The sampling rate is slightly off between devices - approximately ±1 sample per second - not a lot, but you need to take that into account.

-Spectral characteristics in consumer microphones are all over the place - two phones of the same model, right out of the box, will have not only measurable, but also audible differences.

-Sound bounces off of everything, particularly concrete walls.

-A car is the closest thing to an anechoic chamber you can readily access.

-The Fourier transform of a Gaussian is a Gaussian, which is very helpful when you need to estimate the frequency of a harmonic signal (like speech) with a wavelength shorter than half your window, but just barely.

rob74 24 March 2025
Wow, this really puts into perspective how much work has to be put into even the most insignificant details of getting Linux to run on (Apple Silicon) Macs. I say "insignificant" with all due respect because, well, the built-in microphone sees very little use (except if you have forgotten your headset).

Or, to quote the progress report (https://asahilinux.org/2025/03/progress-report-6-14/#is-this...): "This is Apple though. Nothing is ever simple."

marmarama 24 March 2025
You can get surprisingly good results from cheap laptop hardware (as well as fancier hardware like an MBP) using software DSP techniques. One of the things I'm pleased about is that quite a bit of Asahi's audio work is just as applicable to generic laptops as it is to Macs.

I already use the Bankstown bass harmonics synthesis plugin developed for Asahi and a convolution EQ on a cheap HP laptop, with startlingly impressive results, using the Pipewire plugin chain autoload feature also developed for Asahi.

I suspect there are quite a few use cases for this beamformer outside of the Asahi ecosystem as well.

raphlinus 24 March 2025
Regarding the SIMD optimizations, the authors may want to look into faer. I haven't had a great experience with its underlying library pulp, as I'm trying to things that go beyond its linear algebra roots, but if the goal is primarily to accelerate linear algebra operations, I think it will go well.

I've got a blog post and associated podcast on Rust SIMD in the pipeline, we'll touch on this.

[1]: https://docs.rs/faer/latest/faer/

pvg 24 March 2025
Github repo https://github.com/chadmed/triforce
pzo 24 March 2025
> the microphone array found in the following Apple Silicon laptops: > MacBook Pro 13" (M1/M2) > MacBook Air 13" (M1/M2) > MacBook Pro 14" (M1 Pro/Max, M2 Pro/Max) > MacBook Pro 16" (M1 Pro/Max, M2 Pro/Max) > MacBook Air 15" (M2)

Does it mean M2/M3 don't have similar array of microphones or rather not tested?

I'm even curious if this is only supported on Linux or MacOS as well - not sure if apple provides dedicated microphone stream for each mic?

GeekyBear 24 March 2025
There is a more general discussion on the latest Asahi Linux progress report.

> Unfortunately, PDM mics are very omnidirectional and very sensitive. We cannot get by without some kind of beamforming.

https://asahilinux.org/2025/03/progress-report-6-14/

Also, it turned out that some previous work done for the speaker output was reused here for mic input.

> Thanks to the groundwork laid in PipeWire and WirePlumber for speaker support, wiring up a DSP chain including Triforce for the microphones was really simple. We just had to update the config files, and let WirePlumber figure out the rest!

JohnBooty 24 March 2025

    Much like with the speakers, Apple are trying way too hard to be fancy here
Could the author of this package comment on this statement? I'd be really interested in their opinion of their speaker implementation.

What's overly complicated there? The hardware? The software?

As a MBP user and hobbyist audio guy I've been really impressed with the implementation of those speakers, particularly on the larger MBP models.

But I'm just a hobbyist and don't have any knowledge of them other than the driver arrangement (tweeter + dual opposed woofers). It certainly seems like they're pulling the same tricks used by "good" bluetooth speaker designers in order to wring acceptable perf and bass extension from teeny tiny speakers (adaptive EQ etc)

llm_nerd 24 March 2025
For the software to perform beamforming it must be provided the discrete microphone inputs, as opposed to being provided some sort of pre-mixed feed. As such, why is Apple "trying way too hard to be fancy here" if you can just use one of those mics? Or is the alternative that they do the "beamforming" in hardware regardless of the OS?
apitman 24 March 2025
> This is an attempt at a beamformer armed only with first year undergrad level engineering maths and some vague idea of the principles gleaned from various webpages and PDFs

Not certain if OP is saying they are currently an undergrad, but impressive if so

amelius 24 March 2025
It would be great if this was implemented in a way that also other manufacturers can easily start building mic arrays such that it would make them immediately useful.
swyx 24 March 2025
ok noob here - what can i use this thing for? a better desktop-only voice app?

is there a reason apple hasn't exposed a higher level api for this given the hardware (mic array) looks like it's already sufficient in macs?

qoez 24 March 2025
You should be able to send data and record it in a way that measures local geometry like hands since there's a microphone array like this, interesting.
everfrustrated 24 March 2025
I can't speak for this implementation, but on MacOS, the beamforming is amazing. When used in a noise office or cafe environment it eliminates background noise to an extent I can always tell if a colleague is using it or their worse headphone mic.
7e 25 March 2025
It’s funny how the author has the chutzpah to simultaneously insult Apple and while also failing to replicate what they have done.
neuroelectron 24 March 2025
I'm really enjoying this trend of minimal dependencies, but I'm not taking off my tinfoil hat yet.
parasubvert 25 March 2025
This is one of the cooler features of Apple Vision Pro, it does such good beamforming for the wearer's mouth that someone could be screaming next to you or blasting music, and other parties on Zoom or FaceTime will not hear them.
m463 24 March 2025
I wonder if there's a way to do this in reverse for people who use the speakerphone or play a video in a restaurant.
mmaunder 24 March 2025
Is this akin to a phased array RF antenna (like the Starlink dish) but for audio?
jedisct1 24 March 2025
How to download and install the app? There are no instructions.
boesboes 24 March 2025
> Much like with the speakers, Apple are trying way too hard to be fancy here, and implement an adaptive beamformer in userspace to try and isolate the desired signal from background noise.

Might be fancy, but it does make for surpisingly good audio from a laptops.

_zoltan_ 24 March 2025
I think the title should say "for asahi linux", else it's misleading.

of course Apple has this implemented.

Aurornis 24 March 2025
> Much like with the speakers, Apple are trying way too hard to be fancy here, and implement an adaptive beamformer in userspace to try and isolate the desired signal from background noise.

That’s a rather unfair characterization. I’ve found the array to work very well in practice. It’s hardly trying to hard.

CaffeineLD50 24 March 2025

  /_\
/_\/_\

Triforcin'

gregjw 24 March 2025
I have no idea what any of this means