Friday, 6 January 2012

Adding sound to a pano

Yesterday evening I took a pano, and then processed it the same evening, including adding all necessary metadata, which I think must be a record for me. However, this was my first pano where I recorded sound for it, so despite having the pano ready to upload yesterday, I had to spend most of today trying to work out how to get the audio for the pano to work.

The first problem was that the audio had some stutters (I need to look into why, I think maybe auto levelling was switched on), and it also needed converting into a loop. I created a new multi track file in Adobe Soundbooth, then cut the audio at the points where the stutters were. I then arranged the sections for a small overlap between each, spreading them over two tracks, fading one clip out while the other faded in.

I split the clip shortly after the start as well, and then moved the start to the end, again doing a fade between the clips. Doing this made the file so it would loop correctly. However, when I saved it as an mp3, it no longer looped correctly. Trying various things, I came across this page: Gapless looping MP3 tracks. Unfortunately I had numerous problems trying to get the software to work. I think it was mostly because my filepaths / filenames had spaces in them, and while quoting the filepath would pass it to the program okay, the program would then pass it on to LAME without quoting it, so it would fail.

Anyway, I did eventually get it to work, though it gave an error message about there being 1056 frames when it expected 0 or something, I can't remember the exact error. I did google for my LAME version, and couldn't really find much info, but I think it has the same encoder delay value as the default setting for the program. So I'm not sure what the issue was or how to fix it. Anyway, the resultant mp3 file was much better than a normally exported mp3 file, though still not as good as the .wav.

Then I spent ages trying to get the mp3 loading okay in the flash panorama player. I do have it working now, but it's a bit of a kludge. I have one pano.swf, one pano.xml file, and then each pano has its own directory with the cube faces in it. The pano directory name in passed to pano.swf via the panoName parameter, e.g.

Now, the problem is, I can't modify pano.xml to point to the sound file since pano.xml is loaded for all panos, but the sound file will be different (or non existent) for each pano. There doesn't appear to be any way to use variables in the xml file e.g.


If $panoName was parsed by the swf as a variable equivalent to the value of the url parameter panoName, that would work okay. But you can't use variables in the xml (as far as I could find).

Likewise, if the value could be set as a url parameter, e.g. that would be good. But again, this doesn't seem possible. The mp3player.swf is a plugin, and everything I read only stated using plugin parameters in the xml file (or possibly from as3).

So in the end I created a separate pano.xml file for this specific pano with sound, and I will have to do the same for any other panos I create with sound. Of course, the pano.xml file could be generated dynamically, but this is not an ideal situation. The pano.xml file is exactly the same for every pano, except the filename of the sound file. Having to have a separate pano.xml file for each pano means that the user's browser has to make an extra HTTP request and download an extra file. Having said that, that is only if the user is viewing more than one pano, for the first view they will always need to download the pano.xml file.

And after all that work, using the mp3player.swf, the mp3 file doesn't loop properly! (It loops but not seamlessly). Still, I don't think it's too bad though.

I also got my North Korea 2012 Centenary of the birth of Kim Il-Sung calendar today. There's a bit of a faux-pas on January though, obviously the calendars were produced before the Great Leader's death. If they produced lots for consumption in North Korea, I'd guess they'd all have to be destroyed. I'm not sure if it is for consumption in North Korea though, given that it has writing in English. (How could they bring themselves to use the devil's language?!)

Anyway, the calendar has lots of nice big colour photos of North Korea, each taken in (or at least representing) the month it is for. I like it.

No comments: