💾 Archived View for rulmer.xyz › songmem.gmi captured on 2024-03-21 at 14:47:27. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

Go back

Music recommendations (and how I generated them)

          ooo     oOOO
     oOOOo   OooOO    O
   OO  OOO       OO    O
 OO     OOO       O     O
O    o   OOOo      OooooO
OoooO OoO    O   oOO
   O    O    OoooOOO
    O    OoOO     oOOo 
   Oo    ooo      oOOOOo
     OooO   O   oOOOOOOOo
 oOooOOOo   OooOOOOOOOOOoo
  oOOOOOO   OOO            o
       OOO OO               o

This article contains two parts: I'll start by sharing some of my favourite songs, diving into a few genres I enjoy. After that I will show how I keep track of what I hear and how I generated the recommendations from the first part.

Recommendations

These are the ten songs I've listened to the most over the past three years:

$ songmem --favourite | head
Tempers - What Isn't There
Papertwin - Alkaline
Lovers Revenge - Dreams
Tempers - Eyes Wide Wider
Daniel Deluxe - Territory
Beach House - Space Song
Waveshaper - Radio Signal
Calamine - Trampoline
Oliver Tree - Enemy
Gatekeeper - Chains

It's a bustle of tracks I enjoy in different moods and through different phases. I'll try to group them and give you an insight into what I enjoy about them.

Dark synth-pop and darkwave

The two Tempers songs are part of my dark "gothy" favourites. It's a genre that features themes of rejection, death, fear, loss and loneliness. At a first glance this might seem depressing and you could think people listen to music like this, just to wallow in sadness. This is not how I view it.

I feel like the artists of this sphere are making an effort to embrace dark emotions instead of pushing them aside. It's easy to feel alone, when facing problems in an environment where people mostly share their joy, but these artists dare to share their unpleasant feelings and I find that comforting. However, I'm not interested in becoming comfortable with despair; instead I view this dark music as a way to confront emotions and gain clarity. When you listen to a few tracks of this genre, you'll find that many are quite energetic and maybe you can even see how they might feel uplifting. Here are a few songs of this kind:

$ songmem --suggestions "Tempers - Eyes Wide Wider" | head -n 13
Tempers - What Isn't There
Sixth June - Never Leave Me
Tempers - Undoing
Tempers - Hell Hotline
Prudence - Your Funeral
Crystal Castles - Vanished
Vore Aurora - Envenom
Tempers - Strange Harvest
Tropic of Cancer - More Alone
ILLUSTRATION SONORE - Flying Lights
Cabaret Nocturne - Blind Trust
Pleasure Symbols - Ultraviolence
Xiu - Why We're Gone

Dark synthwave

Lingering a little longer in the shadows, let me introduce you to a little more "electric", more proactive section of my music library. In my favourites you saw 'Daniel Deluxe - Territory' and 'Gatekeeper - Chains'. These tracks feel dystopian to me and in my mind they are connected to cyberpunk themes. I listen to these when I am feeling energetic, but have become bored of the "light" music in my library. Here's a handful of tracks like that:

$ songmem --suggestions "Daniel Deluxe - Territory" | head -n13
Daniel Deluxe - Darkness
Daniel Deluxe - Almaz
Gatekeeper - Chains
Daniel Deluxe - Sojourn
Power Glove - Motorcycle Cop
Daniel Deluxe - Star Eater
Maniac Lover - The Victim Machine
Murkula - Goredello
Power Glove - Crypt
Power Glove - Nightmare
Power Glove - Power Core (Extended Version)
ALEX and Tokyo Rose - Antagonist
Vector Seven - Trauma Team

Lofi Synthwave

Dark music is not all I listen to. Let me end my suggestions with something more light: tracks like 'Papertwin - Alkaline', 'Beach House - Space Song' or 'Waveshaper - Radio Signal' I would describe as dreamy and laid-back music, well suited for a rainy afternoon in an armchair with some hot tea. Here's some more of that:

$ songmem --suggestions "Papertwin - Alkaline" | head -n5
Waveshaper - Radio Signal
Molly Nilsson - Mountain Time
Lovers Revenge - Dreams
Chromatics - Running Up That Hill
De Lorra/Augustus Wright - Endless
$ songmem --suggestions "Molly Nilsson - Mountain Time" | head
Waveshaper - Radio Signal
Papertwin - Alkaline
Beach House - Space Song
Droid Bishop - Nightland
Lovers Revenge - Dreams
Trevor Something - Fade Away
MALO - March of Progress
Kavinsky - Nightcall
Lifelike - So Electric
quadle - Deep Purple

How I generated the suggestions

You will have noticed the word songmem above. It is a command line program that I wrote to keep track of what songs I listen to. After a while it will learn which songs I find similar and becomes able to make suggestions. With this, I am able to create "unique playlists" on the fly without having to think much about it. This has become my main way of playing music and I like how it enables me to perfectly mold my music stream to my current mood.

You can get songmem by cloning git@github.com:codesoap/songmem.git and following the instructions in the README.

Tracking heard songs

The first and most important step is to register the songs you heard with songmem. This is done with e.g. `songmem --register 'Low Hum - Comatose'`. Of course, this would be very tedious to do manually every time. It needs to be automated. I can show you how to do this with the mpd music player; starting this script and letting it run in the background would basically work:

while song="$(mpc -f '%artist% - %title%' current --wait)"
do
	songmem --register "$song"
done

The script I'm using is a little more convoluted though, because I want to register the song only if it has been playing for at least 20s and I also had to workaround some instability:

$ cat ~/bin/songmem-mpd
#!/usr/bin/env sh

# Extra loop, because mpc failed me once with
# "MPD error: Socket connection aborted".
while true
do
while song="$(mpc -f '%artist% - %title%' current --wait)"
do
        # Kill background processes from previous loops:
        pkill -P "$"

        # Register a hearing of the started song, if it is still playing
        # after 20s:
        sleep 20 \
        && mpc status | grep -q 'playing' \
        && songmem --register "$song" &
done
done

Querying songmem

After you've tracked your listening patterns for a while, you can ask songmem to analyze the collected data. You can call `songmem | head` to see which songs you heard last, `songmem --favourite | head` to see the songs you heard most or `songmem --frecent | head` to get a list of songs you recently heard a lot.

Most interesting, however, is probably `songmem --suggestions '<your-songname-here>' | head`. It will check which songs you often heard before or after the given song.

Typing these commands is impractical for everyday use, so I encourage you to write your own little script(s) around songmem. I've got one I call "sng" (it's quick to type); it lists suggestions for the last heard song, let's me select one with fzf and queues it in mpd automatically. Here is some inspiration to get you going:

# This script assumes that all songs are stored like "Artist - Song title".
song=$(songmem --suggestions "$(songmem | head -n1)" | fzf)
artist=$(printf '%s' "$song" | awk -F ' - ' '{print $1}')
title=$(printf '%s' "$song" | awk '{i=index($0, " - "); print substr($0, i+3)}')
mpc add "$(mpc search artist "$artist" title "$title" | head -n1)"

Shortcomings

This works well for me in most cases, but there are some scenarios, where songmem becomes less useful:

- When it's impossible to integrate songmem with your music player.

- If you mostly listen to full albums, songmem will mostly suggest other songs from the album you just heard.

- If you spell the same song differently when registering it with songmem, it will not recognize the song.

Closing words

I hope you found something interesting in here. There is a lot more I could write about the technical details or my scripts and tools around songmem, but this article has become quite lengthy already. Don't hesitate to contact me, if you have any questions or comments.