Ubuntu 11.10: Crackling noise in VLC audio dependent on CPU usage

When trying out VLC in Ubuntu 11.10 today, I had the problem that the audio output of VLC contained crackling, sizzling noise. The higher the CPU usage was (loading a program for instance), the more intense the noise was.

After playing around with the config panels I realized, that pulse audio was set to „Dolby Surround 4.0“ (in the system’s main audio config dialog). Changing this value to „Stereo Duplex“ solved the problem.

Mount a partition from a disk image for bochs

There are a couple of articles out there which describe, how to mount a particular partition from an image file containing not a single filesystem but a complete disk including the partition table (e.g. here). They tell you to use the offset option of the mount command and they tell you, you’ll get the partition offset from the partition table via fdisk. Well, at this point I naturally assumed, that fdisk is providing the offsets in „numbers of sectors“.

fdisk -l c.img
Platte /home/omni/.bochs/freedos/c.img: 0 MByte, 0 Byte
16 Köpfe, 63 Sektoren/Spur, 0 Zylinder
Einheiten = Zylinder von 1008 × 512 = 516096 Bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

 Gerät  boot.     Anfang        Ende     Blöcke   Id  System
 c.img1   *       1             304      153184+  6   FAT16

So I tried to run

mount -o loop,offset=512 -t vfat c.img /mnt

Unfortunately, this did not work! The official bochs documentation in fact contains the solution, you just have to know it does:

If you want access to a hard disk image, you have to calculate the size of
    the first cylinder.

What was wrong? I incorrectly assumed, that the fdisk partition table provides the start position in „numbers of sectors“. I does not. I gives them in „numbers of cylinders“! You have to explicitely run fdisk with argument -u to get the offsets in numbers of sectors!

fdisk -lu c.img
Gerät  boot.     Anfang        Ende     Blöcke   Id  System
c.img1 *         63            306431   153184+  6   FAT16

I lost some hours before realizing this. Maybe this info will help someone to not walk into the same trap!