Audio

January 29, 2026 ยท View on GitHub

Spotify

Popular streaming music service.

See the Spotify page.

Shazam

Listens to a song and matches its name using an online database.

See the Shazam page.

Migrate Playlists Between Music Platforms

See the Spotify page.

Shazam Songs while using Headphones on Mac

Capture those tunes from your favourite movies or TV shows while you're listening with headphones.

Create an aggregate multi-output audio device with your headphones and a dummy output, and then point Shazam to the dummy output to link it to the audio.

On Mac, you can do this by:

  1. install Blackhole (choose the 2ch device)
brew install --cask blackhole-2ch
  1. restart for the new Blackhole 2ch device to be usable

  2. Cmd+Space to open Spotlight and search for Audio Midi Setup App

or from the command line:

open -a "Audio Midi Setup"
  1. Click + and Create Multi-Output Device
  2. Add your headphones and Blackhole 2ch to the multi-output audio device
  3. Switch the sound output to use the new Multi-Output Device, via GUI or on the command line:
brew install switchaudio-osx
SwitchAudioSource -t output -s "Multi-Output Device"
  1. The Shazam app settings follows the system sound input device, set it to use the Blackhole 2ch device
SwitchAudioSource -t input -s "BlackHole 2ch"
  1. Shazam away!
open -a Shazam

If you want to set the system sound effects, such as moving files, to go to the multi-output audio device into the headphones too (to not disturb somebody sleeping next to you) then you may want to go to System Settings -> Sound -> Sound Effects and set Play sound effects through near the top to the Multi-Output audio device.

Automatically Switch to Using Multi-Output Device when Connecting Headphones

When I connect my AirPods they become the sound input and output device, and this needs to be switched back to the blackhole input and multi-output device to be able to Shazam again.

You can automate this by triggering the SwitchAudioSource command upon a system event using Hammerspoon to trigger whenever AirPods connect to bluetooth.

Install Hammerspoon as a system event handler to trigger your SwitchAudioSource command.

See the Mac page's Hammerspoon - System Event Handler section for setting up Hammerspoon with the exact Hammerspoon Lua code I use to trigger this automated switch back to the first Multi-Output and BlackHole input devices found.

:octocat: HariSekhon/Hammerspoon

MP3 metadata editing

Use the id3v2 program to set metadata on mp3 files.

Useful to group a bunch of mp3 files for an audiobook.

Setting Author and Album metadata

Set the --author / -a and --album / -A tags at once so Mac's Books.app groups them properly into one audiobook:

id3v2 -a "MyAuthor" -A "MyAlbum" *.mp3

The scripts mp3_set_artist.sh and mp3_set_album.sh in the DevOps-Bash-tools repo's media/ directory make it slightly easier.

Setting Track Number metadata

Set the --track number for each mp3 file, so they play in the right order:

i=0
for x in *.mp3; do
  ((i+=1))
  id3v2 -T $i "$x"
done

The scripts mp3_set_track_order.sh and mp3_set_track_name.sh in the DevOps-Bash-tools repo's media/ directory make this slightly easier.

Recursively Set Metadata

Recursively Set Artist and Album

XXX: Danger - use only in an audiobook subdirectory, otherwise it'll ruin the metadata of your MP3 library!

find . -maxdepth 2 -iname '*.mp3' |
{
  i=0
  while read mp3; do
    ((i+=1))
    id3v2 -a "MyAuthor" -A "MyAlbum" "$mp3"
  done
}

Recursively Set Track Order

For subdirectories eg. CD1, CD2 etc...

XXX: Danger - use with care - if misused at the top dir it'd ruin your MP3 library's metadata!

find . -maxdepth 2 -iname '*.mp3' |
{
  i=0
  while read mp3; do
    ((i+=1))
    id3v2 -T $i "$mp3"
  done
}

Other Metadata Tools

Picard by MusicBrainz

https://picard.musicbrainz.org/

:octocat: metabrainz/picard

Open source database that can be used to auto-tag music files.

Memes

Marketing Matters

Marketing Matters