2021-06-01

So, I've just come through a bit of a lost month. I got my second vaccine dose at the start of May, and experienced a pretty strong physical reaction, leaving me feeling sick for days and chronically fatigued for at least a week; simultaneous with that, we lost another pet: my favorite cat, and the second one in pretty quick succession. Then the sunny weather changed to spring rain for days on end, all but eliminating my outdoor walks for a couple of weeks there. It would be overly dramatic to say I was depressed, but motivation was hard to come by, and I started just doing the minimum amount of work each day -- just enough to get paid and keep getting paid -- and sitting my ass on the couch as soon as was feasible. Each day I looked forward to the evening, when I would drink a bit too much, and each week I looked forward to the weekend, during which I would also drink too much, and do the same semi-productive or completely unproductive things I'd been doing during the week, only now without the guilty conscience. The "too much alcohol" part in there would disturb my overnight rest, causing me to wake up short on sleep and feeling... unmotivated... and hence, the cycle fed itself.

At some point I just decided to call the month a lost cause and found myself waiting until Memorial Day to get a fresh start on everything.

And through the simple magic of turning a calendar page, I do indeed find myself feeling pretty good about things and wanting to move forward on my music projects, and ready to change my habits. The excessive boozing each night and weekend stops today, and my attention to exercise and proper sleep hygiene resumes. I haven't done much today except survey the past month and the state of my temporarily abandoned music projects, but that's okay. I needed to consider the status of everything I dropped before moving forward.

I said "semi-productive" up above because I actually did pursue a bunch of interests last month, and got some pieces in place for the future. It's not like I was just sitting around moping and playing Breath of the Wild all day long. I read many more books than usual in a month, I set myself up with a budgeting app finally and settled on a retirement fund to invest in, and I learned a lot of Python before burning out a little bit and needing to take a bit of a break. In fact, I wrote a half-functional program which led directly to my minor burnout, which I'll describe in a moment.

The other main thing I got into over the course of May was a comprehensive review of basic math. I started doing that because I was starting to work on something in Python that had to do with sine and cosine functions, and I recognized that I no longer remembered how this even worked. I could of course have not bothered at all, or at most simply brushed up on that one thing. And I did actually spend a bit of time on the Khan Academy pages on the topic to get a little insight. However, after pursuing what I had forgotten to more and more elementary levels, I thought it might be most fun to go through the entire core math series on the Great Courses Plus, thinking that might be right on the exact level that I'd want for this material, given that I've already learned all of it at least once before.

So far, it has been perfect, and actually a lot of fun. Their series represents a complete review of basic college math, including the necessary fundamentals: they start with arithmetic (18 hours of lessons), and go through algebra (36 hours), geometry (18 hours), trigonometry (18 hours), & calculus (36 hours). I'm now in the midst of the elementary algebra course, determining the graphs of parabolas from their equations, and having flashbacks to the seventh grade and my senile algebra teacher and having to essentially teach myself this stuff from the textbook alone. The good news is that it is much more fun this time around.

I want to stress that I'm not doing this for any particular reason apart from entertainment. I know I don't need to review all my math for programming -- that in fact I don't really need to review any. It's just kind of a more-interesting set of puzzles than sudoku, which I was spending an hour or more on every day not so long ago.

Now finally I want to talk about the Python script that I'm actually quite proud of, even though it doesn't exactly work yet. The project is to turn a piece of text, such as a blog entry like this, into a series of MIDI notes that actually make sense as music.

Here's the general flow of the script:

  1. Take a text file and place a line break everywhere a period is found.

  2. Find the length in characters of each of these resulting lines, and constrain these values to the MIDI range of 1-127.

  3. Save these values into a "list", which is a Python data structure.

  4. Compare the values in this list to a "canonical" list of values stored as a "tuple" (another data structure), which represents the specific pitches over two octaves that I want these values to round to.

  5. Round each value to the nearest value in the canonical list, and output them as a sequence to a final list.

  6. Pass this sequence to a module called MIDIUtil, which will interpret the list into an actual MIDI clip which I can import into Ableton and press play on.

I've gotten quite a ways with this script. Steps 2 and 3 work great; I can turn text files into usable lists of MIDI-compatible values; step 1 I haven't figured out yet, but it should be trivial so I just haven't bothered; and step 6 "works" in that I know how to pass manually massaged sequences to MIDIUtil to give me MIDI clips. And they sound awesome! So I'm pretty motivated to finish this thing. 

But so far, steps 4 and 5 -- rounding the values in the original list to the set of values in the tuple, and then outputting a new list to pass to MIDIUtil -- this has got me totally stumped. And after half a week of working on the problem I was so burned out on it that I just took a 10-day break from Python altogether. I can get it to work with one value, any value in the defined range. But as soon as I try to loop over the process with a second value I get completely unexpected results, and no amount of stepping through the debugger seems to be giving me insight into what I don't understand. It has something to do with the way lists, tuples, and dictionaries interact, but I haven't been able to nail it down just yet.

Writing about that now, I've actually gotten myself more motivated than I've been in two weeks to have a second look at it. This is what I'm talking about!

And this also gets me excited about getting my music out again. This month I'll be releasing a single which has been done more or less for over a year; and my EP, which has been finished since April, I think I will set for an early August release. My original plan was early July, but I kinda lost a month there...

Oh well! Time to teach.