New album: Interference Waves (2022 Singles, Outtakes & Allsorts)

It’s another new album! This isn’t really “new” music, though. It’s a compilation of tracks I recorded this year that weren’t already included on one of the three (!) other albums or one EP that I already released this year. It’s all on Bandcamp now. And on YouTube too, actually.

Another obscure WordPress problem: setting document.domain for cross-site scripting iframes breaks Gravity Forms AJAX submissions

Whew… that title was almost as long as the variable name I’m about to throw out in a code example.

I spent well over an hour beating my head against the wall on this problem today before narrowing it down to a Gravity Forms issue. The scenario: I have a site that is loading iframes from a different subdomain. As is common in this situation, I wanted to be able to adjust the height of the iframe with JavaScript, to match the height of the page within the iframe and prevent internal scrollbars.

The solution to that problem is readily available on teh interwebz, with the addition of a bit of extra JavaScript to allow cross-site scripting: both the containing page and the contained page need to specify the same document.domain so browsers will let them talk to each other.

Not long after we put this in place, my client informed me that none of their AJAX-based Gravity Forms were working. The spinner would just spin indefinitely, even if (usually) the form actually did submit properly. It didn’t take me long to narrow the problem down to a JavaScript error pertaining to cross-site scripting. I found that AJAX and document.domain don’t mix. Or at least that seemed to be the issue.

But that’s where I hit a wall. No one else seemed to be describing the exact problem I was having. Most solutions involved adding a Access-Control-Allow-Origin header, but that didn’t do anything for me.

Eventually I realized that was because the problem wasn’t with the AJAX, per se. It was the fact that Gravity Forms adds its own hidden iframe where it works some secret mojo on AJAX submissions. And that iframe needed to have document.domain added to it, just like my site and the other subdomain I was loading in iframes did.

So the question then was, is there a Gravity Forms hook to modify its iframe output? Fortunately, the answer is yes.

The gform_ajax_iframe_content filter pretty much does what it says on the tin. Add a filter to insert the necessary JavaScript, and you’re good. The only thing I don’t get about this is the name given to its lone input parameter. I mean, really? (Actually… I do think I understand it, but I don’t understand it.)

Anyway… here’s what you need to make this work. Just replace example.com with the correct domain name. And if you’re running on a version of PHP before 5.3, you won’t be able to use an anonymous function. But you’re not running an old version of PHP, are you?

add_filter('gform_ajax_iframe_content', function($doctype_html_html_head_meta_charset_utf_8_head_body_class_gf_ajax_postback_form_string_body_html) {
  echo "<script>document.domain = 'example.com';</script>\n";
  return $doctype_html_html_head_meta_charset_utf_8_head_body_class_gf_ajax_postback_form_string_body_html;
});

Covering Kraftwerk: the process (part 2)

A couple of weeks ago, I wrote about the first steps in my process of recording an EP of Kraftwerk covers using solely the Pocket Operator series of micro synthesizers.

This weekend I returned to the project. I am not yet recording anything with the Pocket Operators themselves, but I am continuing the process of recording rough versions of these covers using software instruments in Logic Pro X. There are three reasons behind doing this:

1. Learning the basic structure of each instrumental part in the songs.

2. Building my overall arrangement of each piece, so I have a framework to work from as I record the Pocket Operator parts.

3. Determining which keys to transpose the songs into (since the Pocket Operators only have a 2-octave diatonic scale and can’t play chromatic notes), and having recorded versions of the parts in the new key to work from on the Pocket Operators.

As of today I have the rough mixes from Logic Pro X of all 4 tracks, so my next step is to actually get the Pocket Operators going and start recording the real parts.

The links below are rough MP3 versions of these Logic Pro X arrangements. None of the sounds you hear will be on the final versions; these are simply guide tracks for me to use in recording the real parts. Also, there are a few “open” sections in the middle of the songs (especially “Ruckzuck” and “Tour de France”) where I’ve left room for additional improvisations or manipulations.

I did not try to perfectly reproduce every part, or exactly follow the structure of each song. These are my interpretations and I’ve taken some liberties — especially with “Ruckzuck”, since I’ve never been a huge fan of the aimless noodling of the improv section in it, nor of its ever-increasing tempo.

1. Ruckzuck

2. The Man-Machine

3. Pocket Calculator

4. Tour de France, Étape 1



I haven’t yet decided if I’m going to try to record any vocals. But I think if there’s anyone whose singing I can handle imitating, it’s Ralf Hütter’s.

New adventures in hi-fi… er, iTunes Match

As successful as iTunes has been in transforming both the music industry and the music listening experience, it has, from the beginning, been hamstrung by restrictions imposed by the outmoded, fearful major record labels.

Little by little, Apple has whittled away at those restrictions while managing to create a hugely successful business — iTunes has for several years been the largest music retailer in the world. First there was iTunes Plus: a boost in quality and a victory for users with the elimination of DRM copy restrictions. And now we have the real game changer: iTunes Match.

For $25 per year, you can now store your music “in the cloud.” iCloud, to be specific. That annual subscription allows you to create a centralized, comprehensive library of all of your digital music on Apple’s servers, and accessible from any of your computers and iOS devices. No more worrying about limited disk space or struggling with syncing issues. It just works.

In principle.

In practice? Well, I put iTunes Match to the test today. My music library poses a few unique challenges to this new service:

  • My library consists of over 18,000 songs, and more than 140 GB of data.
  • My main computer is a MacBook Air with a 128 GB hard drive, so I keep a “master” library on an external hard drive and a day-to-day library on the internal hard drive.
  • My main iOS device is a 32 GB iPhone 4, which has been syncing with the “day-to-day” iTunes library on my Mac’s internal hard drive.
  • SLP and I have our own iTunes accounts but have long desired to have a single shared music library.
  • My music library consists mostly of non-iTunes Plus tracks: a mix of DRM-laden 128 kbps iTunes tracks, ripped CDs, and tons of MP3s downloaded from Amazon.com.

With these factors in play, I had some specific goals for iTunes Match, roughly in this order:

  1. Move my “master” library from an external hard drive that sits on my desk, into iCloud where all of our devices can access it.
  2. Free up precious storage space on my MacBook Air and iPhone.
  3. Upgrade old DRMed 128 kbps iTunes tracks to higher-quality, DRM-free, 256 kbps versions.
  4. Consolidate SLP’s purchased iTunes music (around 600 songs) with my main library.
  5. Clean up duplicate tracks.

Spoiler alert: I pretty much knew going into it that the last of those items was going to get worse before it got better. But there were still plenty of surprises (good, bad and ugly) along the way.

The journey of 1,000 miles (or 18,000 songs) begins with a single step

I began my iTunes Match journey about two weeks ago, as soon as iTunes Match became available to the public. (For what it’s worth, I’m registered as an iOS developer, so I had access to the beta, but was never able to get it working properly.) The first goal was to get all of my music loaded into the system, and for the most part that went fine. Which is to say, it went… and went… and went… and w…e…n…t… fine. Loading the 4,000 or so songs I kept on my internal hard drive was fairly inconsequential. The process completed in a couple of hours while I went about my work that day. But then when the time came to fire up the external drive and load the remaining 14,000 or so songs… hmm. How can I put this? I guess the plus side was that I could leave it unattended and sleep, because it took three nights (overnight) to finish.

At that point I left things alone for a while, as I was too busy at the time to devote an entire day to organizing and cleaning up my music library. I did, however, get to play around with the overall iTunes Match experience for a week or so, and I discovered the following:

The good:

  • Having my complete music library at my fingertips on any device is amazing.
  • Streaming works great on the Mac, iPhone and Apple TV. Just pick a song and within a few seconds it starts playing.

The bad:

  • Browsing can be slow, sometimes painfully so, with a large library. This is especially a problem on the iPhone.
  • Cover art is often missing. I haven’t yet determined if it’s just not being downloaded, or if it’s not attached to the albums in iCloud, either.

The ugly:

  • Syncing an iOS device with iTunes on your computer can become a real mess. It’s hard to delete anything: like Michael Myers, no matter how many times you shoot him or stab him or stick a hanger in his eye, he just keeps getting up and coming back to get you. OK, bad analogy. But it almost feels that way.
  • Sometimes you don’t really want to remember just how many songs by Edison Lighthouse, England Dan and John Ford Coley, or Peppermint Trolley Company you own. It would be nice to have more filtering options than: a) just what’s on your device, or b) the whole shebang.

The big day arrives

Today I finally decided that I could afford to put off almost all of my real work for an entire day and devote my attention singularly to the task of getting iTunes Match fully synced, and SLP’s music fully integrated into the main library. To be honest, however, it’s not just today. I began the process at around 8:00 last night, worked until just after midnight, resumed from 7:00 to 8:30 this morning, then worked on it straight from 10:30 AM to 3:30 PM and again from about 7 PM to 10 PM, when I began writing this post. That’s 13 1/2 hours total, or approximately 2.66 seconds per each of the 18,266 tracks in my library. YMMV, as they say, but I’d guess it’s reasonable, if you’re trying to budget some time, to assume that you’ll need about 3 seconds times the number of tracks in your library. (And I’m still not really done.)

I took some notes today as I was going about things. Here are some pertinent observations:

Some things were just plain gone. I’m pretty sure this was the fault of my own carelessness in keeping my various pre-iTunes Match libraries in sync, but it’s worth noting that two conspicuous omissions in my library were The King Is Dead by The Decemberists and The King of Limbs by Radiohead. Coincidence?! I think… well, actually, yes, I do think it was probably just a coincidence. Luckily I was able to track down backups of both of those albums, but now I wonder what else is missing that I’m forgetting about.

“Matched” tracks are hit-and-miss. I’m sure Apple is relying on some very powerful algorithms to analyze each track in your library, in order to determine whether or not it matches a track that already exists on iTunes. It’s clearly not just relying on title-and-artist matching like the longstanding (and semi-useless) “Display Duplicates” option. One of the big selling points of iTunes Match is that if your music is available on iTunes, even if you didn’t buy it there, you’ll get the (usually higher-quality) iTunes version instead of the original version in your library, saving you time and saving Apple server space, as well. (Macworld’s Jason Snell has written an excellent tutorial on how to upgrade your tracks.)

The algorithms aren’t perfect, however, and I was annoyed to discover numerous cases where all but one or two tracks of an album were “matched” and could be replaced with 256 kbps iTunes versions, but the other tracks were rejected, for reasons unknown, and were stuck with the inferior quality versions I had to begin with.

Duplicates are a mess. Apple has done a lot to try to make it easy for you to find and weed out duplicate tracks, but you still have to do it. I appreciate that they don’t just assume which tracks you will or won’t want and automatically delete things capriciously, but I still wish there were a more efficient way to trim the excess.

Cloud symbols and error messages could use some clarification. Neven Mrgan has a great summary of the icons and his interpretations of their meanings, but I encountered too many dialog boxes today with useless statements like “This item is not eligible for iCloud” or “The track could not be downloaded because an unknown error occurred.”

If you’re trying to consolidate tracks from two separate iTunes accounts into a single library, you’re on your own. While the 10-device limit on DRMed iTunes tracks, and iTunes’ ability to be authorized for multiple accounts on a single device, allows for this kind of consolidation, Apple has not gone out of its way to support such activities. In my situation, I was dealing with a large number of SLP’s iTunes purchases that were no longer on any of our devices. I happened to have a spare Mac in my office with an empty iTunes library, so I logged into SLP’s iTunes account on that Mac and used the “Purchased” link in the iTunes Store to re-download all of her music in prep for eventual syncing with the main library.

