Giocoso Version 3.13 promises to be a really big version bump (so big, in fact, that I was thinking of calling it Version 4.0, but ultimately decided against it). It is currently scheduled for release in mid-December (after I've dog-fooded it for another few weeks). For anyone interested, the list of changes that are in the pipeline for the next release of Giocoso is visible in the program's changelog.
The changelog can be a terse affair, however, and items get added to it in a serialised manner, so coherence or 'telling the story' is not one of its strong points. I thus wanted to write a post or two about some of the more salient changes that provides some context and (possibly) meaningful narrative!
1.0 Playback Control
How you control music playback has always been a bit of a problem for Giocoso: the ability to pause, resume, terminate and skip the playback of music is pretty fundamental, after all. The trouble has always been that the way Giocoso was written, it was impossible for a music-playing Giocoso session to do playback control of itself at all. The technical reason is that it ran ffmpeg (the utility that actually does the music decoding and playback) in the foreground and thus Giocoso itself lost the ability to handle user-input, because it was now running in the background. As music playback began, therefore, Giocoso would look like this:
...and you'll note the top menu has disappeared and there are no other visible means of interacting with the program. The screen displayed information about the music being played and some timing information... but that was your lot! There was no way to interact with Giocoso at this point, so basic playback control was only possible by launching a second, independent Giocoso session and using it to send control messages to the original playing session.
As a workaround for this, Mgiocoso was invented and, in Version 3.12, (the last update released in mid-November 2024) was made an automatically-launched default sidekick to Giocoso itself. Mgiocoso running as a separate process could receive user input during the main Giocoso program's music playback and could be used to send the appropriate pause, resume, terminate and skip commands. But that's a pretty clunky way of doing things! In retrospect, Version 3.12's making Mgiocoso almost compulsory was completely the wrong way to address the issue and that change is thus reversed in this release (though I'll point out that Mgiocoso is still very handy for controlling, via a mobile telephone or tablet, a remote Giocoso session that's playing music, for example).
The really big change in Version 3.13 is therefore this:
That's music being played and the same sort of recording and timing data is displayed as usual ...but, at the bottom of the screen, there are now displayed a new set of keywords, the initial letters of which, when tapped, will issue playback control commands, interactively. (Note that the 'exit' option is achieved by tapping 'x', not 'e', though!) Technically, Giocoso now runs as the foreground process (thus allowing user interaction), whilst ffmpeg has switched to being run in the background. How it's done is of less importance than the fact that it's done, though: Giocoso now has proper, interactive controls for managing the playback of music, from within the one session that's doing the playback in the first place.
One side-effect of this new capability is visible in this non-music-playing screenshot:
Compare that to the previous version's equivalent screen display:
You may notice that there are now only five 'top menu' options, not six: the Control menu has been removed completely. The reasons it has gone are, hopefully, obvious: there was no actual way to use the Control menu if music was playing, for reasons already explained. Additionally, now that all the Control menu's options are available from a 'bottom menu' during music playback, there's no need to list them separately on their own, fundamentally inaccessible, menu.
2.0 Playback Elapsed Time
A big bug-bear for the longest time has been how Giocoso computes this part of its display:
It's easy to work out how long a piece of music is, since that piece of metadata is trivially accessible to ffmpeg: it's part of what I called 'static data' in a previous post and this trivial bit of command line magic will extract it:
[hjr@zelenka Desktop]$ ffmpeg -i Violin\ Concerto\ \(Oramo\ -\ 2002\)-16-44100.flac -f alsa default 2>&1 | grep Duration
Duration: 00:31:58.00, start: 0.000000, bitrate: 542 kb/s
So, in the 'played X of Y' bit of that display, determining the 'Y' is easy. How do you get at the 'X' bit though? Well, in all previous versions of Giocoso, you couldn't access it directly from ffmpeg itself: remember, Giocoso was running in the background and ffmpeg was running in the foreground and they couldn't directly communicate with each other. So prior versions of Giocoso cheated: if we knew you'd started playback at (say) 10AM and it was now 10:05AM, we knew you'd been playing music for 5 minutes: we'd therefore display 'Played: 00:05:00' in the 'X' part of that display, just by looking at your computer's clock time and comparing that with the known start time.
Problem solved, right? Yes, sort of... until I introduced the ability to pause the playback! Because if you paused playback, the system clock time would still keep ticking. So, let's say you pause the playback at 10:05. You come back from whatever you were called away for at, say, 10:30. If we're simply counting the seconds since you started playing, the 'Played' part of that display now ought to read '00:30:00', since 30 minutes have elapsed since you started playing that recording... except you've still only truly played 5 minutes of the work, so actually displaying '00:30:00' would be profoundly wrong! The ability to pause playback completely screwed up the 'elapsed time' calculation, basically. Giocoso did its best to work around that: for every second the music was paused, it would decrement a second from the 'Played' time before incrementing it again as the system clock time crept up by 1 second: net result the 'Played' time would stand still, even though clock time advanced. Which worked mostly OK, except that your computer's system clock doesn't keep perfect time and Giocoso couldn't guarantee to loop through its code in exactly 1 second. So sometimes, time would 'slip' a little -and that meant that the 'Ending at' component of the display would get more and more out of whack with reality. For a short pause, you'd never notice... but I've been known to pause music playback of a three hour-long opera overnight, and the end result has been that on resuming it the next morning, it would tell me the 'Ending at' time was (say) 11:30, and it would actually end at 11:15 or so: the little time slips during the increment/decrement process would add up and render the display a fiction.
Version 3.13 fixes this, at last, by extracting the 'where am I in the play stream' directly from ffmpeg, as I explained at interminable length in that earlier post. It means Giocoso doesn't have to compute how much of a recording you've played: ffmpeg tells it precisely and always, regardless of whether playback is paused or on-going. The 'Played' figure is thus now fairly easily determined and always accurate. Since we know your exact position in the play 'stream' even when paused, we can deduct that from the easily-determined duration for the recording and thus compute, with certainty and accuracy, how much remains of the recording to play. Add that to the known current system clock time and we finally know, with equal certainty and accuracy, what the 'Ending at' time is.
Basically, we're now using ffmpeg's deep knowledge of the contents of the audio stream to compute things properly, rather than guestimating them. Finally!! 🙂
There is still a little bit of inaccuracy, because ffmpeg works down to the centisecond (hundredth of a second)... and Giocoso doesn't! Where ffmpeg might say we are at play position '00:05:31.44', Giocoso takes that as '00:05:31' and forgets about the 44 centiseconds entirely. When you truncate data like that for long enough, it might add up. Giocoso thus still has to correct for that: if the accumulated time error exceeds ±2 seconds, it force-fixes the elapsed time display by 2 seconds. So, there's still a little bit of variance that can happen, but it's trivial compared to any earlier version of Giocoso.
The only slight drawback to this new way of timing things is that, on Ubuntu- and Debian-derived distros, you will need to install (manually) gawk, because that's the tool needed to interrogate ffmpeg's timing data correctly. Other distros appear to have that package installed by default, but Ubuntu and Debian and their descendants do not. Giocoso won't install it for you when doing an upgrade (only when doing a fresh install), so if you're upgrading to Version 3.13, a sudo apt install gawk will need to be performed by you beforehand.
3.0 Pauses between the play of recordings
Way back in March 2024, I released Giocoso Version 3.05. As I mentioned in the associated release notice, that version introduced a new 'pause between plays' timer, in addition to the one that had been there since the very earliest Giocoso releases. This screenshot of the Giocoso configuration editor shows the two timers:
The 'Pause between plays in a cycle (in seconds)' parameter (highlighted in red in that screenshot) was the 'original' pause timer: as shown here, if Recording A finishes at 10:00:00, Recording B wouldn't start playing until 10:00:05, after a five second delay. The trouble with that, however, was that Giocoso literally sat there doing nothing for those (in this case) 5 seconds: no new music was searched for, so no new artwork was fetched or displayed. You couldn't see what Recording B would be until it actually started playing. That's probably fine for most people, but I found it annoying for those times when I wanted to follow along the music with a score. Giocoso would sit there doing nothing, then abruptly start playing something new and only at that point could I know what score to fetch from the bookshelves. By the time I'd found the right score, we were several pages into the score and it was hard to find out where we were up to!
So, the 3.05 release introduced the second parameter you see in the above screenshot, down at the bottom of the screen: 'Seconds to wait before playback starts'. This one also introduces a pause between plays, but only after the selection of the next recording was actually made and displayed. For the relevant amount of time, therefore, you would know what Giocoso was going to play next, long before it actually started playing. Set it to a sufficiently high number and you'd have plenty time to look things up on the Internet or fetch the score to follow along with by the time playback actually started.
It was, however, utterly bonkers to have two completely different 'pauses between plays' timers, once of which was significantly less useful than the other -and this is now fixed in Version 3.13. The second parameter shown here is now the only operative one. The original 'Pause between plays in a cycle' can be set to anything you like ...and it will simply be ignored. It is, in fact, hard-coded to be 0, no matter what value you enter for it or what value you may see it set to. Only a setting for 'Seconds to wait before playback starts' now introduces a functional delay between plays. For now, the parameter controlling the original 'Pause between plays' timer is still there and visible: it will be completely removed in a future release.
Another little enhancement is that the 'Seconds to wait...' countdown timer can be 'cut short' by tapping 'c' (or 'C' ...the case doesn't matter) as its countdown message displays. If it says, 'Play of the above recording will start in 98 seconds...' and you've already got the score or Wikipedia page to hand, just tap 'c' and play of that recording will immediately commence. No point hanging around waiting for timers to decay to zero if you don't need them to!
4.0 In Conclusion...
There may be a part 2 to this in a week or so, if I can think of anything useful to add to the story! In the meantime, I hope this whets your appetite for what's coming shortly in the Giocoso release saga 🙂