GUI programming drags on for third week

Checking off some items from the to-do list mentioned in my previous post, my OpenGL GUI panels can now have rounded corners (although they still need a bit of work as they’re not quite as circular as I’d like), they can have shadows of arbitrary size and color, they can have linear and radial gradient coloring, and the text dynamically word-wraps as necessary, with the scroll bar appearing only when needed.

Ain’t that nice? Next I need to work on vertical resizing and making sure multiple panels will overlap correctly when on the screen; a panel should be brought to the front “layer” when clicked on.

Then I will move on to adding the GUI elements I mentioned in the last post.

A fellow programmer on twitch mentioned a GUI library for LWJGL the he had programmed called legui. Looks quite nice so I might play around with it and see if I can integrate any of it with my panels. Another advantage of streaming on twitch: meeting other programmers and discovering new things!

(P.S. I don’t really know if this is my third week of working on it or not, but it’s probably around there. The title of this post is a reference to a film in which people carry in the banner.)

By S P Hannifin, ago

My GUI programming efforts continue

I’ve been continuing my efforts to program a custom simple 2D/3D engine in Java with OpenGL with which to create a more user-friendly standalone version of my MIDI animator (and hopefully some games in the future). Lately I’ve been focusing on creating a GUI system. In terms of free open-source 3D engines in Java, I don’t much like most of the GUI implementations, so creating my own has been fun. Granted, I still run in to bugs that are tricky to fix while trying to accomplish relatively simple things, but trying to solve such problems is educational and always a bit addicting, like solving a puzzle, especially as I’m doing it for myself.

So here’s my latest progress update. I’ve settled on using STBTT (included in lwjgl) font rendering for the GUI text and the underutilized Nvidia path rendering (included in OpenGL in general) for the panels (and hopefully more in the future, including possible note shapes in the actual MIDI animator). The panels are movable and can contain an arbitrary amount of word-wrapped text. You can scroll through the text, and the panel can include a y-axis scrollbar of arbitrary size. You’ll also notice that the text fades in and out at the top and bottom, a nice little touch in my opinion that I probably spent too long programming:

I’ve also been streaming my programming efforts on twitch, which is also addicting. It turns what is usually a pretty solitary activity into something at least a little more social, and it’s fun watching the viewer count tick up now and then. Shout out to twitch user Subtixx who has even offered helpful points and advice allowing me to fix problems my eyes don’t catch (such as null-checking the darn scrollbar!); many thanks Subtixx!

My current to-do list includes (but is not limited to):

  • allow gradient coloring on the panels and text
  • allow rounded corners on the panels
  • allow panels to have shadows (render a semi-transparent panel behind)
  • allow panels to be resized dynamically
  • allow panels to be closed (and maybe shrunk?)
  • allow panels to contain some select common GUI elements, such as:
    • buttons
    • text fields (short and long)
    • radio buttons
    • check boxes
    • sliders (continuous and quantified)
    • menus (pop-up and drop-down)
    • tabs on the top or side of panels (which perhaps are just specialized buttons?)

So there’s still quite a bit to do. But I must do it, for this is my quest.

In other unrelated news, a 4th album from symphonic / power metal band Ancient Bards is finally happening! I love this band and I can’t wait for their new album!

By S P Hannifin, ago

MIDI animator version 2 wishlist…

As I blogged a couple months ago, one of my goals for 2018 is to program a very simple 3D engine. I’ve been wanting to program a simple adventure game for a few years now, but the 3D and 2D engines I’ve played around with just don’t have quite the features I want, so I’m attempting to create my own little game engine with the Lightweight Java Game Library (lwjgl).

Here’s what I’ve got so far: I can render a textured box and some resolution independent vector graphics including true-type fonts, which can intersect with the box!

OK, so nothing special yet.

Anyway, another thing I’d like to create with lwjgl is a new version of my MIDI animator, using vector graphics (instead of custom shaders) to represent the MIDI notes. (On a side note, I’m using the OpenGL “NV path rendering” extension for vector graphics support, which was created by Nvidia. Does that mean it’ll only work on their GPUs? I don’t know.) This should easily allow many more possible note shapes to be created.

Here’s my current wishlist for “MIDI animator 2.0” (I should also come up with a more interesting name):

  • Should be able to run standalone (that is, users shouldn’t have to download and compile the code to use it)
  • A graphical user interface (GUI) that makes it easy to:
    • load MIDI files
    • change note styles / shapes / colors / animations
    • a scroll bar to make it easier to scroll through the MIDI
    • save files
  • Ability to add title / text animations (instead of having to do this in post)
  • Ability to change / animate background
  • Ability to load in an MP3 to sync with the visualization
  • Ability to add an MP3 visualization, such as one of those pulsing frequency bars or something
  • Ability to export a movie file automatically (if I can figure out how; I’ll save this for last)

Anything else I should include or look into?

So, yeah, this is probably what I’ll be working on in my free time for now. I’ll probably start working on a GUI system next as I’d need to do this for a future game anyway.

Hopefully I’ll get back to actually writing some new music afterwards.

By S P Hannifin, ago
Composer's Corner

Composer’s Corner: Themes of Fireside

Hello, and welcome to Composer’s Corner. Today I present to you the themes of my last YouTube music animation, Fireside, a piece of joy and goodwill that fills every listener with happiness and purity of spirit. Sit thee down and take a listen…

6/8 time, B-flat major, the piece opens with the somewhat playful yet mysterious theme 1 on celesta:

This is repeated immediately with a counter melody in the clarinet:

Theme 2 then begins, with oboe and clarinet exchanging phrases:

In measure 6 of this of the melody, one can see that I have the IV chord descend to the iii chord rather than rising to the V again. I’ve been doing this quite a bit lately, using iii as a substitute for V. I may have only just started doing it last year, especially in Fairytale’s End. Love the sound of it.

After a repeat of theme 2, we come to a melody with a borrowed chord! I had heard film composers use these chords a lot, and if you’re listening for it, you can definitely hear it in quite a lot of scores, to the point that, in my opinion, it’s kind of cheesy and annoying sometimes. Two major chords, a major second apart. Of course, we could stay in key and just use IV-V, but what fun is that? If we start with the tonic I, we can descend to bVII (bah, I can’t figure out how to use a flat symbol with this font, the letter b will have to suffice). B-flat major to A-flat major in our case, like so:

Ah, how nice. The last measure is overlapped with a repeat, and then theme 4 begins:

Rather than changing chords every half measure, we only change them every measure here, providing some contrast to our previous themes. (Well, except in the last two measures. Having the chords progress more rapidly at the end of a theme is a common practice.) Also, notice the use of IV-iii again. Because it’s so good.

This melody is repeated with an overlapping counter melody:

After a repeat of theme 1 and its counter melody, we get a variation of theme 2 on piano (which Overture 4 does not make very pretty notation-wise, but what can you do…):

As dedicated and astute listeners may notice, I often employ triplets of some sort or another into my melodic variations, especially on piano. Because 3 is a magic number.

The orchestra then swells into a repeat of the original theme 2, which serves as the piece’s climax, but not before leaping up a major third in key (my favorite sort of sudden modulation), from B-flat major to D major. After this climax, we settle down again with a repeat of theme 4, but this time with a different counter melody (because the original counter melody broke its leg and had to be put down). This new counter melody goes something like this:

This is played by the piano, celesta, and piccolo, which all go nicely together, and the tune sounds especially nice with the timpani and tambourine accenting the half-beat, in my humble yet biased opinion.

By the way, check out my attempt at voice-leading in the cello and viola at this part:

Actually, I’m not really sure if it’s all that great or not, but as voice-leading is my weakness, I actually spent quite a bit of time on this part, simple as it is, and I’m pleased with how it came out. Of course, I’m sure a professional orchestrator could come up with something better. Here’s how just this harmony sounds:

I think it’s pretty OK… for me…

Anyway… After a repeat of this melody and counter melody (remember: ctrl+c and ctrl+v are among the greatest tools in a composer’s toolkit), we wind down with the oboe, the harmony once again shifting between two major chords a major second apart, I and bVII (in this case D major and C major), before shifting to V and ending on the tonic…

And thus the piece ends, leaving the audience to sit in a stunned and profound silence, having beheld much awe and wonder, before dabbing the tears from their eyes and thanking God they lived to experience such rapture… yes? Right? Yes? Maybe?

And such are the themes of Fireside.

In other news, due to some security setting my webhost must’ve recently changed, I can longer edit my “hanniwiki” mediawiki, where I keep track of my works. So at some point I’m going to try recreating the wiki with WordPress, which is much easier to work with and edit anyway. It’s become more and more powerful over the years.

I also recently uploaded a YouTube video about how to use my open-source MIDI animator:

If anyone out there ever actually uses it, let me know; I’d be interested to see what someone else might use it for.

Finally, on a completely unrelated note, I recently created a Letterboxd account, where I can keep a “film diary” of the movies I watch throughout the year; my profile is here.

By S P Hannifin, ago