14

I'm using a Realtek HD audio card built-in my motherboard. The Windows driver comes with a control panel that allows me to select which back panel jacks are used for what. So for example I can make both the blue jack and green jack for output and only the red one for mic-in. (Whereas by default, the blue jack is for line in, which I never need.)

How can I do the same under Linux? If possible, please don't suggest something that involves PulseAudio or JACK; I'd like to do it the plain way, e.g. by editing ALSA configuration files, if possible. The way I understand it, my problem should have nothing to do with software servers redirecting streams, just instructing the driver to treat this jack as so and so because it's hardware supported.

Thank you very much!

1

2 Answers 2

17

I managed to do it, but changes revert after rebooting. (Update: This can be worked around; see the bottom of this post.)

I did it via a GUI in python called HDA Analyzer that can be fetched and used from the ALSA website like the following:

  • wget -O run.py http://www.alsa-project.org/hda-analyzer.py

  • sudo python run.py (Their page doesn't say sudo, but if you don't do it with sudo, it will download the scripts but fail to run them and complain about privileges.)

Now this will make the GUI start, but its usage is not explained, and it's not exactly newbie-friendly. So to make life easier I'll explain how I did it. In my case, it was a matter of two clicks; the tricky part was locating exactly what needs to be clicked.

(Note: You may explore all the nodes one by one, but don't modify anything you don't understand. Any modification (e.g. ticking a checkbox) becomes effective immediately; there's no apply button.)

  • The list contains many nodes called Node[0x##] followed by any of AUD_OUT, AUD_IN, AUD_MIX, PIN and VENDOR. The only ones you have to look in are the PIN ones.

  • There are multiple types of PIN nodes; the type we want will fill the whole window with panels/control groups (It helps to stretch or maximize the window), as in this screenshot. (The site prevented me from inserting the image inline, sorry.)

  • Inside the Config Default field, some nodes will have in the first line Jack Connection: N/A; we need the ones that say Jack Connection: Jack as in the screenshot.

  • To change a Line-In to an output jack, look until you find the node that says Jack Type: Line In. (And notice the Jack Location2: Rear and Jack Color: Blue.)

  • Then, in the three checkboxes in the Widget Control group below, uncheck IN and check OUT.

  • Using the same way, you can assign any of the front or rear jacks to either input or output.

Now if you close the window, it will ask whether you want to revert changes. Saying yes reverts them immediately; saying no keeps them but only for this session.

If you want to keep your changes permanently, don't close HDA Analyzer yet. Instead, click "Exp" (Export) at the bottom-left and use Save As to write the python script to a file. Now copy that file to something like /etc/hda-mods.py and edit /etc/rc.local as root (e.g. using gksudo gedit /etc/rc.local) and add the line python /etc/hda-mods.py right before the exit 0 line, then save it and reboot. Your changes should survive.

4
  • I'd like to know how useful this is for the people who want to use HDA Analyzer to configure a 5.1 setup...
    – Yamaho
    Jan 3, 2013 at 23:29
  • I used this awesome write-up to use my pink ( rear ) mic port as my sub/center output, and my blue ( rear ) line-in port as my rear channel. It's not "5.1" in the sense of being positional sound per se, but I don't really need that right now.. I just need analog stereo output across all channels. May 16, 2015 at 6:06
  • 1
    There has to be a way to mark each output as for whatever purpose, i.e. designate it as a sub-woofer, etc. May 16, 2015 at 6:07
  • alsa-project.org/hda-analyzer.py gives "404 Not Found", but you can still access the git tree here git.alsa-project.org/?p=alsa.git;a=tree;f=hda-analyzer Oct 8, 2022 at 14:47
8

Another gui tool might be hdajackretask from the alsa-tools-gui package. Very simple gui, supports boot override and advanced options.

enter image description here

I hope I didn't misunderstand the question entirely. OP asked for non-JACK-options but I am pretty sure this might help someone else out. In my case, I had to check Advance override and Show unconnected pins and set an unconnected microphone input to a headphone output.. very weird, but works. Would love to see a cmd line solution though

Edit: If you're struggling with this you also might want to the model=dell-headset-multi thing from here Mic problems with Analogue Stereo Duplex

2
  • 1
    worked for me only after installing as boot apply. Sep 5, 2017 at 19:31
  • @RuslanGerasimov yeah I frequently got some "could not xyz" error. After restarting the program for the 10th time (sometimes with sudo, sometimes without), it worked. I think it is also necessary to close any other applications. In my experience, rebooting is not necessary.
    – phil294
    Sep 6, 2017 at 6:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .