Colour Perception and Sorting

This is yet another story about AMP (my ever-evolving music player) being updated. This one, however, has a subtle twist that most of you probably won’t care about, let alone make use of.

It’s all to do with colour. In all my software, I try to use just four colours in a consistent way: (1) Terminal Default Foreground; (2) Bright Red; (3) Bright Yellow; and (4) Bright Blue. The terminal default will depend on what colour scheme you’ve configured your terminal to use. Commonly, as in the screenshot on the left, it’s bright green for me and my desktops. It’s used to display fairly ‘static informational’ text: things like the program name, the data labels and so on. Bright Red is used to display error or out-of-condition messages or alerts to program behaviours. Bright yellow is used to display user-input or fairly static information derived from user input (such as the folder path/name from which you’re currently playing music). Finally, Bright Blue is used to display fairly dynamic text derived from user input (the name of the database you’re using, for example, or any override switches you’ve specified that affects what music will be selected for play). I may not always be entirely consistent with the way I use my colours, but that’s the general scheme I try to use and stick to, anyway!

Unless you’re colour-blind, in which case, Lord alone knows what you will perceive the colour of any given piece of displayed text to be, if you can see it at all!

As it happens, I have my own colour-perception problems: if something is in C major, I see it (and feel it) as dark blue; in A major, it’s bright yellow; in G major, it’s a sort-of rusty red. It’s all a bit weird, frankly! Anyway, I also know that there are people out there who are more ‘conventionally’ colour-blind, in which case coding things to display in red and green, or blue and green, is probably less than helpful! So, I’ve added a new run-time switch to AMP (which bumps to version 1.17 in consequence): ––colour-light. For our American cousins, it can also be supplied as ––color-light, but really: Noah Webster should have been drowned at birth! Anyway, if that switch appears on the command line, anywhere, however it’s spelled, then the program display will be as you see it in the linked thumbnail: the green comes from whatever your choice of terminal colour scheme deems to be ‘normal’; everything else will appear as ‘white’.

There’s an additional option for those occasions where you prefer a light-themed terminal and thus displaying everything in white-on-light would not make best sense! For fans of light-coloured terminals, there is thus an equivalent new switch: ––colour-dark (which also comes in the American variant ––color-dark). If you use this dark-themed variant, all text will appear in black, not white. Something like this, then:

Finally, there’s the ––colour-neutral option (and it’s American cousin ––color-neutral), which basically makes things look like this:

…where all text will appear in bright yellow, unless it’s normal, static text provided by the program -in which case, it will appear in whatever colour ‘normal’ is defined by your terminal theme (in the above case, it would seem that ‘white’ is normal).

You may need to experiment with your terminal colour and profile appearance settings to get the desired effect, but at least you have a little more control over the appearance of things than you had before. If it’s not sufficiently flexible, you can email me and request some specific outcome and if I can make it happen, I certainly will do my best to do so. Obviously, by reducing the colour palette in these ways, you remove the ‘subtlety’ of the classes of information I alluded to at the start. No longer will you be prompted to spot the difference between mostly-static v. dynamically-derived information. But I figure it is probably better that all the program text is basically legible rather than that, in trying to convey subtlety, it becomes invisible to some people.

If you don’t have any colour perception issues, feel free to ignore the new switches: everything will simply continue to display in green, yellow, red and blue as necessary! A similar colour-changing capability has been added to all my other software scripts, too, and they’ve all incremented upwards in the version number stakes in consequence. Fresh updates for all of them are, of course, available from the usual software download page, so make sure you pick up the new capability whenever you can!

Even if you don’t have colour perception problems, you may also want the new upgrades, however, since there are a couple of bug fixes and display enhancements in most programs. Sticking purely to AMP-related news, for example, there is a new twist on the reporting capability AMP has had, almost since the first day it was written: you can now specify the number of days’ data to fetch and display. In my case, for example, if I simply say:

amp --report --dbname=main

…I will see this sort of response:

