All Songs Considered Not Considered Harmful But Rather A Bit Limited In Scope

AllSongsConsideredNPR, you are great. You have shows that cover literally everything, from debating whether AI will be become skynet or Her, to fixing my car while getting relationship advice (RIP Tommy). I spend 3 hours a day commuting like a real American, and most of that time goes to podcasts from NPR.

Despite the title of this post, I like All Songs Considered quite a bit. Let me address you in the second person. I like the genuine excitement that you have for music and shows, especially because of the your two main hosts are a model to look up to, being older than stereotypical ages of people that get excited about new music and shows. Even when you had show a few years back of the worst songs of all time where you teamed up with Carrie Brownstein to try to make me feel bad for liking everything (We Built This City – Yes, We didn’t start the fire- yes, Baby I love your way – DEFINITELY YES). I don’t even know to what extent you were trolling, but it made me more aware about one thing.

I like everything now. I have the things I really love, but I also pretty much like everything else that I hear. I think this is okay. When I go to a vinyl garage sale, I buy 75% stuff I want and 25% stuff I don’t even know and I am not ever unhappy with it (to be fair it helps that it costs $1/LP). It’s completely fine.

Couldnt be as picky when there were only 4 mp3s on the internet
Couldnt be as picky when there were only 4 mp3s on the internet
Remember in high school and college when ‘liking everything (‘except country’ – as the phrase went)’ and a mishmash of random MP3s was code for “I don’t know care about music and I’m not cool, but I know how to dl warez (aol ‘zarew’ channel and hotline represent)”? Well, I was never much of an elitist, but I understand how that sentiment came about – it’s because it takes time to learn about a certain kind of music, and at freshman year of college, you won’t probably be able to know deeply about more than a few unless you are the Kid That Knew All Music. Now college is long past for me, I’ve seriously studied and listened to much more music since. And now I’m the guy who likes everything. But I still don’t feel that I will ever have that expert feel (or ‘hipster tone’ when I am jealous) to talking about music. But I appreciate the expert knowledge of the band’s background, influences and similar artists that folks like the All Songs can share with me. It’s so nice to just be able to enjoy things that are presented to you in this format without doing any research-like brain activity.

But what is up with the title ‘All Songs’? I love hearing about Weezer, Leonard Cohen, Radiohead, Neutral Milk Hotel, but it does make things more like “Indie Rock, Folk, Female Hiphop and some Electronic Songs Considered”. If you had such a title, I would be 100% satisfied with the show. But as it stands I am 95% satisfied. 5% means that at some time during the show I wonder ‘what would it be like if they played something without conventional rhythm next. When I started listening, you mentioned ‘experimental’ artists sometimes so I expected some artists that really try to do something different with music. And there is much non-experimental music that you don’t play, not because it’s not accessible, but for some other reason.

My dream podcast would have hosts like you guys that also included equal amounts of classical (old and avant-garde), jazz, harsh noise, computer music, and maybe some hawaiian music. Those are just the styles that have been in my interests, but it would be nice to get the other styles as well, giving the show more of an ethnomusicology feel then a hipster bent. I wish it could be less comfortable, not only for the audiences, but also for the hosts. One of the things that’s great about your podcast is that it introduces new music, and I feel like that’s at odds with the need to be an expert on the subject. In a nutshell, the show could do with more ‘curiosity’.

To be fair, you do occasionally play more ‘friendly’ noise/drone/experimental stuff like Fennesz and Deafheaven, and that’s a great start. But it’s once in a blue moon and that stuff is still closely connected to the indie rock world. I do understand that if you play both ‘harsh’ and ‘eclectic’ pieces that you risk losing users, but isn’t that true for any change you make? Lately NPR podcasts have been booming and it does seem like the goal of many is to maximize listeners, but if that is really the main concern, then maybe the show needs a new name. Titles are important in subtle ways. As it is I notice that when I listen to your podcast I feel that I am opening up my horizons, but then when I think about the problem of only playing the music you have expertise on is actually kind of limiting. And even a little scary because I don’t always realize the latter, maybe in part due to the subconscious effect of the title.

