Category Archives: music

CoreAudio Taps for Dummies

I’ve finally spent some time on implementing CoreAudio taps in SoundPusher 1.5. These let you listen in on (“tap”) the output that is generated by certain processes or sent to certain devices.

So far, SoundPusher has done this with a loopback device that reflects any output it receives back into an input stream that looks to the system like a (6-channel) microphone. This has required increasingly more permissions from the system to access microphone input (since the OS doesn’t know what the SoundPusher Audio device records), and results in a big orange blob in the menu bar to warn the user that they’re being recorded.

Apple has started to provide APIs for recording system audio through audio “taps”, and if they’re good enough for Rogue Amoeba than maybe they’re good enough for me as well.

Unfortunately, Apple’s developer documentation is terrible as usual even though the actual C headers contain some more information. So this is mostly what I’ve figured out.

Taps work by attaching them to an aggregate device using the kAudioAggregateDeviceTapListKey in the dictionary provided to AudioHardwareCreateAggregateDevice(). See https://github.com/q-p/SoundPusher/blob/v1.5.1/SoundPusher/AudioTap.mm#L52 for an example.

The aggregate device with the tap (and nothing else — initially I put the device I was tapping into the aggregate device as well but that only confused matters) will then provide an input stream that contains the tapped data. This is similar to reading from a (virtual) microphone, so I didn’t have to change the rest of the code much. Starting to read from such a tap requires a TCC / privacy authorization and results in a less obnoxious purple dot compared to the orange microphone blob. There doesn’t seem to be a way to query this authorization status as is possible for the microphone access using [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio], so if the user denies this request all you will get is silence (and you cannot inform them about the authorization status since you don’t know).

Do note that if the device you’re tapping also contains input streams (like my SoundPusher Audio loopback device did), then you will in addition still need microphone access to tap that device. I have tried all sorts of ways to disable the input streams to avoid the microphone permissions when tapping a device with inputs, but no such luck. That’s why I have removed all input (and therefore loopback) support from SoundPusher Audio.

Why is this dummy device then needed at all? Because I need 5.1 channels of input data, and unless the user has a real 6 channel audio device, there won’t be anything good to tap. The system can provide a mono or stereo mix-down when tapping, but if you want something more specific than that, then you need a real (fake) device to prescribe the shape and format you want tapped…

Zoë Keating – Into the Trees

Ever since I’d stumbled upon her live performance of Escape Artist for Wired, I’ve been looking forward to be able to actually buy the song. Now the album it’s on, called “Into the Trees”, is out. =)
It’s full of instrumental cello music, layered very deeply using things like loop-pedals (a bit like DubFX for example) and other techno-thingamajigs.
Nice mixtures of sweeping arrangements with rhythms and staccato / picked sequences, reminds me of the music used in Braid in places.

Highly recommended. Listen / buy here.

Regina Spektor – Far (+misc)

Piano-pop music (a bit similar to Ben Folds). Really like the album, but the incessant repetition of some of the lyrics goes on my nerves, as do the Hallelujahs.
Stand-outs: Dance Anthem of the 80’s, Eet, The Calculation.

Other music I’ve recently picked up:
65daysofstatic – The Fall of Math
The Tings Tings – We Started Nothing
Anna Ternheim – Seperation Road
Laura Marling – Alas I Cannot Swim

Music for 2007

While coding during the last month I’ve been listening to a lot of music via Pandora (a music recommendation service / internet radio station). I’m listing some of the stand-out tracks / artists I’ve enjoyed here

  • Röyksopp – The Understanding (Norwegian, kinda groovy, kinda poppy)
  • Amos Lee – Keep It Loose, Keep It Tight (relaxed)
  • UNKLE – Reign (electronic strings + big beats)
  • Crooked Fingers – Dignity and Shame (piano with slightly odd vocals)
  • Cat Power – I Found a Reason (via V for Vendetta)
  • The Prodigy – Voodoo People (Pendulum Remix) (more aggressive and faster than the original)
  • Kasabian – Club Foot (from Tony Hawk’s Project 8 trailer)
  • Frou Frou – Details (pop-rock with nice female vocals, now part of Imogen Heap)
  • M83 – Teen Angst (from the A Scanner Darkly trailer)
  • Alpinestars – Carbon Kid (from the Test Drive Unlimited soundtrack, sounds like guest vocals from Placebo)
  • Rosie Thomas – When We Were Small (Farewell, Wedding Day, Bicycle Tricycle)
  • Ryan Star – Songs from the Eye of an Elephant (piano ballads)
  • Beazley Phillips Band – Shooting Ghosts (see above)
  • Camera Obscura – Pen and Notebook (female vocals + piano)
  • Apparat – Komponent (supposedly intelligent dance music (IDM), reminded me a lot of The Notwist)
  • Apparat & Ellen Allien – Orchestra of Bubbles (this actually is IDM, song tip: Rotary)
  • Statistics – Leave Your Name & Often Lie (alternative rock with some electronica, try A Number, Not a Name or Nobody Knows Your Name)

Pandora (and other music)

I’ve accidentally stumbled onto Pandora, a twisted combination of a subscription-paid custom-playlist radio station and music discovery service. You enter an artist or song name and it starts playing “similar” music; you can have several of these stations to which you can add more and more interests. The first 10 hours are free, and after that it’s either $12/quarter or $36/year, which IMO is rather fair. You can pause and skip tracks (skipping is limited to a certain number of songs per hour). On the technical side, it just needs flash player 7 and streams in 128kpbs.
Onto a few recommendations. For a few songs I’ve bothered adding iTunes Music Store links simply for convenience:

What’s new…

A bit of product placement:
The new Ben Folds album “Songs for Silverman” is out (in the iTunes Music Store as well — I honestly cannot remember the last time I bought a physical CD), the same goes for Trackmania Sunrise (at least in the UK, Germany is due this Friday, US some-when in May), a fast-paced puzzle/racing game only available for PC; well worth it in any case (EuroGamer review).
Also out this Friday is Apple’s new iteration of MacOS X, Tiger; whether that’s worth paying for is up to each individual; I plan on trying out the overhauled developer tools to finally port my wavelet-toolkit…