Noisy Line Out / Speaker Left Channel using Ubuntu 7.10 and a Macbook Pro

Since installing Ubuntu 7.10 Gutsy Gibon I have had noise coming from the left channel of my Macbook Pro both from the line out and from the internal speakers. Oddly enough, even when I am using the line out I get noise from the left speaker. It sounds very similar to the noise produced when using the line out of a G4 with mirrored double doors; you can hear this crackling electronic noise that I put down to the processor cycling and poor shielding - mouse over the dock or use system resources and you get an increase in the rate and intensity of the noise - clearly poor shielding within the G4 but everyone G4 owner will tell you it’s one of the loudest computers ever. But back to Ubuntu on the MAcbook Pro..

I have never had this problem with my Macbook Pro and OS X so all I can assume is the gain table in the ALSA driver is somehow wrong in Ubuntu 7.10 causing a much lower signal to noise ratio than in OS X. This would also result in a much lower maximum and overall volume output when using Ubuntu, and this is indeed the case.

With the release of Ubuntu 8.04 Hardy Heron and the inclusion of the PulseAudio sound server hopefully things will improve. Until then the following solution solves all the above problems for me except the left speaker noise while a line out is plugged in. You’re probably using your line out for louder sound like me so this will cover up the problem for the most part so it’s not really a problem any more.

From http://ubuntu-utah.ubuntuforums.org/showthread.php?t=611345. Thanks to Volanin for the solution and everyone who contributed to this thread.

1. Open a terminal and type:
sudo gedit /etc/modprobe.d/options

2. Add the following line to the end of the file:
options snd-hda-intel model=[MODEL_BELOW] position-fix=2 probe_mask=1

You must select the Intel HDA model that corresponds to your computer:
intel-mac-v1 : Intel Mac Type 1
intel-mac-v2 : Intel Mac Type 2
intel-mac-v3 : Intel Mac Type 3
intel-mac-v4 : Intel Mac Type 4
intel-mac-v5 : Intel Mac Type 5
macmini : Intel Mac Mini (equivalent with type 3)
macbook : Intel Mac Book (eq. type 5)
macbook-pro-v1 : Intel Mac Book Pro 1st generation (eq. type 3)
macbook-pro : Intel Mac Book Pro 2nd generation (eq. type 3)
imac-intel : Intel iMac (eq. type 2)
imac-intel-20 : Intel iMac (newer version) (eq. type 3)

For example, I have a Macbook 2rd generation, and the setting that worked was model=macbook-pro.

3. Save the file and type in the terminal:
sudo update-initramfs -u

4. Reboot your computer.

5. For BEST sound, if the above works, open a terminal and type:
alsamixer
And set the FRONT and SURROUND sliders to their maximum.
It might be necessary to unmute them with the ‘M’ key.
Press ESC twice to leave the program.

Emma Clark - The Return (Now With Sat Nav)

A few months ago I posted some audio files and a story about Emma Clark here. Emma is a British voice over artist who is probably most famous for her voice being used on the London Underground but last year she was sacked from this role following recording her own satirical alternatives and posting them up on her site. Check out the older post here or her web site here to listen to them. I think as I have already said that there was no need need to sack Emma and it’s all been very reactionary as opposed to reasonable, and as if to add to this on Emma’s site she has posted up some contact she had here from a major Australian voice over agency detailing how one of it’s clients Jake Downs has had his contract terminated by Sydney’s City Rail after recording similarly satirical spoof voice overs. With a slight twist, it seems the recordings actually made it into circulation either in stations or on the web, without anyone noticing! Excellent. City Rail had this to say:

“They’ve been there for months.” An embarrassed City Rail official Adam Wickleberry confessed. “The staff here neither noticed the humour nor saw anything untoward about them. We do fail to see the funny side of most things these days. I think you’ll find the ‘War on Terror’ has that effect on bureaucracy.”

You can listen to the recordings here http://www.rmk.com.au/news/news15.html

Emma has since got a contract with sat nav company ALK and they have recorded their own spoofs as a subtle (ha) method to either avoid a repeat of the LG senario or to profit off the attention. I’d say it was a fantastic piece of marketing, but then again fantastic is usually used to refer to something not evil.

Here’s one:

Check them out here http://www.alk.eu.com/voiceofcopilot/default.asp

Also on Emma’s site are two games which are quite fun (the top one is my favourite because you can get it to say this about rubber goats and moist prostitutes).

http://www.emmaclarke.com/fun/identikit-emma

http://www.emmaclarke.com/fun/fridge-magnet-game

Linux, Ubuntu 7.10 (Gutsy Gibbon) & A Macbook Pro

Ubuntu 7.10 on a 15″ Powerbook G4 was not so easy to get working, but it was possible. Based on this and that Jay has had 7.10 running on his 1st Generation (Core Duo, not Core Duo 2) Macbook for a few weeks with no problems other than a few key modifications and the brightness keys not working (the volume keys do) I reasoned that as my Macbook Pro also uses the same Intel processor architecture (i386) running 7.10 should present no problems. I was mistaken, but the problems I have had so far can be solved. Here are the solutions I used to solve my problems; hopefully they will also help others.

Installing

I originally used the regular 7.10 install disc (here) which worked OK, but I wanted to look at all the options on install so I used the 7.10 Alternate disc (here).

From previously installing different version of Ubuntu on other machines I know that if you install with your ethernet cable connected (so your computer can access the internet) a number of updates are downloaded on install. Not downloading these on install seems to create more problems that it is worth so I would recommend installing with an internet connection.

When you boot the disc (hold C at startup) you a presented with a series of option screens. Most things are self explanatory. I would recommend choosing your keyboard from the list and not pressing keys to define it - I had to go and change this in System > Preferences > Keyboard to Macintosh as it set me up with a universal keyboard layout which was a bit odd. I was also able to select my screen size of 1440 x 900. Installation ran smoothly and on restart I entered my username and password and I’m straight to the desktop.

Updates

On reaching the desktop I was presented with a prompt to install updates. This obviously only happens if you have an internet connection, so keeping your ethernet cable plugged in is also advantageous here.

Ubuntu 7.10 Macbook Pro 15

I was also prompted to install restricted drivers from ATI for my display which I did. After each install, I was prompted to restart but first I navigated to System > Administration > Software Sources to tick the appropriate boxes thus ensuring all software was available to me (On default all the correct things seem to be ticked which is why I was prompted to download restricted drivers - good stuff). I then opened System > Administration > Update Manager and clicked ‘Check’ to scan for any new software not picked up at first. I got told my system is up to date, so I restarted.

On restart I now have a much crisper display, so the ATI drivers seem to have worked well.
No Wireless Networking

UPDATE 30/04/08

This works fine with 8.04 Hardy Heron.

A glaring problem was that I had no wireless connection. I could not select other than wired network, so I had a search and came up with this great tutorial from http://ubuntu-tutorials.com

  1. sudo aptitude install build-essential
  2. wget -c http://snapshots.madwifi.org/madwifi-trunk-current.tar.gz
  3. tar -zxf madwifi-trunk-current.tar.gz
  4. cd ‘to the folder madwifi was unzipped to’
  5. make
  6. sudo make install
  7. sudo modprobe ath_pci
  8. sudo modprobe wlan_scan_sta

Run all that through terminal and you’re sorted.
Thanks to Christer Edwards of http://ubuntu-tutorials.com and Madwifi for this.
No Sound

This was a bit more of a problem and took a frustrating day of trying various reported solutions and having assorted documented problems along the way, but I now have sound working correctly:

  • Sound out of speakers
  • Sound out of line out
  • Sound using headphones
  • Pluging in line out turns off speakers
  • Volume controlled from keyboard and/or internal mixer slider

N.B. I haven’t tested the microphone or line in yet and to be honest I don’t really need them so I probably won’t worry about them. I should test them though and post it up here…

Sound in, either microphone or line in does not work.

To get all this working I first followed the tutorial in the official Ubuntu wiki here and that failed. I was able to download the drivers and kernal for ALSA, but on running ./hgcompile I got a load of files and folders not found and permission denied errors. I tried various different approaches but there seems to be some problem with either the download source, the tutorial or both so I abandoned this approach.