Just to test the idea I am really curious as to what would happen if you sprinkled these tracks over several shows. These are not new songs, but it’s a start to get the conversation going:

Playlist with all songs here. Single songs:

– David Dunn – Mimus Ployglottos

– Kalapana – The Hurt

– Merzbow – Rainbow Electronics

– György Ligeti – Désordre (Etude No. 1)

– Takeda Wataru – Seikatsu No Gara

– Paul Koonce – The Flywheel Dream

John Coltrane & Johnny Hartmann

Most of those songs are fairly old, and of well-established artists in these styles. I used them for examples, but my ideal show would present these kinds of classics for reference as well as find newer stuff in those styles and introduce them to me.

What would happened if you got a more even distribution of songs by getting other listeners to also suggest styles? Would it become noise? I don’t think so. I think it would give the songs you already play more perspective. I think it would make you feel more vulnerable – but as a lot of this new podcast world is showing, vulnerability is nice and can actually help drive the show.

All that being said, given the age of this show I’m sure you’ve had this discussion before, maybe even on the show. I’m curious to know what was the result of that discussion. Obviously, I’m not a radio producer and can’t say what’s best for your show. It’s a lot easier for me to describe my ideal show and its ideals. I originally had the title ‘All Songs Considered Considered Harmful’, but that’s just because its hard to resist and would make for nice hacker news clickbait. You’re doing a great job anyway, and I’ll be listening.

Systems

The world is watching: one cannot walk through a meadow or forest without a ripple of report spreading out from one’s passage. The thrush darts back, the jay squalls, a beetle scuttles under the grasses, and the signal is passed along. Every creature knows when a hawk is cruising or a human strolling. The information passed through the system is intelligence.” – Gary Snyder, The Practice of the Wild

A while ago on Stack Overflow, I asked a potentially off-topic question about metaphors for memory allocation (it was less-horrible a crime to post opinion questions at the time). Some entertained my question, but I thought the most thought provoking comment was that it was a horrible idea to tie any real-world analogies because of the possible confusion.

ceci n'est pas une (binary) tree
ceci n’est pas une (binary) tree

Years later, I remember this question often. In the time that has passed, I have made the answer my own strawman argument that I can go to battle with to give various interests in my life metaphorical continuity. On the one side, we already have decided it’s useful to call data structures by names of similar pre-computer concepts, like trees, memory, lists, containers, (not to mention both ‘structures’ and ‘data’) – we don’t need to come up with brand new words for each of these things, because the power of abstraction in its ability to be repurposed and recycled. I have not met programmers that are confused about where the chlorophyll exists in the leaves of the binary tree, nor people that think they need to sprinkle water on their computer to insert a new node in a tree.

That’s fun to think about, because it’s a nerdy and quick evidence-based answer to why analogy is useful for programmers. But lately, I find myself thinking about how other systems in my life are alike.

Besides computers, I am currently interested in these systems below. In fact, the word ‘systems’ and ‘network’ pop up in most of my hobbies:

  • Engine/Car repair – appreciating what does what in my car (quite literally, appreciating ‘engineering’) helps me to feel more comfortable with what is probably the most expensive thing besides a house that I’ll ever own. Running into various space and tool constraint problems in replacing my head gasket/valve seals/timing belt feels very similar to debugging software when you need to come up with clever ways to get the info you want to solve the bug.
  • Chanterelles have roots that create a network between trees
    Chanterelles have roots that create a network between trees
    Ecological Systems – the interaction between plant/mushroom/animal/climate/terrain is so amazing that it goes far beyond the basic darwinistic view of a single organism’s fitness (did you know trees use mychorrizal networks (like a mushroom root) to transfer nutrients from the more abundant trees to the lesser ones?). Darwin said some pretty cool stuff in the origin of species about how every few feet comes a different distribution of plants and animals that are best suited to the environment. As I see more and more connections between the species, it seems more and more like the ecological system itself behaves as an organism itself.
  • Fitness – understanding the interaction/balance of muscles has been useful for my improving posture and well-being. At first, I thought that weightlifting and talking about muscles was just for serious strong bros, but after swimming and jogging didn’t really help me out, looking into muscular anatomy showed me some clear muscular imbalances that would be obviously helped out with weightlifting. This is a study of the body and the interaction between its parts – a very complex constraint solving problem – and the connections were more counterintuitive than I imagined. I had no idea for a long time that my hip angle is what would cause me to hunch over, and I didn’t even have the physical self awareness to note that I was walking around with my hips fully extended in pelvic-thrust mode. And of course, the exercise and progression of the body is an interesting system of its own that ties in others, including nutrition.

