Mar 302024

Though vintage programmable calculators remain one of my oddball hobbies, it’s been a while since I last mentioned them in this blog. And it’s especially rare that I’d write about a non-programmable, perfectly ordinary, dirt cheap, dollar-store quality mass-produced Chinese scientific (“56-function”, standard chip) calculator, but this one is different.

Why? Because I fixed the darn thing, that’s why.

Why am I so proud of my accomplishment, fixing something that most folks would have thrown away as a worthless, broken piece of junk? There is a very specific reason.

The bane of cheap calculators for the past 20-odd years has been the connection between the calculator’s main circuit board and its liquid crystal display. The liquid crystal display contains transparent connections, but these, rather obviously (it’s glass!) cannot be soldered. So how do you connect the display and the circuit that drives the display? In the earliest LCD devices, this was accomplished by a strange, rubbery part, a conductive silicone “zebra strip” that made an electrical connection between a series of connectors on the circuit board and the corresponding leads on the display glass. The device worked if this zebra strip was properly sandwiched between the display and the circuit board and held together tightly, which required an appropriate mechanical construction.

More recently, these have been replaced by, ahem, I think they’re usually referred to as “zebra stripes” or maybe “zebra lines”: essentially, paper-thin sheets of plastic with parallel conducting lines. A short strip, or stripe, attaches on one end to connections on the circuit board, and on the other end, to the LCD display. The attachment is adhesive (which may be heat activated) and once attached, there’s no need for mechanical pressure to hold the parts together. This, I presume, makes the design less constrained, and reduces manufacturing costs.

The problem is that these zebra stripes can become detached. This leads to a failing display: Digits vanish, segments vanish, crosstalk appears, the display becomes garbled and unreadable.

In some cases, this can be reversed by (very) carefully pressing down the stripe on both ends, with a hard but not too sharp tool as you wish to apply pressure to reattach the adhesive, not destroy the plastic. Sometimes, a heated tool works better. But the result is uncertain: Sometimes it works, sometimes it doesn’t, sometimes it fails a few hours, days, weeks later.

If the zebra stripe is mostly or completely detached, or if it is damaged, the device is dead. Or so I thought… until now.

When this nameless “scientific calculator” came into my possession (found in a small bag of goodies that we bought at a thrift store) it indeed seemed hopeless. But I decided that it can serve as a perfect test case. For the first time ever, I endeavored to purchase a small piece of replacement zebra stripes of the right size from AliExpress. I had no idea how to use it properly, or indeed if it would work or not, but I figured it’s worth trying.

My first few attempts were disastrous. Applying too much heat destroyed the zebra stripe. Glue and molten plastic residue contaminated both the circuit board and the LCD display. Scraping it off was difficult and I was probably one bad move away from cracking the display.

But I didn’t. And on the fourth try, the display more or less came to life! I was ready celebrate success even though the display was not quite flawless, as it was already a far better result than I had hopes for. But at this point I noticed that although the display was now working, the calculator itself wasn’t: it no longer responded to any of its keys. I went through several iterations trying to troubleshoot this new problem before I noticed something: The zebra stripe I used was a tad longer than it should have been, and it made contact with another lead on the calculator’s circuit board, effectively short-circuiting its keyboard.

Once I corrected that, the calculator not only came back to life, even its display was now working like a charm. I feel like celebrating.

I don’t know how long it sill last: Cheap hardware is still cheap hardware. But now I know that repairing broken zebra stripes is possible.

So yes, this is how I am having fun during the long Easter weekend. Happy Bunny Day!

 Posted by at 3:03 pm
Mar 292024

In recognition of the fact that their journalist, Evan Gershkovich, has been in a Russian jail for a year already, The Wall Street Journal will appear tomorrow with a mostly blank front page, representing all the things Gershkovich might have written, but couldn’t.

I suppose they chose this form of protest because, as a respectable newspaper, they felt compelled to refrain from saying what, I am sure, many of them really wanted to say to that fascist in the Kremlin: Fuck you, Putin.

 Posted by at 12:27 am
Mar 262024

No, I am not worried about being eaten by a grue in the dark, as in the Great Underground Empire of the classic Zork text adventure games (if you ever played those games, you cannot possibly forget the ominous warning: “It is pitch black. You are likely to be eaten by a grue.”) Nor am I a secret admirer of Glavnoye razvedyvatel’noye upravleniye, the former USSR’s intelligence directorate, or its Putinist successor institution.

Rather, I am talking about networks of gated recurrent units, a machine learning architecture that is well suited to analyze time series data. I’ve been using “black box” GRU implementations for some time in a research project, but it’s one thing to learn to use a software library, it’s another thing to understand the conceptual details.

It is for that reason that (with the help of our sophisticated LLM friends) I embarked on a side project of building my own GRU network, in plain C++ code, without relying on other people’s solutions. That’s the best way to understand a software solution: Build your own!

Which may explain why I get excited when I manage to produce a plot like this:

Nothing fancy, just an amplitude-modulated carrier (red), with a lower frequency modulating signal (green).

But here’s the point: The GRU network doesn’t know a thing about amplitude modulation. It just learns the relationship between red and green. And learn it does: after a few passes using a training data set, it manages to reproduce the modulating signal with decent accuracy.

My code likely still contains subtle errors, as I suspect that it can do even better. A lot also depends on the model “hyperparameters”, parameters that define the model and control the training process. Even so, I am pleased and excited: It is so much fun, seeing a creation like this “come to life”, working as it is supposed to, doing some nontrivial software magic in a mere, what, maybe 700 lines of code, but that actually even includes some commented-out lines.

 Posted by at 3:28 am
Mar 142024

Like GPT-4, Claude 3 can do music. (Earlier versions could, too, but not quite as consistently.)

The idea is that you can request the LLM to generate short tunes using Lilypond, a widely used language to represent sheet music; this can then be compiled into sheet music images or MIDI files.

I’ve now integrated this into my AI front-end, so whenever GPT or Claude responds with syntactically correct, complete Lilypond code, it is now automatically translated by the back-end.

Here’s one of Claude’s compositions.


That was not the best Claude could to (it created tunes with more rhythmic variation between the voices) but one short enough to include here as a screen capture. Here is one of Claude’s longer compositions:


I remain immensely fascinated by the fact that a language model that never had a means to see anything or listen to anything, a model that only has the power of words at its disposal, has such an in-depth understanding of the concept of sound, it can produce a coherent, even pleasant, little polyphonic tune.

 Posted by at 11:14 pm