¶ P.S. (and all the other letters) · 9 January 2025 listen/tech
Software ought to be playful. Life ought to be playful, and thus we should want the tools we use to live it to allow or ideally encourage us to play, to improvise and experiment and digress as much as their seriousness allows. For airplane controls or heart-surgery robots the amount of allowable playfulness is probably low, but for most of the things we deal with in software, the software's ability to do arbitrarily frivolous things with an ease proportionate to inconsequentiality is a pretty good gauge of their expressiveness.
Say, for example, you wanted to produce a list of songs you liked last year, but just one song that begins with each letter of the alphabet. "Why?", someone might ask, but I suggest that "how?" is a more interesting question.
Here's how in Curio. Read and do this stuff if you haven't already, then go to the History page, pick playlist, scroll down to the bottom and click "see the query for this". This gives you the query that produces the playlist view, which is like taking apart your toaster to find the part that goes "ding", except that you can still use the toaster normally even though you've also taken it apart.
We're going to change just two things about this query: take out the part that limits it to 100 tracks, and then group the full list of potential tracks by first letter and pick the top track for each letter-group. Here's that playlist query, in red, with the one bit we need to remove crossed out, and the line we need to add in orange.
The new line groups the songs by "letter", which it defines by taking the name of the top song and splitting it into individual characters. The split function is usually used to break up lists at commas, that sort of useful thing, but if we frivolously split on nothing, which translates as ([]) in Dactal, we get a list of individual characters. The :@1 filters this list to just the first letter in it. Then .(.of:@1) says to take each letter group and go to its first track.
Here's what this gives me from my data:
open this weird playlist in Spotify if you want; the premise is non-musical, but the music is still music...
Part of the point of making it easy to experiment is that you never really know what even the seemingly frivolous experiments are going to teach you. We might have thought we were going to get a list of 26 songs out of this, or if we had thought slightly harder we might have realized that we didn't take any steps to avoid songs that begin with punctuation marks, but there are several other maybe-intriguing things we can see here:
- uppercase and lowercase letters are different, obviously, and since song titles are not formally governed by the Chicago Manual of Style Convention, they can have any combination of cases
- accented characters like "Ç" are technically different letters, which will not be news to you if you know almost any language other than English, but maybe you don't
- there are a lot of languages in the world, and you probably do not listen to music in all of them, and neither do I, but still:
- so my obsessive fondness for Japanese kawaii metal and idol rock is most of how I got 251 letters instead of 26
But there are some other curious things here. What's going on with the first song, which seems to be called "Esquirlas", but is at the very top of the list instead of down in alphabetic order with the AaäÄBbCcÇ songs?
Let's find out. Curio is a web app, and the web is like a toolkit for building things that are easy to take apart. The adjustable screwdriver of web apps is the Inspect command. Right-click anything on a web page and pick Inspect.
Sometimes you will discover, if you do this, that the people who made the page did not expect you to, and the inside of their page is an incomprehensible mess of wires and crumbs and thus probably a fire hazard. But here's what the inside of this part of the Curio toaster looks like:
Ah! It looks like this song is called "Esquirlas" when you see it on the page, but in fact in the Spotify database it has a special character at the beginning which somehow comes out of the Spotify API as an (imaginary, I think) HTML entity. We may not think we care about this right now, but later when we're writing song-processing code and we don't understand why
What the hell is
We also learn one interesting thing about the typing I have done with my own weird fingers, because there are songs here beginning with most of the numbers. Not 6, though. There were no songs with titles beginning with the number 6 among my most-played single tracks by each artist. Is that right? We can cross-check.
Yes, apparently I did listen to "6km/h" by CHICKEN BLOW THE IDOL, and "666" by Ceres, but not as much as "rocket pencil" by CHIBLOW (as I assume we fondly refer to them) or "Humming" by Ceres. But the interesting thing I meant we see is that the numbers appear in this list in reverse order. That's my doing, because in my experience I mostly want numbers to be sorted from large to small, and in other query languages I found myself constantly having to sort by the negation of quantities to accomplish this, so I thought Dactal would be more expressive and improvisonational if the default was the other way around. But I didn't remember to handle it differently in the case where we're sorting names that begin with numbers. That's probably fixable. I'll work on fixing my toaster, that's my toaster oath.
What's yours?
[PPS from later:]
Say, for example, you wanted to produce a list of songs you liked last year, but just one song that begins with each letter of the alphabet. "Why?", someone might ask, but I suggest that "how?" is a more interesting question.
Here's how in Curio. Read and do this stuff if you haven't already, then go to the History page, pick playlist, scroll down to the bottom and click "see the query for this". This gives you the query that produces the playlist view, which is like taking apart your toaster to find the part that goes "ding", except that you can still use the toaster normally even though you've also taken it apart.
We're going to change just two things about this query: take out the part that limits it to 100 tracks, and then group the full list of potential tracks by first letter and pick the top track for each letter-group. Here's that playlist query, in red, with the one bit we need to remove crossed out, and the line we need to add in orange.
2024 tracks full
/artist=(.track info.artists:@1),song=(.track info.name),date
|songdatepoints=(....count,sqrt)
/artist,song
||songpoints=(..of...songdatepoints,total),
songtime=(..of..of....ms_played,total)
#rank=songpoints,songtime
/artist
|artistpoints=(.of..songpoints..(...._,(0.5),difference)....total),
ms_played=(..of..songtime,total),
topsong=(.of:@1.of#(.of.track info.album:album_type=album),(.of.ts):@1.of.track info)
#artistpoints,ms_played:@<=100
/letter=(.topsong....name,([]),split:@1).(.of:@1)
.(...artistpoints=artistpoints,
duration=(.topsong....duration_ms,mmss),
artist=(.topsong.artists:@1.name),
track=(.topsong.name),
uri=(.topsong.uri))
/artist=(.track info.artists:@1),song=(.track info.name),date
|songdatepoints=(....count,sqrt)
/artist,song
||songpoints=(..of...songdatepoints,total),
songtime=(..of..of....ms_played,total)
#rank=songpoints,songtime
/artist
|artistpoints=(.of..songpoints..(...._,(0.5),difference)....total),
ms_played=(..of..songtime,total),
topsong=(.of:@1.of#(.of.track info.album:album_type=album),(.of.ts):@1.of.track info)
#artistpoints,ms_played:@<=100
/letter=(.topsong....name,([]),split:@1).(.of:@1)
.(...artistpoints=artistpoints,
duration=(.topsong....duration_ms,mmss),
artist=(.topsong.artists:@1.name),
track=(.topsong.name),
uri=(.topsong.uri))
The new line groups the songs by "letter", which it defines by taking the name of the top song and splitting it into individual characters. The split function is usually used to break up lists at commas, that sort of useful thing, but if we frivolously split on nothing, which translates as ([]) in Dactal, we get a list of individual characters. The :@1 filters this list to just the first letter in it. Then .(.of:@1) says to take each letter group and go to its first track.
Here's what this gives me from my data:
open this weird playlist in Spotify if you want; the premise is non-musical, but the music is still music...
Part of the point of making it easy to experiment is that you never really know what even the seemingly frivolous experiments are going to teach you. We might have thought we were going to get a list of 26 songs out of this, or if we had thought slightly harder we might have realized that we didn't take any steps to avoid songs that begin with punctuation marks, but there are several other maybe-intriguing things we can see here:
- uppercase and lowercase letters are different, obviously, and since song titles are not formally governed by the Chicago Manual of Style Convention, they can have any combination of cases
- accented characters like "Ç" are technically different letters, which will not be news to you if you know almost any language other than English, but maybe you don't
- there are a lot of languages in the world, and you probably do not listen to music in all of them, and neither do I, but still:
- so my obsessive fondness for Japanese kawaii metal and idol rock is most of how I got 251 letters instead of 26
But there are some other curious things here. What's going on with the first song, which seems to be called "Esquirlas", but is at the very top of the list instead of down in alphabetic order with the AaäÄBbCcÇ songs?
Let's find out. Curio is a web app, and the web is like a toolkit for building things that are easy to take apart. The adjustable screwdriver of web apps is the Inspect command. Right-click anything on a web page and pick Inspect.
Sometimes you will discover, if you do this, that the people who made the page did not expect you to, and the inside of their page is an incomprehensible mess of wires and crumbs and thus probably a fire hazard. But here's what the inside of this part of the Curio toaster looks like:
Ah! It looks like this song is called "Esquirlas" when you see it on the page, but in fact in the Spotify database it has a special character at the beginning which somehow comes out of the Spotify API as an (imaginary, I think) HTML entity. We may not think we care about this right now, but later when we're writing song-processing code and we don't understand why
songtitle == searchtitle
isn't working, suddenly we might think "ohhhh, wait". And you might be tempted to think "nah, that probably won't ever happen again", but in fact it happens again just 20 lines down the page.
What the hell is

? Apparently it is a zero-width non-breaking space from the Unicode group Arabic Presentation Forms-B. What is it doing in the title of a song by the Swedish melodic power metal band Metalite? Apparently we do not know. Welcome to the wonderful world of trying to do anything with music data, or indeed pretty much any data that ever originated in humans typing with their weird fingers, which is essentially all data.
We also learn one interesting thing about the typing I have done with my own weird fingers, because there are songs here beginning with most of the numbers. Not 6, though. There were no songs with titles beginning with the number 6 among my most-played single tracks by each artist. Is that right? We can cross-check.
2024 tracks full:master_metadata_track_name~<6
Yes, apparently I did listen to "6km/h" by CHICKEN BLOW THE IDOL, and "666" by Ceres, but not as much as "rocket pencil" by CHIBLOW (as I assume we fondly refer to them) or "Humming" by Ceres. But the interesting thing I meant we see is that the numbers appear in this list in reverse order. That's my doing, because in my experience I mostly want numbers to be sorted from large to small, and in other query languages I found myself constantly having to sort by the negation of quantities to accomplish this, so I thought Dactal would be more expressive and improvisonational if the default was the other way around. But I didn't remember to handle it differently in the case where we're sorting names that begin with numbers. That's probably fixable. I'll work on fixing my toaster, that's my toaster oath.
What's yours?
[PPS from later:]