Henrik Carlsson's Blog

All things me.

Filtering wp-links-opml.php for categories

posted this on and tagged it with Narrating my work

Quick note to self, since I will definitely wonder about this again. If I want to view my list of WordPress links as an OPML (i.e. wp-links-opml.php) and filter for a specific category, the way to do that is to add the ?link_cat=[category id] suffix to the URL.

Sunrise (Draft 01)

posted this article on and tagged it with Music

A first draft on an Eno-esque ambient thing.

A JavaScript application randomizes note order from a list of allowed notes and pipes them to the Web MIDI Api They then enter Ableton Live which routes the MIDI to an E-Mu Proteus/2 that does the actual sound generating. The sound from the Proteus is then treated with delay, reverb and Valhalla Shimmer in Live.

This is very much inspired by the article JavaScript Systems Music and by Eno’s Airports 2/1.

Replies and comments

Jag är väldigt kluven inför läget inom politiken nu

posted this on and tagged it with Svensk politik

Å ena sidan är jag glad över att Centern och Liberalerna är tydliga med att de inte tänker stödja sig på Sverigedemokraterna för att regera. SD är inte som många andra högerpopulister i Europa, de är rasister och har inget i en regering eller som stöd till en regering att göra.

Nej visst, just du SDare som läser det här är självklart bara en ”konservativ sanningssägare” eller liknande och om du envisas med det så kan jag inte göra annat än att ta dig på orden. Partiet som du företräder och/eller röstar på är dock inte ett konservativt parti, det är ett rasistiskt parti vars höga företrädare inte respekterar grundläggande demokratiska principer.

Så Alliansen i regeringsposition med SD som stöd i riksdagen är inte bra. Inte bra alls.

Alternativet å andra sidan är regeringen som vi dras med idag. En regering som är ytterst ansvariga för transportstyreleskandalen, som ger pengar till de som redan har och som tar från de som något spar. En regering som kör över företagsamma människor som gör nåt bra för andra, eftersom det rimmar illa med den ideologiskt färgade världsbilden. En regering vars största parti aktivt profiterar på människor för att finansiera sig själva.

Men visst, det är en regering utan inflytande från SD och det är viktigt. Fast å andra sidan, till skillnad från SD som gapar om hårdare invandringspolitik och utvisningar så har ju S/MP-regeringen omsatt det i praktiken genom att stänga gränsen och det är väl egentligen inte så mycket bättre.

Så frågan om hur jag tycker att det parti jag kommer rösta på i nästa val, sannolikt C, ska agera i regeringsfrågan är mycket komplex. Jag har inga bra svar idag.

Regarding the Accidental Tech Podcasts discussion on surround sound

posted this on and tagged it with Surround sound

On the most recent episode of the Accidental Tech Podcast John tried to convince Marco to get a surround sound system for his living room. Since audio is my thing1, I felt like a needed to add some things to the discussion.

The case for a >=3.1 surround sound system

Personally I think surround sound is cool and the more speakers/channels the cooler. That being said, I’d argue that the most important part isn’t to have 5.1 or 7.1 or whatever high number.1. It is to have at least 3.1. The three, as opposed to the two, means that you’ll have a center speaker in addition to the regular left and right speaker. This is super important for clarity reasons. Here’s why:

Imagine you are panning sound from left to right in a regular 2-channel stereo system. At the far ends the sound comes from just one speaker, left or right depending on whether your panner is at the far left or far right. As you leave the far extreme and head for the other side, the sound will start to come from both speaker but with differences in volume between the two. This will create the illusion that the sound is being emitted from somewhere in-between them.

When you are putting the sound dead center in this system both speakers generate identical sound waves at identical volume at the same time. If you are and the speakers are positioned at the exakt corners of an equilateral and the acoustics of the room doesn’t interfere too much, your brain will believe that the sound comes from the actual center. This positions the sound at what’s called the phantom center.

Now, move your head/yourself slowly toward one side and your perception of where the sound is coming from will change. As you move, one speaker will be positioned closer to you than the other which will mean that the sound from it will arrive at your ear earlier that the sound from the other speaker and you will perceive the sound as coming from a source closer to the closest speaker. (There will also be a difference in volume at your ears. The one that’s closest will also be louder.) 2

Compare this to panning the same sound to the center speaker of a >=3.1 surround sound system. This way the sound is only coming from one speaker which means that wherever in the room you are, you’ll alway perceive the sound as coming from this speakers position.

TV shows and movies tend to have their dialog mixed in the center of the sound field. If the mix is a surround sound mix that’s being down-mixed for your 2-channel stereo system it will position the sound ”in the middle” using the phantom center. Same goes for a dedicated 2-channel mix. This means that unless you and the speakers are perfectly positioned, you will not experience this as the sound coming from the actual center.

That being said, the exact position from which the sound is being emitted is not that big of a deal. It’s probably along the same lines of importance as whether you rinse your aeropress filters before use or not. However, there is something more that happens.

Since the sound is coming from multiple sources, the sound waves from them will super position with each other and you will get interference. If you are in the perfect position, as described above, that will be 100% constructive interference and only result in a louder sound. If however you are a bit off from the optimal listening position – which you will be, trust me – the sound waves will actually be slightly out of phase with each other when they arrive at your ears. That means some frequencies will be louder that intended while others will be softer. Please note that this is different frequencies of ”the same sound”. This will mess with the clarity of the sound.

Generally this problem will be most audible in the upper mid-range where good clarity is very important for perception of human speech. This results in less speech-intelligibility in a 2-channel stereo sound field compared to a >=3-channel sound field with a dedicated center channel.

So that is why I think that a >=3.13 sound system is always superior to a 2-channel system for tv and movie watching.

I hope this makes some sense. I realized while writing this that it’s quite hard to express these technical thing in a language that’s not your own while also making it accessible to someone who isn’t deep in the audio field, and also being interesting to someone who knows the basics.

The number of audio channels on vinyl

Yes Marco, there are plenty of vinyl albums with stereo mixes. There are even surround sound on vinyl.

Regarding speaker shapes

One of the reasons why some speakers are shaped ”weirdly” is because the shape of the speaker effects the sound of it, because of diffraction.

In summary

Marco should definitely get a surround sound system, even if he doesn’t connect the actual surround/rear speakers.4

Also, in my opinion Marco is right in that a full range system sound more ”natural” and ”cohesive” than a speaker with less bass response combined with a subwoofer.


  1. I have a bachelor degree in Sound and Music Production and I teach it for a living at Dalarna University. My education is not an engineering education so I don’t have the deepest, geekiest knowledge on some things but I do know a few things. ↩
  2. This thought-experiment is quite simple to try out in real life. Just play something in mono, panned to the middle of a 2-channel stereo sound system och move around with your eyes closed and point to where you think the sound is coming from. ↩
  3. Technically a >=3.0 system is enough for this. The subwoofer/LFE-channel doesn’t do anything for this but to avoid unnecessary confusion is chose to write .1 for this whole article. ↩
  4. Please note that all of this is written by someone who’s only tv is an LCD tv and who only uses the built in speakers in it… ↩

En uppmaning

posted this on and tagged it with Det offentliga samtalet

Therese Bohman har skrivit en bra text i Expressen idag om att det ”Visst finns det en medieelit”. Du bör läsa hela texten.

Dock är det inte texten som helhet som jag tänkte skriva ett inlägg om här.

Man kan ha invändningar mot orden (samtidens favoritsysselsättning), men innebörden satte fingret på något viktigt: Att det fanns – och finns, ännu tydligare i dag – en klyfta i Sverige: mellan stad och land, medelklass och arbetarklass, de som har makt över orden och de som inte har det.

(min kursivering)

Therese sammanfattar perfekt vad jag tycker är det absolut största problemet med det offentliga samtalet idag, framförallt i sociala medier. Vi märker ord och vi tolkar alltid in värsta möjliga i andras ord. Istället för att ge människor vi inte håller med ”the benefit of a doubt” och försöka förstå vad de menar så läser vi deras texter som djävulen läser bibeln.

Så här är en uppmaning till oss alla, även mig själv. Låt oss försöka förstå vad motparten i en diskussion menar. Om vi är osäkra på vad som åsyftas med ett ord eller en fras, låt oss tolka det som bästa möjliga istället för värsta möjliga. Eller fråga skribenten istället för att anta det värsta.

Det är möjligt att människor kan ha andra åsikter än oss själva och ändå inte vara nazister, fascister, diktaturkramande stalinister, etc. etc.

Slight update to my Blu-ray workflow

posted this note on and tagged it with Blu-rays Dealing with home media

My current workflow for ripping blu-rays into an iTunes-friendly format

posted this note on and tagged it with Blu-rays Dealing with home media

This post is just for my own sake. I’ll probably write this up better once I’ve reached a final conclusion.

The workflow is as follows:

It’s not perfect and it needs some tweaking. Right now I’m contemplating whether to use detect crop or from Melton’s utilities.

Replies and comments

More Zelda – Twilight Princess

posted this on and tagged it with Twilight Princess Wii Zelda

I’m still playing Twilight Princess even though I haven’t blogged about it for almost a month. I’ve intended to but haven’t gotten around to it and rather then spend time blogging about playing, up until now I’ve chosen to play it instead.

Once more, this is a game that I think is better the less you know about it so if you haven’t played it and think that you sometime, maybe, possibly, will, stop reading.

So I’ve kept playing and I’ve finished the first two dungeons and I’m getting ready to head for the third one. As far as I can tell I’ve expelled all twilight from Hyrule, so I don’t think I’ll play as a wolf anymore. So far the game is really great. It’s one of my favorite Zelda game, maybe my absolute favorite. I like the darkness and despair about it. It’s gotten me a lot more emotionally invested in the game than I usually are in a Zelda game. The only other time that I’ve actually cared this much about the characters in the game has been Majora’s Mask, hence my idea for the perfect three days, inspired by Groundhog Day.

I like that I know so little, that everything that happens catches me by surprise and that I have very little idea of how far I’ve actually made it into the game. From what the game tells me, this third dungeon will be the last one but based on previous games I might just as well be less than half-way through at this point.

The combats are really intense, both as a wolf and as a human/hylian. Most of the combats feel very intense and the wiimote control scheme makes them feel a bit more real than in other games. You could argue, as some do, that modern Zelda game has lost some of the free world exploration that was such a big part of the first game and if you look at it that way, Twilight Princess is very low on free exploration. There are obstacles spread out all over that makes your path through both the overworld and various underworlds vary linear. However, this does not take away anything from my excitement of playing it. Sure it would be nice to be more free to explore, but I still feel like I’m making the decisions, so I’m happy.

The game also keeps me on the edge of my seat because I feel like I really, really don’t want to die in it and it feels very possible that I might in encounters every now and then. I don’t know if I missed something or if it’s by design, but so far I haven’t manage to find any fairy to keep in a bottle, so I don’t have the usual ”insurance” that I tend to have in Zelda games.

And one more thing, the Shadow Beasts are really creepy! Really, really creepy.

If there’s anything negative to say about the game it’s the fact that some puzzles are hard in a way that doesn’t feel fair. Today I needed to google something for the first time in it. I had no idea about how to taw the Zora’s. (Here’s what I found online. It felt like a failure but I had tried and tried and pondered the puzzle over and over again and when I read the solution I was glad that I did google it. There’s no way I could have figured that out on my own, unless I’ve replayed the game from start and kept playing at a more regular pace. As things are now I’m playing once a week, tops. That means I forget things like a burning lava rock next to a warp portal.

And I’m also very confused by where I’m allowed to start if I’m saving and quitting, so that means I tend to not play if I don’t know that I can put at least two hours into the game.

Some more information on the WordPress bug that I think that I’ve found #wordpress

posted this on and tagged it with Narrating my work WordPress

Yesterday I wrote about a problem that I’m having with a WordPress plugin that I’m working on, and I said that I think it’s a bug in WordPress. Here are some more information about it.

What the plugin is supposed to do

The plugin should cross-post/syndicate any new post to Twitter. There are a lot of plugins already that does this, but I wanted a few special features.

So far so good. This all works as intended. There is however one more thing that it’s supposed to do:

The technical part

The plugin hooks into the publish_post action and early on in its code it checks if ( get_post_format( $ID ) == 'link' ). If it returns true an XPath query retrieves the href of the first <a> element and uses this instead of the permalink in the Twitter post.

The XPath part works just fine in all my tests.

The problem

As long as I post from the WordPress Admin interface, everything works as intended. The problem occurs when I post using the Press This bookmarklet. When I post this way, if ( get_post_format( $ID ) == 'link' ) never returns true, regardless of the post format.

If I create the post using Press This but instead of publishing I save it as a draft and then publish from the Admin panel, it works as intended.

Do you have a solution?

If so, please let me know.

The code is available on GitHub but I’ve kept the repository private since I’m a little bit embraced by the code, but let me know if you’d like to check it out and I’ll add you to the repo.

Replies and comments

Is this a bug in WordPress?

posted this on and tagged it with Narrating my work WordPress

I’m working on a WordPress plugin to syndicate my posts to Twitter. I know, there are lots of plugins that does that already but none of the ones I’ve found does it the way I want, so I decided to roll my own. I’ve got the basics working and have been using it on my site for quite some time now. However, I’ve encountered a problem. Here’s how I want it to work:

When I publish a link post, instead of posting a link back to my site to Twitter, it should post the link to the site that I’m linking to. The plugin ”knows” whether it’s a link post or not based on

At first glance this works fine and it worked in development. However, ones I started using it on my site I realized that it only worked some of the times and other times it wouldn’t recognize a link post.

Tonight I’ve managed to narrow it down. It seems like the problem occurs when I post with the ”Press this” bookmarklet. If I do that, even a post that clearly has been givet the ”link” post format still returns false for if ( get_post_format( $ID ) == 'link' ). If I post the exact same content using the WordPress dashboard the post is recognized as a link post and everything else works as intended.

Is this a bug in WordPress? I should investigate this further but right now I need to go to bed, so I’m throwing the question out to you, smart people on the internet, instead.

Replies and comments