I then found this post in the Ubuntu user forums which was a great help (as the Ubuntu user forums increasing are to me). In this post, there are a number of ways to sort out your sound. I tried them all and had no success until I compiled the ALSA drivers from source. To do this, you need to know what sound card you have so you can install the correct drivers. Things are made a bit more difficult because the 15″ Macbook Pros apparently uses different soundcards and drivers to pretty much every other mac.

To get the information needed, in terminal type:

lspci -v

This will bring up a big list of devices. Near the top should be your soundcard. I have the following:

00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 02)
Subsystem: Sigmatel Unknown device 7680
Flags: bus master, fast devsel, latency 0, IRQ 21
Memory at 50400000 (64-bit, non-prefetchable) [size=16K]
Capabilities: <access denied>

Go to http://www.alsa-project.org and navigate to ‘Soundcards’. Here you can choose the vendor based on what lspci -v returned. In my case I chose Intel which led me to this page where you can choose your specific driver. As my card is part of the ICH7 family and a High-Definition Audio controller (HDA) as shown by lspci -v, I chose ‘ICH southbridge HD-audio and modem’ and clicked ‘Details’ to view the driver documentation. At the top of this page is the driver name that you need. In my case it is snd-hda-intel.

Now you know the specific driver you need for your soundcard the following method should work (It did for me):

  1. sudo apt-get install build-essential linux-headers-$(uname -r) module-assistant alsa-source
  2. sudo dpkg-reconfigure alsa-source
  3. At the blue dialog box answer yes (for ISA-PNP - recommended by package maintainers), then yes again (for debugging - recommended by package maintainers).
  4. Select which driver you want to install. In my case, I deselected ‘all’ then selected ‘hda-intel’.
  5. sudo module-assistant a-i alsa-source

You a presented with a progress bar while the nessarcary files are transfered.

6. Once this is complete, enter the following to reload the driver:

sudo modprobe snd-hda-intel

7. To ensure the driver is loaded when you turn on your computer add snd-hda-intel (or what ever your driver name is) to the bottom of this file:

/etc/modules

After all this, restart and sound should be all working fine. If not, double click the speaker icon at the top right of the screen, select Edit > Preferences and ensure that PCM is selected and the volume is up.

ALSA Volume Control Preferences Ubuntu 7.10 Macbook Pro 15

To get your volume slider working with this ensure that PCM is selected in Volume Control Preferences which can be reached by right clicking on the speaker icon at the top right of the screen and selecting Preferences.

ALSA Volume Control Preferences Ubuntu 7.10 Macbook Pro 15

To get the volume keys working, ensure Main Menu -> System > Preferences > Sound Preferences has PCM selected.

Ubuntu 7.10 Macbook Pro 15

This all worked fine for me with no distortion and I can happily listen to all my music now. Buzzin.

Keyboard Layout / Right Click

I want the ctrl key when combined with a single mouse click to be right click. I am frustrated that I either have to use an external mouse or set Preferences > Mouse > Touchpad to ‘tap to click’ so I can use three finger right clicks. In doing this, single finger taps are left clicks and this is annoying when trying to select things - windows change, text gets selected. Blah. It is also annoying that backspace is backspace but ctrl or alt or apple keys and backspace are not delete. Grrrr. Need a way to combine multiple button/mouse presses into a single command. I need to learn more about keymodmaps.

As a temporary solution which is working fine for me so I might not change I followed this Ubuntu help document for installing Ubuntu on a Macbook Pro and remapped my key as follows:

First go to > System > Preferences > Keyboard, and click on ‘Accessibility’ button. check ‘Enable keyboard accessibility features’ and then go to ‘Mouse keys’ tab and check ‘Enable Mouse Keys’ and hit ‘Close’ button.

Then create a text file as ~/.xmodmap containing the following text (Note: This sets Right Apple key as Right mouse click and Left Enter Key as Alt Gr key)

keycode 116 = Pointer_Button3
keycode 108 = ISO_Level3_Shift

Add a call to xmodmap to your startup applications (System > Preferences > Sessions) [example]:

xmodmap /home/yourusername/.xmodmap

Restart X (Ctrl+Alt+Backspace) for the changes to take effect.

This worked great for me. Interestingly enough I have just installed jUploader (a Flickr uploader for Linux) and in this program I can press ctrl and click and this has the same function as pressing the right apple key, which is set to be right click. Hmmmm….