PLAYTIME           ARTIST                               ALBUM                                                                             GENRE                   DURATION 
-----------------  -----------------------------------  --------------------------------------------------------------------------------  ----------------------  -------- 
09-01-2021, 16:48  Olivier Messiaen                     Thème et variations (Loriod - 1977)                                               Chamber                 00:12:17 
09-01-2021, 17:00  Gregorio Lambranzi                   Dances from the School of Gregorio Lambranzi (Ball - 1980)                        Orchestral              00:09:47 
09-01-2021, 18:13  Giacomo Antonio Perti                Gesù al Sepolcro (Vartolo - 1990)                                                 Oratorio                01:12:29 
09-01-2021, 19:23  Johann Christoph Friedrich Bach      Keyboard Concerto in E flat major (Alexander-Max - 2007)                          Concerto                00:18:58 
09-01-2021, 20:08  Gian Francesco Malipiero             Sinfonia dello Zodiaco (Almeida - 1994)                                           Symphonic               00:42:21 
09-01-2021, 21:22  Johann Bach                          Unser Leben ist ein Schatten (Junghänel - 2002)                                   Choral                  00:06:49 
10-01-2021, 09:19  Tomás Luis de Victoria               Missa O Quam Gloriosum (McCarthy - 1964)                                          Choral                  00:24:13
[...]

This indicates that I’ve been playing music since 9th January. Those are the earliest ‘plays’ recorded in my music database -so, at the time I’m writing this, there’s now about 8 weeks’-worth of ‘play data’ in my database. Scrolling through all those plays to get to the ones I’ve done in the last day or so is taking more and more time, obviously!

So the new feature is use of the ––reportdays=X runtime switch, where X is the number of days you want to report, backwards from ‘now’. The X can be any number you like, but it has to be a number: type a letter or punctuation character and it is silently set to 36500 -which is the number of days in 100 years and therefore is the equivalent of ‘show me everything’! In my case, if I issue this command:

amp --report --dbname=main --reportdays=7

…I will now see this:

PLAYTIME           ARTIST                          ALBUM                                                                  GENRE       DURATION 
-----------------  ------------------------------  ---------------------------------------------------------------------  ----------  -------- 
04-03-2021, 15:43  Frederick Delius                The Walk to the Paradise Garden (Barbirolli - 1994)                    Orchestral  00:09:45 
04-03-2021, 15:50  Georg Muffat                     Delirium Amoris - Concerto Grosso in E minor (Cantilena - 1986)        Orchestral  00:07:31 
04-03-2021, 15:58  Leoš Janáček                    Na Soláni Čarták (Pinkas - 1997)                                       Choral      00:07:52 
04-03-2021, 16:21  Johann Sebastian Bach           BWV 221 - Wer sucht die Pracht wer wünscht den Glanz (Helbich - 1991)  Cantata     00:20:04 
04-03-2021, 16:55  Nikolai Medtner                 Piano Concerto No. 1 (Tozer - 1992)                                    Concerto    00:33:32 
04-03-2021, 16:57  Wolfgang Amadeus Mozart         DZ 02051 Seht, Sie ist dahin (Matt - 2002)                             Choral      00:02:17

…and you can immediately see that the report is now starting with ‘plays’ made on 4th March 2021, which is indeed 7 days back from the date when I’m writing this. If you were ever idly wondering what you were listening to 3 days ago, you now don’t have to report everything from the beginning and scroll forwards a lot; you can now simply restrict the start of the report to what was happening 3 or 4 days ago and scroll forwards a little!

A final reporting enhancement is that you can now sort the output of the report. You can see the columns that appear: PLAYTIME, ARTIST, ALBUM and so on. Number those consecutively from 1 upwards and you can see that there are five columns by which you could conceivably sort the report.  By default, it will report in PLAYTIME order. The new feature is that you can add the ––reportsort=X runtime switch to choose one of the other columns to sort by. The ‘X’ is a number corresponding to the column position. So if you said ––reportsort=2, for example, your report would look like this:

PLAYTIME           ARTIST                          ALBUM                                                                  GENRE       DURATION 
-----------------  ------------------------------  ---------------------------------------------------------------------  ----------  -------- 
08-03-2021, 20:24  Albert Roussel                  Fanfare pour un sacre païen (Tovey - 2004)                             Orchestral  00:00:53 
08-03-2021, 20:15  Alexander Agricola              Dung aultre amer (Nevel - 1998)                                        Choral      00:01:14 
06-03-2021, 18:12  Alexander Glazunov              Raymonda (Anissimov - 1995)                                            Ballet      02:19:08 
08-03-2021, 20:33  Antonio Lotti                   Crucifixus (Christophers - 1989)                                       Choral      00:03:22 
08-03-2021, 20:46  Antonio Vivaldi                 RV 415 Cello Concerto (Cohen - 2005)                                   Concerto    00:09:54 
05-03-2021, 11:37  Antonín Dvořák                  Mass in D minor (Smetacek - 1994)                                      Choral      00:39:22

It’s the same data as before, but this time it’s been sorted by the ARTIST column, so all your Benjamin Britten plays will be grouped together. Similarly, if you said ––reportsort=4 you’d get this sort of thing:

PLAYTIME           ARTIST                          ALBUM                                                                  GENRE       DURATION 
-----------------  ------------------------------  ---------------------------------------------------------------------  ----------  -------- 
05-03-2021, 10:57  Igor Stravinsky                 Le Sacre du Printemps (Currentzis - 2015)                              Ballet      00:34:46 
05-03-2021, 13:44  Aram Ilich Khachaturian         Spartacus (Zhuraitis - 1991)                                           Ballet      02:06:45 
06-03-2021, 18:12  Alexander Glazunov              Raymonda (Anissimov - 1995)                                            Ballet      02:19:08 
07-03-2021, 13:34  Ottorino Respighi               La Boutique fantasque (Petrenko - 2017)                                Ballet      00:20:22 
09-03-2021, 16:10  Igor Stravinsky                 Le Sacre du Printemps (Dorati - 1981)                                  Ballet      00:33:41 
09-03-2021, 23:30  Igor Stravinsky                 Perséphone (Davis - 2003)                                              Ballet      00:52:23 
04-03-2021, 16:21  Johann Sebastian Bach           BWV 221 - Wer sucht die Pracht wer wünscht den Glanz (Helbich - 1991)  Cantata     00:20:04 
05-03-2021, 17:56  Johann Sebastian Bach           BWV 125 - Mit Fried und Freud ich fahr dahin (Suzuki - 2005)           Cantata     00:23:50 
09-03-2021, 10:35  Johann Sebastian Bach           BWV 171 - Gott, wie dein Name, so ist auch dein Ruhm (Suzuki - 2010)   Cantata     00:15:19 
06-03-2021, 15:29  Louis Spohr                     Piano Quintet, Op. 130 (Musica - 1992)                                 Chamber     00:31:19 
06-03-2021, 15:53  Johann Sebastian Bach           Cello Suite BWV 1011 (Wispelway - 1998)                                Chamber     00:23:10

This time, the GENRE column has been selected as the basis of the sort, so all the plays of ballets are listed together; then all the cantatas and so on. The program will check that the number value you supply as the sorting column is between 1 and 5; if you supply ‘9’ or ‘M’ for example, then the default value of ‘1’ will silently kick in anyway.

If you’re serious about reporting on what music you’ve played, you’ll want a proper SQLite Reporting tool (such as the DB Browser for SQL Lite), but that may be a whole new level of complexity you don’t want to get into! At least now, with ––reportsort and ––reportdays you can exercise a little more control over AMP’s native reporting capabilities, though it’s never going to be as flexible as I suspect you’d like it to be! 🙂

So, summing up: the new Version 1.17 of AMP introduces five new run-time switches:

  • ––colour-light
  • ––colour-dark
  • ––colour-neutral
  • ––reportsort
  • ––reportdays

…and if you’re American, you can spell the first three as ‘color-…’ without the extraneous ‘u’.

As you will know from my previous post, if you’re already running AMP version 1.16, you can upgrade to the latest version simply by running AMP with the ––checkver parameter. If you let it, that will detect the new version is available, download it and install it for you, in one hit.