A few days ago, U.S. Government decided to declare state of emergency. Since then I've been doing my best to stay indoors and keep myself from going crazy. I imagine this crisis is going to shake up a lot of lives and make our current lifestyles different. I can't imagine what it'd be like for people who worked 9-5 jobs every day for the last few years only to suddenly be trapped inside for multiple days at a time.

Naturally, I work remotely so it's not... really anything I'm not already used to. But not seeing friends, not being able to go to the gym, not even being able to go to a park is what makes me go a little crazier. All the simple things suddenly gone, and I long to be able to go back to do those simple things.

Anyways, let's talk about what I want to do, or have been doing, in the mean time.

99 Ranged

On a more RuneScape related note, I'll be hitting 99 in the Ranged combat skill. I don't want to talk too much about RuneScape on here, but it is a game I've played since my teenage years and in some ways I find it captivating.

However, after this skill, I want to take an even longer break from the game because my heart is not in it at the moment.

In it's current state, RuneScape is just a grindfest for hours. A lot of the adventure comes from self-fulfillment and the adventure, but in the later stages, it gets to the point where you will be playing a time vs. execution game. You create estimates for how fast you can do things, calculate how much gold you might earn, and that dictates much of your gameplay for improvement.

What I mean by this is that if I can earn two million gold per hour by slaying a blue dragon, then the gameplay loses it's adventure feel for me; equipment upgrades just become linear factors of time (I need 30mil for Bandos Tassets, I need to play for 15 hours). I can turn the game into a non-linear gold earning game by playing my odds against boss lottery drops, but my interest in that is not very large. I could fight a high level boss to earn the Bandos Tassets for hours, but I have zero guarantees I'll ever get the item I want.

So really, what is there left for me other than to spend some time getting skills that I don't care much for up a bit? Earn money, or learn how to do different lotto bosses?

I think the best course of action is to just stop playing. At this point, in my head, the game has played itself; it's just a matter of when it plays. I could play it now, be bored with it and suffer, or maybe I could spend some time doing new things; focus on my fitness once again, try my hand with music more, and work on some different projects.

I've had some fun with getting 99 Ranged, but in around 8 hours or so, I'll be really just absolutely done for now.

Rust and the Novation Launchpad

I have a lot of music devices - more than I'm proud to admit. I like em, I think they're fun, and even if not being used to create music, the lighting effects or ideas that I get is thrilling.

My most notable favorite device is the Novation Launchpad (gen 1). I bought this so many years ago, played around with it a ton, fell in love with it's simple design and colors...

...and then really that's it. I wrote a lot of weird tools in PureData to do a bunch of different things. PureData is pretty odd in how it works, in that there's not a whole lot of useful data structures I found for dealing with MIDI throughput. I would sometimes have a bunch of messages queued up, but no way to deal with it efficiently.

In the long term, I couldn't find any common-shared PD libraries. It's incredibly less popular than it's commercial brother Max/MSP, and I reckon that since it's not very popular, it's slowly dying off in favor of more programmer-recognized tools, maybe Python, C++ or heck, Rust?

My electronic hacking days are a bit behind me, although something called TidalCycles peaked my interest, I had some difficulty in improving in it and also my lack of critical music understanding. So onto the next best thing: treating my Launchpad as just a grid of LEDs I can toy around with.

I first started looking for MIDI tools; found one Rust wrapper around portmidi which worked decently from what I played with. I found a guy's project who specifically built it around portmidi, but the issue was he designed it for Launchpad Mk2, which is very different in design from my original. I thought about sending him a PR for adding a Trait to share common methods between the devices, but the project seems pretty stale at the moment, so I held back and started my own wrapper.

A simple program to turn all the lights on in a cycle is as follows:

extern crate lpfx;

use lpfx::launchpad::*;
use lpfx::utils::*;

fn main() {
    let mut launchpad = get_lp_from_name("Launchpad MIDI 1");

    play(&mut launchpad);
}

fn play(lp: &mut Launchpad) -> LPErr {
    lp.clear()?;

    let values = [
	    0, 1,  2,  3,  2,   1,
	    0, 16, 17, 18, 19, 18, 17, 16,
	    0, 32, 33, 34, 35, 34, 33, 32,
	    0, 48, 49, 50, 51, 50, 49, 48,
    ];

    for &v in values.iter().cycle() {
	    println!("color: {}", v);
	    lp.color_all(v as u8)?;
	    sleep_millis(150);
    }

    Ok(())
}

I never knew some of the deeper underlying details of the Launchpad, but I found out that in order to color the Launchpad LEDs, specifically crafted values must be passed to it. In order to control the different red-green LEDs in each button, they are controlled by different bits in the 8-bit value supplied. More specifically, the 0-1 bits control the red LED, and the 4-5 bits control the green. I was able to calculate a table of values we could use to simply power the LEDs; other bits are used for certain data transactions like copying from a buffer.

My handy dandy color table

r\g| 0 | 16 | 32 | 48
---------------------
 0 | 0 | 16 | 32 | 48
 1 | 1 | 17 | 33 | 49
 2 | 2 | 18 | 34 | 50
 3 | 3 | 19 | 35 | 51

Each LED has four brightness settings; zero being off, and 3 being it's highest. The future Launchpads have more LEDs built into them for greater customization and clarity in performances, so sadly I only have 16 colors to work with here, and by colors I really only mean 15 because one of those colors is simply being off.

I have some sample programs in my project right now to demo some lighting programs, but I'm going to later work on more intuitive things like multiple threads for different timers, or handling user input from the Launchpad.

Maybe more of this in a later post when I create some cool programs.

Non-Computer Time

I think I also want to spend time away from the computer more during this crisis. Not that computers aren't part of me, but I want to be able to do more than just stare at my monitors all day.

I have a stack of books, both educational and non-educational I'd love to get through slowly. So far for textbooks those have only been a "I'll read this when I think I need it" kind of ordeal. I'm not in school, so I'm not married to them by any means, but after my RuneScape grind, I'd probably love to take a peek in them more than just casually skimming and maybe actually try doing exercises on paper for once.

Then there's Ring Fit Adventure on the Switch to play still. I hit a wall with this game and I think it's mostly because I raised the difficulty too high, making it nigh impossible to do more than a level or two without feeling absolutely tired - 40+ of one exercise per attack, adding up to almost 300+ reps per battle got very tiresome. I might just lower the difficulty and get back to a reasonable pace for it and actually treat it like a game instead of a full-blown gym.

On top of that, back to boxing. Once it gets warmer and not freezing temperatures, I can hit the bag in our garage here on a decent schedule. I need to build my cardio back up that I lost from not being in an active boxing gym anymore. I also need to maybe actually build up cardio the real way by running again. But for that, I need more warmth. Everything revolves around that for some reason.

Tomorrow I will most likely write up a new post about something completely dumb and random: the battle of display managers in NixOS. I will try to be more frequent, these last few weekends have been exhausting.