Skip to content
asger3pPublic

About

Spotify in your Mac's menu bar: cover art and song, one-click like, a player a click away, synced lyrics under the notch, and studio-style analysis of what you're hearing.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

13 Commits

Folders and files

Repository files navigation

Barsong

Spotify in your Mac's menu bar: the cover and the song up top, a one-click like, a player a click away, synced lyrics under the notch, and studio-style analysis of what you're hearing.

Barsong is an independent project, not affiliated with or endorsed by Spotify. There's no prebuilt download: it's built from source with one command (see Install).

The menu bar item with the cover, song and like button, and synced lyrics floating underneath

Features

Menu bar

  • The album cover and "Artist – Title", with a pause badge while paused. The text can be reordered, shortened or hidden, and sits on an optional pill.
  • One click on + adds the song to Liked Songs; the check mark removes it. It appears once a Spotify account is connected (see Connect your Spotify account).
  • A lyrics button turns the floating lyrics on.

Player

  • Play/pause, previous, next, shuffle, repeat, a scrubber, and Spotify's own volume.
  • Click the title or cover to open the song in Spotify, the artist or album to open those, or the copy button for its link.
  • Full and compact layouts, a pin to keep the player open, and your choice of accent colour.

Lyrics

  • Synced lyrics in a floating pill below the menu bar, draggable anywhere, in four styles.
  • Click a line to jump to it, or expand to a full-height view of the whole song.
  • From LRCLIB, with NetEase as a fallback. The timing can be nudged if it drifts.

Visualizer

  • Nine studio-style views of Spotify's audio beside the player: spectrum, spectrogram, scopes, level and loudness meters, and key. See Visualizer below.

General

  • Open at login.

Visualizer

Full screen: the player beside all nine visuals, from the spectrum analyzer to the chromagram

The visualizer column sits to the right of the full player. Click a visual, or use the ‹ › arrows above it, to switch.

  • Full screen: the expand button in a visual's corner opens a full-screen view, with the player on the left and every visual at once.
  • Pausing: freezes the picture exactly as it was, so you can study it, and listening stops until you press play.

How the data is collected

  • What a tap is: a Core Audio process tap on Spotify's own processes. The system hands Barsong a copy of the audio those processes send to your output device: nothing is heard through a microphone, no other app's sound is in the stream, and Spotify plays on untouched.
  • When it listens: only while a visual is on screen and the music plays. Pausing removes the tap, and a new track restarts the loudness, key and tempo measurements, which take a few seconds to settle.
  • What is done with it: every visual is drawn from one analysis pass over that audio — the levels and the loudness meter from each chunk as it arrives, the spectrum, waveform, spectrogram, notes, key and tempo from short windows of it, up to sixty times a second.
  • What gets measured is Spotify's output, after its volume and Normalize volume settings — which is why the loudness meter asks for 100%.

Requirements

  • macOS 13 or later. The visualizer needs macOS 14.2 or later and the System Audio Recording permission.
  • The Spotify desktop app.
  • For Liked Songs and the artist and album links: a Spotify account that can create a developer app. Spotify currently requires Premium for that.

Install

Clone it and run the installer:

git clone https://github.com/asger3p/barsong.git
cd barsong
./install.sh

That's all of it. install.sh checks that you're on a new enough macOS and that the Xcode command line tools are there — starting Apple's installer for you if they aren't — then builds the app, installs it to ~/Applications/Barsong.app and opens it. Run it again to update.

If you'd rather skip the checks, ./build.sh does the build and install on its own.

First run

macOS asks for two permissions:

  • "Barsong wants to control Spotify": needed to read the current song and cover, and to play, pause, skip, seek and change the volume. Barsong doesn't start Spotify on its own: it only launches it if you click the cover or title while nothing is playing.
  • System Audio Recording: only asked when the visualizer first opens. It lets Barsong tap Spotify's own processes (see How the data is collected); Spotify keeps playing normally and no other app's audio is included.

Both can be changed later in macOS System Settings → Privacy & Security.

Connect your Spotify account

Liked Songs and the artist and album links use the Spotify Web API. Each user signs in through a small Spotify app of their own, so there's no shared key and no user limit. Barsong walks you through it under Settings (gear icon) → Spotify Account:

  1. Create a Spotify app. "Open Spotify dashboard" takes you to the form. Copy in the app name and the redirect URI (http://127.0.0.1:43117/callback) with the copy buttons, tick Web API and save.
  2. Paste its Client ID, found under the app's Settings. Barsong connects as soon as a complete Client ID is pasted.
  3. Approve in the browser. This starts by itself once the Client ID is in; the Connect button starts it again if it doesn't. After that, Barsong keeps you signed in.

Privacy

Barsong talks to five places, and only these:

  • LRCLIB (lyrics): the artist, title, album and length of the current song. If that finds no synced lyrics, a second request sends just the artist and title to its search endpoint. These requests identify themselves as Barsong/1.0.
  • NetEase (fallback lyrics, only when LRCLIB has none): the artist and title as one search string, then the id of the matching song — no album, no length. These requests identify themselves as Barsong/1.0 too.
  • Spotify's accounts service (signing in): the one-time code from the browser and your refresh token, exchanged there for the access tokens the Web API needs.
  • Spotify's Web API (Liked Songs, artist and album links): track, artist and album ids, with the token from your own developer app.
  • Spotify's image servers: the cover, from whatever URL Spotify reports for the current track.

Everything else stays on your Mac:

  • Settings and your Client ID are kept in the app's preferences, which are not encrypted.
  • The Spotify refresh token is kept in your Keychain. Access tokens are held in memory only.
  • Audio is analysed live in memory and never stored or sent anywhere.

Troubleshooting

  • No cover, or the buttons do nothing: allow Barsong under System Settings → Privacy & Security → Automation → Spotify.
  • The visualizer says "No sound coming through": allow Barsong under System Settings → Privacy & Security → System Audio Recording, then reopen the player.
  • Connecting fails with "Couldn't listen on port 43117": another program is using that port. Quit it and try again.
  • "Spotify API error 403": check that Web API is ticked for your developer app.
  • No lyrics for a song: neither LRCLIB nor NetEase has synced lyrics for it. The lyrics button shows a crossed-out mic when that's the case.

Uninstall

Turn off Open Barsong at login first (or remove Barsong later under System Settings → General → Login Items), then:

rm -rf ~/Applications/Barsong.app
defaults delete dev.asger.Barsong
security delete-generic-password -s dev.asger.Barsong

Acknowledgements

  • LRCLIB for synced lyrics.
  • NetEase Cloud Music as a fallback lyrics source, an idea borrowed from LyricFever.

License

MIT. See LICENSE.

About

Spotify in your Mac's menu bar: cover art and song, one-click like, a player a click away, synced lyrics under the notch, and studio-style analysis of what you're hearing.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages