Monday, 31 December 2007

Ripping m4a in KAudioCreator

Stupid blogger has deleted my post 3 times when pressing the preview button!!
I wanted to rip my audio into AAC (MPEG 4 audio) format since my current oggs do not play on my Archos MP3/4 player. KAudioCreator does not support AAC straight from the box so this is what I did:
1) install faac from the repos
2) Run up KAudioCreator and then Settings -> Configure KAudioCreator
3) Click the encoder tab
4) Add a new encoder type called AAC, with m4a extension (which tells the encoder what sort of encoding to do at encode time) and then use the following command line:
faac -b 128 --title %{title} --comment %{comment} --artist %{artist} --album %{albumtitle} --year %{year} --track %{number} --genre %{genre} -w -o %o %f
5) Press OK and then setup your rip path if it is not already correct, mine is:
~/My Music/%{albumartist}/%{albumtitle}/%{number} - %{title}.%{extension}
6) MAKE SURE that your new encoder is highlighted in the list before pressing OK. This ensures it is your default encoder.
7) nice!

Tuesday, 20 November 2007

Undefined reference, something to do with signals and moc

I'm using KDevelop in KDE to write a QT4 app and added a signal to my class. When I built the project and rebuilt it it came up with an undefined reference error even though my syntax was correct. I found out it was something to do with the meta-object compiler (moc) which creates code to handle the signals and slots.
First thing was I needed to add the Q_OBJECT macro to the start of the class declaration in my .h file. This would be OK but after building it still produced the error and I was extremely confused. A little searching on the web and it said that I would need to run "tmake" to parse my project files and notice the newly added Q_OBJECT macro, it also helpfully mentioned that it is automatically run when the project file is changed so I opened my project.pro file, changed a letter and changed it back to mark it as modified, press build, selected to reload the 'modified' project file and tmake worked its magic and made my project build. Sweet - better than manually adding all the moc entries as I did before!!

Thursday, 15 November 2007

Graphics don't work in real-time kernel

I'm now running Kubuntu Linux version 7.10 - Gutsy Gibbon and when I rebooted into the real time kernel to do some music recording, the graphics didn't work and I got a terminal window instead of an X login screen. I looked into the whole building specific NVidia drivers like I had to in 7.04 Feisty Fawn but stopped when it seemed like a messy fix. I surfed the web and found that I should have installed the linux-restricted-modules-rt package. For some reason, the normal one is installed by default but the real time kernel doesn't seem to pull in the real time flavour. Have installed it now and expect it to work sweet!! The package says what drivers it includes.

Tuesday, 16 October 2007

Adept Package Manager shows BREAK for libasound2-dev

Funny thing a package manager, you would think it would be pretty easy but when you actually look at it in detail, you realise there are lots of grey areas. For instance, suppose you add a special repository for maybe a future release of Kubuntu and that repository includes an updated library such as libasound2 v1.0.14. Now suppose you update from your current 1.0.13 version - all fine. You now remove the repository link from sources.list, what should happen? Should it tell you your library is too new and offer to downgrade it? Well, perhaps not surprisingly it doesn't, it keeps your newer version unless you manually remove it.
What happens if you then try and install some non-futuristic software that requires libasound2 version 1.0.13? It's not going to find it and it won't install, it will tell you BREAK for the top level package (in this case libasound2-dev). Quite a subtle error but a bit of digging should help you work it out. You could simply remove the libasound version 1.0.14 surely and then do another install and you will get the 1.0.13 version that you should have but there in lies another problem. If you choose to remove libasound, it very cleverly also attempts to remove all of the packages that depend on it since they can't run without the library installed - in this case it was about 70 other packages - bummer.
The solution? Well although i prefer to use the GUI wherever possible, a command called apt-get (the get part of adept package manager) allows you to install a named version of a package, even if a newer one is installed. What it effectively does is replace the new one with the named one without uninstalling all the dependent packages in the process - sweet!! In my case, the command was:

sudo apt-get install libasound='1.0.13-1ubuntu5'

Friday, 5 October 2007

Building the NVidia driver for multiple kernels

Well I am one of the lucky people who has a notebook that is so new the nvidia driver that comes with Kubuntu does not support the graphics card. Fortunately NVidia have invested time and money supporting the Linux community and have developed a Linux installer that compiles kernel modules with the relevant drivers for the cards. Sweet.
You can download the install from nvidia.com, my one is called NVIDIA-Linux-x86_64-100.14.11-pkg2.run but presumably this will be updated from time to time. It is dead simple, you can simply type:

sudo sh ./NVIDIA-Linux-x86_64-100.14.11-pkg2.run

and it does the biz but bear in mind that you have to make sure you have your linux kernel header packages installed because the run package will need them. The instructions on the nvidia site will suffice but I had another problem...
The installer by default builds the module for the currently running kernel which might be mostly fine but what do you do when either you are upgrading the kernel or you have several bootable kernels?
Once the run package is executed, it should install "nvidia-installer" and this is the baby that does the hard work. There are two switches that you should be aware of. Firstly if you are running the installer to build a driver for a kernel that is not running, you must use:

sudo nvidia-installer --kernel-name='2.6.22-10-generic'

The name is how the installer will look for the source directories so you have to get it right. If you don't install the linux-headers packages for the target kernel you will get an error.
The second switch that is important is for when you already have the driver installed for one kernel and you want to build it for another one without uninstalling the current one, use:

sudo nvidia-installer --kernel-module-only

You might need to combine the two flags depending on whether your current kernel image is the target.
If you want to build the driver for a new kernel after it is installed, simply press esc in the grub menu and boot the recovery mode for the kernel, you will be logged in as root. Type "telinit 3" which will boot you to a text login (you can theoretically do this with a broken X driver by pressing ctrl-F2 or something but it didn't work for me). Log in and then run the second flavour of nvidia-installer above and then you don't have to fuss about knowing the exact kernel name to pass to the installer. Once this is done, type "startx" and it should be fine.

Building Ardour2 on Kubuntu

Well, I have been trying to build ardour2 on Kubuntu since it hasn't been added to the Ubuntu repositories and have followed the instructions on ardour.org. They are basically OK but I did come across a problem I thought I would share.
Trying to install one of the libraries required (libasound2-dev) Adept Package Manager told me it couldn't be installed - that classic "INSTALL (break)" message! It wasn't immediately obvious what had happened but basically I had used some newer repositories to get a newer kernel - this kernel was needed for my wifi driver. The new repositories had offered me an upgrade to libasound2 (from 1.0.13 to 1.0.14) which I had obviously selected to upgrade. After removing the new repositories from sources.list I was left with a new library installed which the dev package didn't want (fair enough!).
The complication was that trying to uninstall the new library (to reinstall the right version) would remove every package on the PC that relies on it. That happened to be about 50 applications so this wasn't an option. Fortunately there was an option to install a named release using the command-line:

sudo apt-get install libasound2='1.0.13-1ubuntu5'

This effectively replaced the currently installed one with the version I specified which made adept happy again.