Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora Resources > Guides & Solutions (No Questions)
FedoraForum Search

Forgot Password? Join Us!

Guides & Solutions (No Questions) Post your guides here (No links to Blogs accepted). You can also append your comments/questions to a guide, but don't start a new thread to ask a question. Use another forum for that.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 17th December 2011, 04:08 PM
sujoykroy Offline
Registered User
 
Join Date: Feb 2008
Posts: 42
linuxfedorafirefox
Make Micrphone work with Intel HD Audio (Harder Way)

I didn't get my microphone and front panel speaker work for quite a long time on Fedora 12. My Intel S975XBX2 motherboard has in-build audio of HDA (High Definition Audio) standard. The audio codec is SigmaTel STAC9227, as shown when i run the command "cat /proc/asound/card0/codec#2". I read several forum posts in different websites, tried to remove pulseaudio related tools, compiled ALSA driver with hda-intel support as instructed at http://www.alsa-project.org/main/ind...dule-hda-intel. But nothing did work. I read somewhere, probably in Linux Kernel documentation for ALSA, that most microphone problems are just wrong connections of pins. I also read that HDA Analyzer from http://www.alsa-project.org/main/index.php/HDA_Analyzer can help fix this issue. So, i downloaded it; but when i did run it, the list of "Nodes" made me all more confused. After some failed attempts to search for alternatives in forum posts, i finally took the plunge and downloaded and read Intel High Defintion Audio Specification from http://www.intel.com/content/dam/doc...cification.pdf. Reading the specification landed me inside the audio controller and finally that "Pin" thing became clear.


As per HDA specification, HD audio controller communicates with external devices like microphone, speaker, headphone through one or more codecs. Each codec communicates with those external devices through collection of "Pin". On the other hand. each codec communicates with audio controller through Audio In/Out Converter. These Converters and Pins , inside a codec, talk to each other using "Widgets" like Audio Selector(Multiplexer, Amplifier) or other Pins. All these converters, pins, widgets are generally termed as "Node". Hence, in HDA Analyzer GUI, all the items under card-0->codec-2 are shown as Nodes. So, when you hear sound in speaker, the signal flow is Controller->Audio Out Converter->Widget->Pin and when you record sound the signal flow is Pin->Widget->Audio In Converter->Controller.

The list of nodes in my case were, -
Node[0x02] to Node[0x05] - AUD_OUT (4)
Node[0x06] - VENDOR
Node[0x07] to Node[0x09] - AUD_IN (3)
Node[0x0a] to Node[0x12] - PIN (9)
Node[0x13] - VENDOR
Node[0x14] - VENDOR
Node[0x15] to Node[0x1d] - AUD_SEL (9)
Node[0x1e] - AUD_OUT
Node[0x1f] - VENDOR
Node[0x20] - AUD_IN
Node[0x21] to Node[0x22] - PIN (2)
Node[0x23] - Beep
Node[0x24] - VOL_KNB

You can see visually how these nodes are connected to each other by clicking "Graph" button. As my first problem was with microphone, i looked at Audio In Converter or AUD_IN nodes. For example, take the first AUD_IN node, 0x07. It was connected to Audio Selector (AUD_SEL) 0x1b, as seen in "Connection List" parameter, which i saw when i clicked "Node[0x07] AUD_IN" from the tree view. Again, that "Node[0x1b] AUD_SEL" was connected to Audio Selector (AUD_SEL) 0x18. And "Node[0x18] AUD_SEL" was connected to Audio Selector (AUD_SEL) 0x15. That last AUD_SEL 0x15 has several "Pin Complex" or just Pins, in its connection list. So far the path of interconnection was, AUD_IN(0x07)->AUD_SEL(0x1b)->AUD_SEL(0x18)->AUD_SEL(0x15). Now, the first item of the connection list of last AUD_SEL 0x15 was "Pin Complex [0x0e]". This "Node[0x0e] Pin" was showing following "Config Default", -
Jack Connection: Jack
Jack type: Speaker
Jack location: Ext
Jack location2: Rear
Jack Connection: 1/8
Jack Color: Pink

Now, from the technical specification of motherboard S975XBX2, i knew that Pink color hole at the bank panel was for "Mic In/Retasking Jack". Also, in the "Widget Control" of "Node[0x0e] Pin" the "Out" checkbox was ticked. That means that Pin or Mic In was enabled as Line Out not Line In. In other words, it was marked to play audio not to capture it. So, i removed the tick from "Out", instead ticked on "In" check box. Then i went back to "Node[0x15] AUD_SEL" and selected "Pin Complex [0x0e]" in the connection list. But nothing happened, no recording was there. Then i recallled (from some forum posts) that you may need to increase amplifier gain. So, i tried to increase value of the two sliders, present next to Val[0] and Val[1] in "Node[0x15] AUD_SEL"'s Node Editor window. But still the same. Then, i don't know why, but i went back to Node Editor Window of "Node[0x0e] Pin" and inside "Widget Control" pane, i set VREF to 50. And the microphone finally captured my voice, i was never so happy to hear my voice .

To test the sound recording i used Jack audio server. First, i opened QjackCtl, started Jack server. Then opened the "Connections" window by clicking "Connect" button of QjackCtl interface. On that "Connections" window, i connected system->capture_1 to system->playback_1 and system->capture_2 to system->playback_2.
With this setting i tried those above tweaking on HDA Analyzer and finally heard my loud voice.

Then i experimented with several options shown therein and the front panel speaker also became alive along with front panel microphone.

For panel speaker, i ticked on "Out" in "Widget Control" pane on the Node Editor window of "Node[0x0a] Pin", becasue its "Config Default" was showing that,
Jack Connection: Jack
Jack type: HP Out
Jack location: Ext
Jack location2: Front
Jack Connection: 1/8
Jack Color: Green

And from S975XBX2 technical speification, i knew that front panel had "Line Out/Restasking Jack" hole in green color. But still the audio volume as not high. In the Node Editor of "Node[0x0a] Pin", it was shown to be connected with "Audio Output[0x03]". So, i went to Node Editor of "Node[0x03] AUD_OUT" and draw the sliders next to two "Mute" text to the end to give them 127 value. And then my ears felt the joy of loud drum beats

To enable the front panel microphone, i didn't have to do much. The "Node[0x0b] Pin", the pin for front panel microphone, was correctly configured. When in "Node[0x15] AUD_SEL", i selected "Pin Complex [0x0b]" (which was actually default configuration in my machine), and raised the sliders next to Val[0] and Val[1] to 2, then the audio capture worked.

But, the change of setting made through HDA Analyzer, does not maintain itself on reboot. Fortunately, HDA Analyzer, had "Exp" (Export) facility. But it didn't work initially for me. At the time of this writing, i found that /dev/shm/hda_Analyzer/hda_codec.py (downloaded by HDA Analyzer) file contains calls to set_vol_knb function at 2 places,( line 790 and line 834), but the containing class HDANode doesn't have any function of such name. May be the developers were working on some recent issues. I didn't think it would be wise to disturb them for such trivial things, and just commented out those two lines. Then "Exp" button worked. It showed the full script which can be run manually or automatically during boot to make the changes in the audio controller. But, the exported script only shows the difference between the present setting and last changed setting. So, if you open and close the Analyzer multiple times and try the export, you will not see the total difference of settings from the original default setting of the audio controller, as set by the controller or bios itself. The "Exp" generated script has two parts. The upper part is same for every export, it just accesses the /dev/snd/hwC0D2 file. The lower part contains the script to make the changes of settings. So, i made a blank file, copied the common upper part, then ran the Analyzer several times as i was experimenting with different options of the nodes. Whenever some settings worked, i just clicked "Exp" button, copied the lower part and appended it to that file. So, didn't have to worry if i had closed Analyzer.

Finally, i copied that all containing file as /etc/hda_audio_setting.py, then opened up /etc/rc.d/rc.local file and appended the line "python /etc/hda_audio_setting.py". So, on next reboot, i didn't have to run HDA Analyzer again and i was a happy man
Reply With Quote
  #2  
Old 17th December 2011, 04:09 PM
sujoykroy Offline
Registered User
 
Join Date: Feb 2008
Posts: 42
linuxfedorafirefox
Content of hda_audio_setting.py file

PHP Code:
#!/usr/bin/env python

import os
import struct
from fcntl import ioctl

def __ioctl_val
(val):
  
# workaround for OverFlow bug in python 2.4
  
if val 0x80000000:
    return -((
val^0xffffffff)+1)
  return 
val

IOCTL_INFO 
__ioctl_val(0x80dc4801)
IOCTL_PVERSION __ioctl_val(0x80044810)
IOCTL_VERB_WRITE __ioctl_val(0xc0084811)

def set(nidverbparam):
  
verb = (nid << 24) | (verb << 8) | param
  res 
ioctl(FDIOCTL_VERB_WRITEstruct.pack('II'verb0))  

FD os.open("/dev/snd/hwC0D2"os.O_RDONLY)
info struct.pack('Ii64s80si64s'00''''0'')
res ioctl(FDIOCTL_INFOinfo)
name struct.unpack('Ii64s80si64s'res)[3]
if 
not name.startswith('HDA Codec'):
  
raise IOError"unknown HDA hwdep interface"
res ioctl(FDIOCTL_PVERSIONstruct.pack('I'0))
version struct.unpack('I'res)
if 
version 0x00010000:    # 1.0.0
  
raise IOError"unknown HDA hwdep version"

# initialization sequence starts here...

set(0x0b0x707,   0x21# 0x0b070721 (SET_PIN_WIDGET_CONTROL) | 0x0b => Pin - Front In - Pink
set(0x0e0x707,   0x21# 0x0e070721 (SET_PIN_WIDGET_CONTROL) | 0x0e => Pin - Rear In - Pink 


# 0x15 = Multiplexer Volume

#For Rear Mic
#set(0x15, 0x300, 0xa004) # 0x1503a004 (SET_AMP_GAIN_MUTE) 
#set(0x15, 0x701,   0x00) # 0x15070100 (SET_CONNECT_SEL) | Connect to 0x0e - Rear In Pink
#set(0x15, 0x300, 0x9004) # 0x15039004 (SET_AMP_GAIN_MUTE)

#Front Front Mic
set(0x150x3000xa002# 0x1503a002 (SET_AMP_GAIN_MUTE)
set(0x150x701,   0x03# 0x15070103 (SET_CONNECT_SEL) | Connect to 0x0b - Front In Pink
set(0x150x3000x9002# 0x15039002 (SET_AMP_GAIN_MUTE)

#0x0d = Pin - Rear Out - Green
# 0x02 = Audio Out/Converter - connected to 0x0d - Rear Out Pin
set(0x020x3000xa07f# 0x0203a07f (SET_AMP_GAIN_MUTE)
set(0x020x3000x907f# 0x0203907f (SET_AMP_GAIN_MUTE)

#0x0a = Pin - Front Out - Green
set(0x0a0x707,   0x41# 0x0a070741 (SET_PIN_WIDGET_CONTROL)

# 0x03 = Audio Out/Converter - conencted to 0x0a - Front Out Pin
set(0x030x3000xa07f# 0x0303a07f (SET_AMP_GAIN_MUTE)
set(0x030x3000x907f# 0x0303907f (SET_AMP_GAIN_MUTE) 
Reply With Quote
Reply

Tags
audio, harder, hda-intel, intel, make, mic problem, micrphone, work

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
"The audio playback device does not work" error (Intel HD Audio) convict Hardware & Laptops 2 19th April 2010 12:23 AM
Creative SB X-Fi Xtreme Audio PCI-e -- How can I make it work? NETio Hardware & Laptops 4 22nd August 2009 09:31 AM
How to make your IPW3945 Intel work with NDISWRAPPER in FC6 DMD Hardware & Laptops 3 31st October 2006 10:31 AM
can't make Intel 2200BG Wireless work on my dell latitude d600 pabloguevara Hardware & Laptops 9 24th January 2006 05:27 PM


Current GMT-time: 23:18 (Wednesday, 30-07-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat