Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how do I create configure a ucm2 conf file for my card just like an acp file #475

Open
beh-10257 opened this issue Nov 26, 2024 · 13 comments

Comments

@beh-10257
Copy link

1_ how do I know if my card is using acp or ucm profile
2_ can ucm config file be availble in user directories
3_ how do i test a ucm profile
4_ if my card is using ucm is there a way to cooverride that file
5_ for more context https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4421
6_ as a tldr I want to take advanatage of indep_hp=yes (IDK why this is not enabled by default its a great feature compared to other platforms after all) either way I want to make hw:0,0 as speaker and hw:0,2 as headphones
can a ucm profile replace the indep_hp hint and udev rule and just porceed to seperate them directly
also indep_hp seperates speaker and headphones output is there a way to seperate internal mic and headphone speaker
also is there a way to put priority for headphones when the jack port is actually put or even disable it entirely and just default back to speaker automatically
thats all thanks

thats all and thanks
further editing will be filled once I have more questions and thanks

@stephematician
Copy link

stephematician commented Nov 26, 2024

  1. alsaucm listcards.

  2. You could use/add a symlink, I guess, but that will obviously be broken for some users.

  3. From the README:

    The UCM configurations are automatically validated using the UCM validator available at https://github.com/alsa-project/alsa-tests/tree/master/python/ucm-validator.

    That might be of use.

  4. Two options come to mind:

    • You could add an additional use-case or variant to the current settings - perhaps this ties in with adding a symlink to your user directories.
    • You can switch UCM on/off in pipewire; so you could use an ACP instead (but I see you don't want to do that).
  5. ...

  6. I have no suggestions as I'm not an expert with writing UCM! But, for example, I am using a Behringer UMC202HD, and UCM separates the inputs (lines in) for me into two separate 'mono' devices rather than a single device in 'stereo'; I suspect what you want to do is possible.

@beh-10257
Copy link
Author

1_ list is empty (I assume my card is not using ucm than)
so now the question is how do I know the name of the file to create
2_ where are the files to symlink to are located (I am using nixos which doesn't follow a normal fhs) so my question is where should ucm profiles be located
3_ so that also applies the ucm profile I though it just sees if the format is right and there are no obvious mistakes
4_ do you have an exemple of the first option
6_ do you mind sharing the file of that ucm profile

@stephematician
Copy link

Regarding 2) As per the other README (see https://github.com/alsa-project/alsa-ucm-conf/blob/master/ucm2/README.md):

UCM master configuration path lookup is defined in the top level ucm.conf file. This file allows custom directory layout. The new ucm2 layout is based on the ALSA driver name with the kernel driver name as fallback. The virtual cards (no direct hw bound) lookups are placed to the separate conf.virt.d directory.

The lookup configuration:

https://git.alsa-project.org/?p=alsa-ucm-conf.git;a=blob;f=ucm2/ucm.conf

I don't have any examples because I've never worked on UCM; maybe the best starting point would be to look through the configuration files in this repository.

The documentation is mostly technical rather than instructive. Between that and there being no inclusion of user directories in the search path - I concluded that UCM configuration is pitched towards ALSA developers, not users like me (as much as I am a developer in other areas).

@beh-10257
Copy link
Author

yeah the readme doesn't give a specific file location like not /usr/share or /etc or whatever
also about this being for alsa developers
I mean I want the developers you are talking about to say that to me and if thats the case why is ucm is the thing that is being used by default like if its the new thing I don't understand how its less customisable than acp profiles either way
since we are both users to ucm yeah it would be better if we just wait for someone to show up

also I can look a the exemples in this repo all I want if I don't know where to put the files and how to use them or test them there is no use of looking

and about the documentation being technical
isn't that bad even for new comers like at least enlighten me on how to start poking around in configuration
if the starting point is not documented there is no point in a technical documentation

idk tbh a developer coming along and sharing his workflow will be more than nothing lol anyway yes

@stephematician
Copy link

I'm just reading the room, it doesn't seem like I'm supposed to mess about with what's underneath UCM - I only came across it recently as I'm learning more about PipeWire.

To help developers, you probably want to clarify some details about the hardware, e.g. the output of:

stephematician@home:~$ alsactl info NAME

You can get the NAME from the id value in an ordinary call to alsactl info.

I'm beginning to suspect that UCM won't be able to help you in your task (after some digging, I assume you want to follow this: https://github.com/luisbocanegra/linux-guide-split-audio-ports). indep_hp is something that happens on what I call the 'kernel level' of ALSA. UCM merely mixes/reorganises the channels that the kernel-level makes available. So if independence has been lost at the kernel-level, UCM can't bring that back.

@beh-10257
Copy link
Author

than let indep_hp=yes stay and I want to replace the acp part of that guide
also sorry if I seem rude or something its 3 am and I should probably sleep lol
heres the output of the command

#
# Sound card
#
- card: 0
  id: PCH
  name: HDA Intel PCH
  longname: HDA Intel PCH at 0x95698000 irq 148
  driver_name: HDA-Intel
  mixer_name: Realtek ALC285
  components: HDA:10ec0285,103c8742,00100002 HDA:8086280b,80860101,00100000
  controls_count: 40
  pcm:
    - stream: PLAYBACK
      devices:
        - device: 0
          id: ALC285 Analog
          name: ALC285 Analog
          subdevices:
            - subdevice: 0
              name: subdevice #0
        - device: 2
          id: ALC285 Alt Analog
          name: ALC285 Alt Analog
          subdevices:
            - subdevice: 0
              name: subdevice #0
        - device: 3
          id: HDMI 0
          name: HDMI 0
          subdevices:
            - subdevice: 0
              name: subdevice #0
        - device: 7
          id: HDMI 1
          name: HDMI 1
          subdevices:
            - subdevice: 0
              name: subdevice #0
        - device: 8
          id: HDMI 2
          name: HDMI 2
          subdevices:
            - subdevice: 0
              name: subdevice #0
    - stream: CAPTURE
      devices:
        - device: 0
          id: ALC285 Analog
          name: ALC285 Analog
          subdevices:
            - subdevice: 0
              name: subdevice #0
alsactl: rawmidi_device_list:105: snd_ctl_rawmidi_next_device

as was said before I want to seperate these two

        - device: 0
          id: ALC285 Analog
          name: ALC285 Analog
          subdevices:
            - subdevice: 0
              name: subdevice #0
        - device: 2
          id: ALC285 Alt Analog
          name: ALC285 Alt Analog
          subdevices:
            - subdevice: 0
              name: subdevice #0

into a speaker and headphones using ucm thats all

@beh-10257
Copy link
Author

@stephematician can you tag anyone you know working on this ucm stuff
this is getting nowhere and even if they show up saying that this is developer only I wanna hear that

@perexg
Copy link
Member

perexg commented Dec 4, 2024

Some hints:

Look to https://github.com/alsa-project/alsa-ucm-conf/blob/master/ucm2/DEBUG.md

For HDA driver - we have complete UCM config, but it's used only for new hardware (SOF/AMD) - https://github.com/alsa-project/alsa-ucm-conf/blob/master/ucm2/HDA/HDA.conf , https://github.com/alsa-project/alsa-ucm-conf/blob/master/ucm2/HDA/HiFi-analog.conf .

So, to use alt pcm, just skip the error at the end of HiFi.conf when indep hp control is present (ControlExists check) and declare Headphones with different PCM. Handle conflicting devices correctly.

@beh-10257
Copy link
Author

@perexg ALSA_CONFIG_UCM2 can I use this enviroment variable instead (thats easier for me to work with) especially since nixos doesn't respect fhs standards also thanks
I will post my ucm profile if I can make this work

also is my desire of removing the headphones output if the jack is not pulgged possible using ucm2

@beh-10257
Copy link
Author

so is the driver name that I should be filling here

# ucm2/conf.d/[${CardDriver}|${KernelDriver}]/${CardLongName}.conf

named snd_hda_codec or snd_hda_codec_realtek or snd_hda_codec_hdmi I mean why was this snd dropped in the first place and stuff in conf.d starts with hda only

@beh-10257
Copy link
Author

so is putting a conf file inside conf.d/snd_hda_codec_realtek|snd_hda_codec/my_config.conf will take priority also I am talking in theory since I need to know if ALSA_CONFIG_UCM2 this works in the first place

either way another question does priority gets decided by ucm2 as well

@perexg
Copy link
Member

perexg commented Dec 4, 2024

ALSA_CONFIG_UCM2

It should work.

named snd_hda_codec or snd_hda_codec_realtek or snd_hda_codec_hdmi I mean why was this snd dropped in the first place and stuff in conf.d starts with hda only

It's driver name not kernel module name. Driver name for apps is in /proc/asound/cards (string between ]: and ' - ').

either way another question does priority gets decided by ucm2 as well
also is my desire of removing the headphones output if the jack is not pulgged possible using ucm2

You should not bother with this. Little modifications to mentioned HDA files are only required. The conf.d subtree should not be touched, the redirection for the HDA driver is already there.

Anyway, I suggest to play with the alsaucm dump command at the first step until you won't see the correct PCM device name in this dump.

@perexg
Copy link
Member

perexg commented Dec 4, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants