I (U+1F494, BROKEN HEART) UTF-8

Something has gone very wrong with the database encoding on this blog after a recent update, so all my lovely UTF-8 characters have gone mojibake.

Trying to find ways to fix it. It may have to be manual. Remember, kids: have backups before letting WordPress upgrade!

Here’s the Python equivalent of what I think the database has done:

bytes("I ???? UTF-8", encoding='utf-8').decode(encoding='cp1252')
'I 💔 UTF-8'

Quite why my hosting thought a character encoding from last century was appropriate, I’ll never know.

Update, November 2023: kinda-sort fixed the backend, but the encoding is still weird — can we…?

Generational loss in MP3 re-encoding

Okay, name this tune:

madplay / lame – 1000 iterations

(You’ll have to scroll about half way in before anything starts)

Didn’t get it? Try this:

madplay 24-bit / lame – 1000 iterations

(Again, you’ll have to scroll about half way in before anything starts)

Missed that one? Okay then, how about:

lame / lame – 1000 iterations

(no need to scroll here.)

Unless you’ve been living under a rock, it’s a clip from Adele‘s Someone Like You. Sure, you can’t make out the words too well in the last one, but at least they don’t sound like some dire paen to Cthulhu, like the first two do.

All of the above samples are the same source file re-encoded 1000 times. I’d heard that there was some loss to encoding MP3s, but thought that if you kept about the same bitrate, there wouldn’t be too much loss. I wanted to test out my theory, so I took:

  • LAME — a quality mp3 encoder (that can also decode to WAV)
  • madplay — a decent mp3 decoder that uses fixed point for speed
  • a shell script (see below) that encodes an MP3 1000 times, feeding the output of the last run as the input of the next.
  • a sample clip; in this case, ganked from Amazon.com: 21: Adele: Music using Audio Hijack Pro.

The original sample looks pretty clean; it’s not the highest quality, but it’s clear:

The first thing that strikes about the multiply-reencoded file is that it’s much longer:

This is because LAME adds padding to the beginning and end of each song. All this padding adds up over 1000 runs.

I’d used madplay extensively before, so I knew it worked reliably. First, I tried it using an intermediate sample size of 16 bits (same as the source) and no dithering. Just after 100 runs, Ms Adkins’ plaintive voice becomes hard to understand:
madplay / lame – 100 iterations

I’d turned dithering off in the first test, as I thought it would overcome the signal. As the signal was pretty much gone, I didn’t think I had much to lose, so I tried it at madplay’s full capability of 24 bit internal processing. Again, 100 runs was where things started to go really sideways:
madplay 24-bit / lame – 100 iterations

LAME can also decode MP3s, and remarkably, the lyrics remained discernable after 1000 interations (so go and see the third sample up top). Sure, it sounds scratchy, but the piano sounds like a piano and not like some underwater harp. LAME is clearly able to recognize its own input, and decode it accordingly. madplay, on the other hand, just treats an MP3 as a generic MP3, hence the over-compression and extra silences.

So really, if you’re going to re-encode music, it matters more what you use to decode your MP3s. If you can use the same tool for both, all the better.

Yours truly, ‰te>a…t

I like epost. I’d like it even more if they hurried up and processed my direct payment ability — which required a form and a void cheque mailed to an address in Toronto — but it’s a pretty good service. I get my bills, viewable and payable online, on the day of issue. No paper. This is good.

This is good because every single filing container I buy eventually ends up full of (paid) bills and financial administrivia. Less paper = less messy Stewart = happy Stewart. Some messes, like my electronics table, could be classed as glorious, however, and therefore joyous in their creation and use. Not all tidiness is good.

So I got my first Visa bill by e-post. Yay! Reviewed it, paid it. No hassle. But since this a PDF facsimile of my bill, something mighty odd has happened to my address:

It’s a perfect substitution cypher of my name and address. I’ve been out of the prepress industry for long enough not to immediately recognize it as a font encoding error. I’m confused why it might have A, T, E & N, but no M. Odd indeed.