Becoming more familiar with all of these systems has brought me happiness, and has counterintuitively made the world more simple as I invest more time into understanding their internal structures and meaning. All of them seemed like impenetrable opaque black boxes when I first started looking at them, and I may have even had the impression that it wasn’t worth digging in because it was more efficient to leave the specialist knowledge to the specialist. It’s worth mentioning that my feelings about this are similar to the argument against ‘leave cooking to the chef’ in Zen and the Art of Motorcycle Maintenance.

Shepherd's tone scales are a good analog of Penrose stairs
Shepherd’s tone scales are a good analog of Penrose stairs
My master’s thesis and a large amount of my music was about finding similar structures in music and software. At the time I remember thinking that this was a very special connection, and that I just-so-happened to be lucky enough to be working with both music and software. But the real lesson was that seeming unrelated systems have deep connections, and that the noticing of these connections is a very powerful thing that can add depth and perspective to a subject one is interested in.

Although it’s always tempting to be a purist when coming up with bizarre theories, some systems are more compatible than other systems. This happens often in music – for example, a shepherd’s scale (a scale that seems to get higher and higher) is a great analog to Penrose steps (that Escher made famous), but my idea to make an audio-only version of space invaders never panned out because some things just won’t translate very well even if you really want them to. I’ve heard anecdotally that composer Gyorgy Ligeti, who was himself interested in visual phenomena, made it a point to tell his students that one shouldn’t force a sonic representation of a visual phenomenon just because the metaphor sounds good – and I would agree that there’s a fair deal of art in these connections.

NSKeyedArchiver performance and custom class alternative

NSKeyedArchiver is a common choice for saving data of medium complexity, alongside plist serialization. More complex and you might use CoreData, less and you might use NSUserDefaults. I use NSKeyedArchiver in my Voicer app to record the metadata for sound. For the metadata I tried to design the format so that it would be very responsive, by only keeping index markers to audio samples in external files. However, I noticed for long sounds that were over an hour, it could take around 10 seconds to load just the metadata.

I thought about it longer, and decided that the reason for this must be the key-based lookup. So, I went ahead and removed all the keys (this is generally safe to do as long as you encode and decode in the same order). But, performance did not increase. I then tried using NSArchiver, which is listed in the mac os x docs as deprecated, and is not even mentioned in iOS docs. It is much faster. The only reference I found to it was an older StackOverflow post from 2012. However, using it is problematic, because presumably, it counts as private API which could be rejected on app submission.

It's convenient!
It’s convenient!
I put it down for a long time, but recently came back to it – I fixed up and renamed the Cocotron NSArchiver class to NSKeylessArchiver so that it could exist along side the private one. The results are okay, but could be improved.

Writing directly to a file would be faster for my case, but I’m sticking with the initWithCoder method for now, because it is less work, but also for maintenance – the encode/decode functions are nice, and it’s easy to have backwards compatibility with NSKeyedArchiver by checking a file extension to determine the right Unarchiver to use. The NSKeylessArchiver also does some fancy but mostly-cheap stuff, such as string and object references – if you use the same string twice, it will only occur in the archiver once, and used as a reference the second time.

Here is the github repo and the readme:

How to use

Add NSKeylessArchiver and NSKeylessUnarchiver’s .h and .m files to your project. If you have an arc project, you will need to go into the "Build Phases" tab of your project settings and add the ‘-fno-objc-arc’ flag to both NSKeylessArchiver.m and NSKeylessUnarchiver.m.

