24″ iMac ALSA configuration June 23, 2008Posted by idebian in Debian, GNU/Linux, Hardware.
Now that the nVIDIA video driver has been set-up let’s give our iMAC a voice (the stereo speakers) and a pair of ears (the stereo mic)
We will go briefly in the Linux’s ALSA configuration of the integrated iMac sound card.
The iMAC’s sound card is built on top of the Realtek ALC885 chipset driven by the Intel ICH8 HD Audio controller.
The Realtek chipset is capable of 7.1 channel even if we just have a stereo speakers system. The headphone plug can be also used as AC3 pass-through in case you have an external AC3 decoder.
The sound card is well supported in ALSA (1.0.16) once you set a proper option to define the specific 24″ iMac implementation for the snd-hda-intel module, which is the ALSA module that manage the Intel audio controller.
For my 24″ iMac – early 2008 – I found that the most appropriate model is mbp3 (which stands for MacBook Pro rev3); this gives me total access to the internal microphone also, while the imac24 model didn’t allow me this.
I usually define all my custom kernel modules options within a file named local in the /etc/modprobe.d directory. So let’s type:
$ echo "options snd-hda-intel model=mbp3" >> /etc/modprobe.d/local
and that’s it! reboot to make the changes effective.
Once system has rebooted you should be able to listen audio from your iMAC.
First of all launch alsamixer at the terminal prompt and adjust Master, PCM and Front outputs volume as represented in the post’s top picture:
- move between the input with the ‘<-’ and ‘->’ keys
- change the volume with the ‘UP’ and ‘DOWN’ arrow keys
- unmute with ‘M’ key
To test the speaker we use of the ALSA’s speakertest utility. Open a terminal and type:
$ speakertest -c 2
Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 2048 to 8192
Period size range from 1024 to 1024
Using max buffer size 8192
Periods = 4
was set period_size = 1024
was set buffer_size = 8192
0 - Front Left
1 - Front Right
where -c 2 specify a two channels output.
Interrupt with CTRL-C.
If everything is properly set you should have listened white noise coming alternatively from the two speakers
GNOME’s Volume Control
Now that the raw audio functionality has been verified let’s pass to the fine tuning.
To properly set-up the sound card in GNOME double click on the speaker icon in the GNOME notification area; the graphical mixer should came up.
Go to Edit -> Preferences and enable all the items.
This is mine Playback Tab:
and the Recording Tab:
In the Switches Tab just set the Speaker check-box.
In the Options Tab settings set the Channel Mode to ’2 ch’ and ‘Mic’ as the Input Source.
We can now close the Volume Control and jump to the final step to set-up the Master control for the toolbar icon: right click on the speaker icon, select ‘Preferences’ and then choose ‘Master’ as the device to control.
Once you set-up the GNOME’s mixer you should be able to record from the integrated MIC using the Sound Recorder application in the Sound menu.
For those of you who do everything within a terminal (as I do) we can also use arecord/aplay:
$ arecord test.wav
$ aplay test.wav
From the Apple manual it seems that the 3.5mm output jack can be used either as Sound output or digital audio output. When no device is connected to the output jack, the internal speakers are selected, otherwise audio output port selection is automatic:
The S/PDIF (Sony/Philips Digital Interface Format) optical digital output is automatically selected when an S/PDIF optical digital output device is detected on the external combination audio port.
From  it seems that:
The name of the connector is “Mini-TOSlink”, usually you can find optical cables which have a Mini-TOSlink plug on one end and a TOSlink plug on the other end, or you can use a plain TOSlink cable in combination with a TOSlink to Mini-TOSlink converter (the L71BA one, TOS [F] – 3.5mm [M]), or similar.