But it wasn’t that easy. At first, a bunch of the songs wouldn’t download. I realized it was because they were still DRM versions, and that I needed to pay another $25 for an iTunes Match subscription on SLP’s iTunes account to get them. Even then, there were a number of weird issues with tracks being unavailable. Strangely, it seemed that in some cases, if I already had some of those tracks in the master iTunes library, and had already downloaded 256 kbps versions of them, it would not allow me to download them on this second computer. This leads me to believe that there is some hidden mechanism whereby Apple does still keep track of even the DRM-free tracks that have been downloaded, and if they’ve been “transferred” (as it were) to another user’s library, they become unavailable to the original user. This is just a guess, but it seems to fit my experience. (On a related side note, since this second computer was not yet authorized with SLP’s iTunes account, I needed to authorize it — which was triggered by attempting to play a song — before iTunes Match would work properly.)

What if your music is no longer available in the iTunes store? I’m sure this is one of the most commonly asked questions about iTunes Match, and I’m sure Apple has given very reassuring scripted answers, but it still remains as perhaps the biggest risk you take in trusting your music to the cloud. Tracks that iTunes fails to match and has to upload should be no problem, but once you’re relying solely on a “matched” track — or, for that matter, a “purchased” or “protected” track — you’re at the mercy of Apple and the record labels keeping the music available. I initially noted this as merely a point to ponder, but during the process of integrating libraries I encountered the problem firsthand. SLP had an album that was DRMed 128 kbps, but which is no longer available in the iTunes Store, at all. Luckily I had it copied to my master library already, or I wouldn’t have even known it existed. As it was, I was stuck with an album of low audio quality and that iTunes refused to load into iTunes Match. (It was “ineligible.”)

I hit upon a hokey workaround solution, one that is flawed mainly in that it results in further compression/degradation of the sound quality of the tracks, but at least it’s a way to get the music into iTunes Match. I burned a CD of the album, then re-ripped that CD back into iTunes, DRM free. (That’s the old school way of circumventing iTunes DRM, circa 2004.) It worked, but of course I’ll always know that the sound quality is sub-128 kbps. (Not that it matters much to me, as it’s an album I’ll probably never listen to.) This led me to a related discovery…

Burning a CD of DRMed tracks, re-ripping it, and uploading the results to iTunes Match will not get you “matched” DRM-free 256 kbps versions. Granted, my sample size here is pretty small — two tracks — but I suspect this is deliberate (if it’s possible). In addition to the aforementioned unavailable album, I found two other tracks from SLP’s library that stubbornly refused to load into iTunes Match, even though the rest of the tracks from the albums they were on were recognized and “matched” with no problem. So I burned them onto a CD, re-ripped the CD, and loaded the tracks into iTunes Match. No match. Just the further-compressed versions based on the original DRMed 128 kbps tracks.

Corrupted files? Are you kidding me? I had been wondering what might happen if files got corrupted, either during upload or download. Unfortunately, I found out. Just another meaningless error message with no real indication of a solution. I’m a few thousand tracks into the “upgrade” process so far, and to this point I’ve had four songs fail to download due to an “unknown error.” The behavior is the same in most cases: the song appears to download several times in quick succession. As soon as the progress bar gets to the end, it starts over again. After maybe 5 attempts, it stops with an error number (sometimes err = -100000, sometimes err = 11111). I think it may be necessary to contact iTunes customer support to resolve the issue, but I want to wait until I’ve finished downloading all of my music, to see if it happens with any other songs first.

So, is it all worth it?

I still have a nagging fear that some kind of catastrophic data loss is just around the corner, but so far I am inclined to say that iTunes Match definitely is worth it. It was delayed by a few weeks and still seems like it may have been rushed out the door, but I am hopeful that most of the current glitches and usability issues will be resolved over time. It would be nice if it “just worked,” as we Apple fanbois are so frequently inclined to say, but knowing the complexity of the task at hand, it’s a nearly superhuman achievement, even flawed as it is today.

At the moment I still have almost 3000 low-quality tracks that are eligible for an upgrade (using Jason Snell’s smart playlists), not to mention countless duplicates to weed out and a few other stray errors (in my nightmares, clouds have exclamation points) to contend with. But I think the biggest testament to the magnitude of Apple’s accomplishment is that it’s actually gotten me excited about “the cloud,” something I’ve looked upon disdainfully for years.