Then, just #import "NSKeylessArchiver.h" and use it like an NSCoder. See the performance test project below for a sample.

When to use

If you have a moderate to large use case for NSKeyedArchiver that does not rely on keys (e.g. uses only -[NSCoder encodeObject:] and -[NSCoder encodeObjectOfObjcType: at:] as opposed to -[NSCoder encodeObject: forKey:]), then you may be able to use this. The keyed based encoding and decoding is much slower, because it allows for random access. The non-keyed method allows a faster linear, forward-only read and write because it requires the order of encoding and decoding to be fixed. Mac OS X has a deprecated NSArchiver/NSUnarchiver, and iOS has this, but is not a public API.

How do I get backward-compatibility without keys? Forward-compatibility?

A frequent cited advantage of NSKeyedArchiver is that the keys provide easy backward-compatibility. It certainly helps, but of course, backward compatibility can exist without keys.
If you store a version number, you can still add and remove new objects/data, and check the version number on load to determine whether or not to decode or not. If this is not clear I will expand on it later.

Forward-compatibility via keys is much harder, but in the ‘save user data’ case, you may not need it – the only way that you will need to load a file from a future version is for cloud-based methods.
If you do need it, it is possible to implement schema for forward-compatibility with NSKeylessArchiver, by using keys implicitly in an NSDictionary (which you should be able to use with NSKeylessArchiver!). The other options are probably too messy, and likely remnicent of file formats that specify a byte length of each component and subcomponent, in which case you should just write your own binary file.

Performance

First of, if fast-as-possible performance is your goal, you might consider something else, such as directly writing to a binary file. This is a trade off for having the convenience of having a drop-in replacement for compliant uses of NSKeyedArchiver.

For a test case, I compared NSKeyedArchiver, NSKeylessArchiver, and NSArchiver with a simple root object with 20000 ints. Please feel free modify the test repo and this class to improve performance and correctness. This was the result of running a release build on an iPhone 5S, with 10 runs per class:

encoding (min/max/avg secs) decoding (min/max/avg secs)
NSKeyedArchiver 0.2048/0.2453/0.2165 6.8919/6.9238/6.9037
NSKeylessArchiver 0.0407/0.0506/0.0451 0.0253/0.0330/0.0287
NSArchiver 0.0094/0.0114/0.0102 0.0019/0.0025/0.0020

As you can see the performance for this unrealistic use case shows NSKeylessArchiver doing much better than NSKeyedArchiver, but worse than NSArchiver. NSArchiver is a better choice, but apps that use it may not pass iOS app review due to the private API status. If you know otherwise, let me know.

In practical use, I have seen about a 2-5x speed increase for a use case that had ~20,000 ints/floats/objects being encoded/decoded.
It seems logical that the gains will be larger for encoding schemes that have a larger ratio of encoding calls to actual data being encoded.

For reference:

The Magical Bookstore

One of the joys in life is walking into a bookstore, after being away from bookstores for a good amount of time. I can’t quite say why it is so nice, but I have always felt this way. Recently, I came across an interesting book that made me think about this puzzle. The only thing I can remember about the book is its title. I don’t even remember seeing the book – perhaps I saw it as an online recommendation or reference at the bottom of an article. But it has stuck with me, in a nagging and profound sort of subtle that has me thinking there really is something magic there.

Cow Books in Naka-Meguro, Tokyo
Cow Books in Naka-Meguro, Tokyo

The title of the book is 「なぜ本屋さんに行くとアイデアが生まれるなのか?」(Why is it when you go to a bookstore, ideas are born?). I don’t plan on reading it, at least not for a while. I sort of like the mystic that it provides the bookstore, and the unanswered prompt it gives me for understanding the true values of my own consumerism. That is to say, while there is certainly some connection between books and new ideas, the author clearly asks about bookstores and not other places where you can get free books, such as a friend’s house or a public library.

This makes me recall my first two-year stay in Tokyo, just after I had graduated from college. I integrated where I wanted to, but at the end of the day the nuanced stresses of culture shock led me to foster what I believe is a queer consumerism designed to help keep me grounded in a somewhat foreign land. I would go to Jimbocho, which is the famous book’s quarter and visit many shops on a regular basis. I would search for first editions of classic literature, such as Joyce or Hemmingway. I was a student working a part-time job to fund my entire stay, so I would usually just look at the dusty old tomes through glass and protective plastic, but sometimes I would buy one at a premium rate, this being Japan. Somehow it meant something to me that the books were priced so highly. I think I felt like the money was a token of respect that I could offer to dead authors – that the price valued the book more than normal.

Christopher Alexander’s best known book is still a rare find at bookstores (amazon link)
If I were to visit Japan and go back to the same bookstores today, I would be able to buy many more books than I could have before. This buying power somehow reduces the experience, and my 25-year old self wouldn’t have liked that. Although I don’t have the desire to buy many first editions nowadays, I can still understand what I was doing then. Price labels and and implicit value (positioning and presentation) are such an important part of walking into a bookstore. This is just one part of why bookstores are special places.

Last week, I walked into Pegasus Books on Solano Ave in Albany (California). I was elated to find the architect Christopher Alexander’s The Nature of Order and The Process of Life. His books are always very expensive, even used, perhaps because they are rarer. It is sort of my automatic action to search for Alexander’s books every time I enter a used bookstore. I plan to write more about his Pattern Language, and A Synthesis of Form later. But for now, I will just mention with amazon links that these books were very influential architecture books from the 70s that mesh well into programming practice, and have played a role in influencing the Gang of Four’s Design Patterns.

Xcode: Semi-stale libraries and the simulator

xcode plays dirty when updating .a
xcode plays dirty when updating .a

Edit: (2/8/2014) As usual, I’m an idiot – this problem was caused by having explicit linker library search path flags (e.g. -LTo/My/Old/AdMobDir) that took precedence over the new libs I added. It didn’t matter that I removed the old ones from the Xcode and git, because they were (oddly) specifying an external directory that had a copy of the same libs. I’ll leave this post up to remind myself about this, at the expense of my credibility.

Today it is my birthday, so I thought how fun it would be to update AdMob for an iOS app. Since it’s just .a and .h files, it would be doable in under a minute. But after updating, I still got the message:

2015-01-10 20:40:24.194 Noise[13472:10630180] You are currently using version 6.5.1 of the SDK, which doesn’t officially support iOS 8. Please consider updating your SDK to the most recent sdk version, 6.12.2, to get iOS 8 support, including a fix for smart banner rendering in landscape mode. The latest SDK can be downloaded from http://goo.gl/iGzfsP. A full list of release notes is available at https://developers.google.com/mobile-ads-sdk/docs/admob/ios/rel-notes.

I did rebuilds after each of these steps: clean, deleted the old libGoogleAdMobAds.a of the same name from my source control, removed libGoogleAdMobAds.a from link phase (error’d as expected), re-added it, all to no avail – the simulator build was still showing the same message.

Then I remembered deleting the app from the simulator has historically fixed certain issues (stale app icon/xibs/etc), so I tried that. Worked like a charm.

I think I’ve seen this issue before – but the only way I knew that stale libs were the cause of it was because of the log message. Since upgrading a library usually will support the same old symbols, there generally won’t be a linker error – so this could potentially waste important debugging time with the programmer incorrectly believing he is debugging the newest version of the lib.

I hope and believe that the issue is just in the transfer of the project and ‘overly-clever’ optimization of transferring the app to the simulator that missed a diff case, because the deleting trick worked. Perhaps the transfer diffs only non-linked code – although, I would expect it to include statically linked stuff and only have this issue for dynamic linkage. This took around 15 minutes of messing around to figure out, but it seems like something that could bite back in the future.

Update: I tried this same project on another mac and my iPhone and found that the deprecated message was still there, just deferred, so this post may not be a correct solution. It’s possible that the message itself is bad, but I’m not sure yet. To check my sanity, I did these steps: git fetch/merge to update to the new admob libs (while the project was closed). The problem was different here – it persisted even after cleaning/rebuilding and deleting the app from the device. I restarted Xcode on a hunch, and also tried nuking the derived data folder.