# Removing hard dependencies on PulseAudio and splitting ports



## bsduck (Jul 20, 2021)

Dear community,

Many people are annoyed by PulseAudio.
Recent examples:








						Other - Looking to setup a desktop environment that doesn't need Pulseaudio
					

I was getting ready to install kde or xfce when I noticed they pulled in pulseaudio. I remember reading how unFreeBSD this was (or something like that) and was trying to figure out how to get either without pulseaudio and without losing volume control on my laptop - unsuccessfully. So, what's a...




					forums.freebsd.org
				











						After upgrading no more audio in firefox
					

I did pkg upgrade and now I have no audio in firefox.  I do have it with chrome, the problem seems to be firefox.  Any hint?  Thanks




					forums.freebsd.org
				






SirDice said:


> Packages are built with the port's default options set. Most of the time Pulseaudio is set to off by default because a lot of people don't like it and it pulls in dependencies they don't want. I would suggest setting up your own package repository, there you can set everything how _you_ want it.


This attitude seem to fade away. Now some widely used ports are being built with PulseAudio support by default and therefore pull PulseAudio automatically when installed from pkg. This is especially problematic because PulseAudio shows the ungentlemanly behaviour of enabling itself without asking once it's installed.

Two ports in particular recently added PulseAudio to the default options:

audio/alsa-plugins which is a direct dependency of www/qt5-webengine and therefore indirectly required by Falkon, Qutebrowser, Konqueror, KMail, Amarok, MuseScore, ...

accessibility/speech-dispatcher which is a direct dependency of www/chromium and accessibility/qt5-speech and therefore indirectly required by most of KDE software (including Plasma destop), Linphone, FreeCAD, ...

As a result, lots of people ended up with PulseAudio added in a recent `pkg upgrade` and automatically enabled, sometimes leading to problems.

I emailed the maintainer of alsa-plugins about this, who replied it's not fair to let PulseAudio users rebuild everything in order to get things working. That's a good argument, but annoying all other pkg users by pushing Poetterware they don't need neither want on their systems and which may break audio setup is not fair either. We need a solution which is acceptable for both sides.

For this particular port, he suggested that it could be split in smaller ones. That's probably the way to do, and this is true for other ports too. For example x11-wm/lxqt-panel, which pulls PulseAudio because its built-in audio volume applet needs it. If this applet were made a separate port, like audio/xfce4-pulseaudio-plugin, installing LXQt wouldn't require PulseAudio anymore and nobody would be wronged in the move.

I'd like to do something to fix these problems and have lots of time available. The problem is: I don't know how to split a port. Your help is welcome.


----------



## Jose (Jul 20, 2021)

bsduck said:


> I emailed the maintainer of alsa-plugins about this, who replied it's not fair to let PulseAudio users rebuild everything in order to get things working.


So you break existing setups for people who don't even know what Pulseaudio is? This makes no sense.


bsduck said:


> I'd like to do something to fix these problems and have lots of time available. The problem is: I don't know how to split a port. Your help is welcome.


I wonder if something like Apulse would work.


----------



## mer (Jul 20, 2021)

Jose, I think it's more "PulseAudio was not a dependency before, I updated packages and now it is".  Basically inconsistency in a ports dependencies between versions.  Hard on the maintainer if upstream keeps flipping around.
bsduck I think the maintainer is referring to "flavors" of the ports.
"find every port that has pulseaudio as a build or run dependency and see if it can be disabled.  if so create a nopulse flavor that has pulseaudio disabled".


----------



## Jose (Jul 20, 2021)

mer said:


> Jose, I think it's more "PulseAudio was not a dependency before, I updated packages and now it is".  Basically inconsistency in a ports dependencies between versions.  Hard on the maintainer if upstream keeps flipping around.


Nope. Option was turned on by a new maintainer who gave no explanation for the move:





						245321 – audio/alsa-lib: (and others) update to 1.2.2
					






					bugs.freebsd.org


----------



## mer (Jul 20, 2021)

Jose said:


> Nope. Option was turned on by a new maintainer who gave no explanation for the move:


Ahh.  That certainly violates POLA (Principle Of Least Astonishment).


----------



## astyle (Jul 20, 2021)

I never cared for pulseaudio. I just treat it as another compile-time dependency. Even with that, I'd want to compile it early on, with as many options enabled as practical, to avoid complaints from the make system. There's also portaudio and JACK as audio options for ports.  I enable those, too, if available.  My thinking basically goes, I don't want to end up hunting down the correct audio lib, because without it, some random application is not working correctly. I do agree that hard deps should be minimized, but I like having options and convenience. It ends up being a trade-off.


----------



## bsduck (Jul 20, 2021)

Jose said:


> I wonder if something like Apulse would work.


Something like that would be an option indeed: https://aur.archlinux.org/packages/pulseaudio-dummy/

The real PulseAudio could be declared as a build-only dependency, allowing the runtime library to be provided by the "fake" one using apulse:

```
PULSEAUDIO_BUILD_DEPENDS=       pulseaudio:audio/pulseaudio
PULSEAUDIO_LIB_DEPENDS=         libpulse.so:audio/pulseaudio-dummy
```
That way PulseAudio would be used if installed, and otherwise pkg would install pulseaudio-dummy to satisfy the dependency. Not bad.

It's not an optimal solution because it still means installing unnecessary software, as well as having a weird PulseAudio -> ALSA -> OSS double compatibility layer, but it would already be better than the current situation and could be an acceptable compromise. I don't think apulse will autostart itself and create problems that way. I don't know however how Firefox (and other programs with similar automatic backend selection) would behave if it's installed: is the only presence of libpulse.so or the pulseaudio executable enough for it to choose the PulseAudio backend instead of the OSS one? In this case this would still not be solved.

I will further investigate. Thank you!



mer said:


> I think the maintainer is referring to "flavors" of the ports.
> "find every port that has pulseaudio as a build or run dependency and see if it can be disabled. if so create a nopulse flavor that has pulseaudio disabled".


I thought about it too. It would be fine for a few end-user applications, but doing so with ports which are themselves dependencies of many other ports would be complex and I'm not sure this would be accepted. In this case it would make more sense to have the standard package built without PulseAudio support and an extra flavour for it. For example speech-dispatcher and speech-dispatcher-pulse. Otherwise most people will still end up with PulseAudio running just by installing random KDE software.


----------



## Alain De Vos (Jul 20, 2021)

my make.conf

```
OPTIONS_UNSET+=PULSE
OPTIONS_UNSET+=PULSEAUDIO
OPTIONS_SET+=SNDIO
```


----------



## monwarez (Jul 20, 2021)

This seems a lot of work for something that will most likely disappear with multimedia/pipewire  and then depending on how PipeWire integrate with FreeBSD, this effort will be needed again. And of course PipeWire had a PulseAudio option..
Which would give use this kind of layer: PipeWire -> PulseAudio -> ALSA -> OSS


----------



## Vull (Jul 20, 2021)

FWIW, I install from packages so I can't use any of these hard dependency fixes, but I do have some random KDE software I use from time to time, and am annoyed by pulseaudio too, so I followed one of Alexander's suggestions by adding the following line to /usr/local/etc/pulse/client.conf ...
	
	



```
autospawn=no
```
... in my plasma5-plasma install. This successfully prevented pulseaudio from respawning, and from even starting in the first place.

It might also be worth mentioning that in my stripped down plasma5-plasma install, the only component which uses pulseaudio is accessibility/speech-dispatcher and I don't use that anyway, so I'm good for now, but as monwarez just mentioned, all of this may be subject to change due to future upgrades.


----------



## astyle (Jul 20, 2021)

Yeah, just y'all wait until KDE finally pulls the QT6.3/KF6/Plasma6 on us. FreeBSD's entire ports-mgmt category will blow up in everybody's faces.


----------



## Vull (Jul 20, 2021)

astyle said:


> Yeah, just y'all wait until KDE finally pulls the QT6.3/KF6/Plasma6 on us. FreeBSD's entire ports-mgmt category will blow up in everybody's faces.


I really LOVE KDE, and have for years, but I keep a MATE desktop on reserve in anticipation of further birthing pains with KDE as it seems to be in a bit of an unstable period in its evolution right now. Regardless of all that, I've always preferred KDE as a general-purpose, fully-featured desktop environment, but for a long time now have preferred MATE as a simpler, more lightweight and stable front-end for any of my working Apache/PHP/Postgresql server systems. Thanks


----------



## bsduck (Jul 20, 2021)

Coming back to the idea of splitting ports: the maintainer I wrote to obviously didn't mean flavours.


> Of course the real solution for this port in particular is to split it into many small ones, it shouldn't be one big monolithic port.


In the case of alsa-plugins, this would mean to have different ports for different plugins, instead of a port including all plugins, so you can pick what you need (like with gstreamer plugins) instead of depending on the whole set. For example www/qt5-webengine obviously doesn't need alsa-plugins for its PulseAudio plugin, since itself comes with PulseAudio support disabled by default.

Another option would be to convince maintainers that enabling PulseAudio by default is bad, and make them revert to the previous defaults, but that will be even more complicated  And I must admit that having packages that work for both PA and non-PA users without alienating anyone would be nice. Given that some Linux distributions like Void manage to provide this, this shouldn't be an impossible task for us.


----------



## grahamperrin@ (Jul 21, 2021)

bsduck said:


> … I emailed the maintainer of alsa-plugins …





Jose said:


> … a new maintainer …



There is no maintainer. 

<https://cgit.freebsd.org/ports/commit/audio/alsa-lib?id=b88defae3aae489a95520cb1b6bcde4e332ce188>


----------



## Jose (Jul 21, 2021)

You're right, Greg V (The person who turned on the Pulseaudio option) offered to take maintainership, but then never followed up:





						245321 – audio/alsa-lib: (and others) update to 1.2.2
					






					bugs.freebsd.org


----------



## astyle (Jul 21, 2021)

@OP: Sometimes, it feels like you're missing the point of /usr/ports. With some effort up front, it's possible to set up /usr/ports to match the packages (or install the ports.txz distribution from get-go), and then do this:

```
# cd /usr/ports/my/port
# make config
(adjust your options)
# make
# make package
# cd /usr/ports/packages (assuming that's where results of previous line go)
# pkg install ./port (install the port in the current dir, NOT my/port from FreeBSD repos)
```

FWIW, Poudriere can be helpful (And grahamperrin will vouch for that!)


----------



## grahamperrin@ (Jul 21, 2021)

```
% pkg query '%o %v %R' poudriere-devel
ports-mgmt/poudriere-devel 3.3.99.20210714 FreeBSD
%
```

I do use ports-mgmt/poudriere-devel whenever possible, however my use of configuration files (just one) is very simplistic …

<https://forums.FreeBSD.org/threads/63544/post-519207>


----------



## Alain De Vos (Jul 21, 2021)

To be very precise you have 2 configuration files poudriere.conf & make.conf


----------



## twschulz (Jul 21, 2021)

It's also possible to stop pulseaudio from starting automatically (if that is a lower hanging fruit than adding pulse flavors to all ports that may use pulse audio).

You can do that by editing /usr/local/etc/pulse/client.conf and changing the autospawn argument.


```
autospawn = no
```

After that, pulseaudio will need to be started manually for any application that uses pulse.

The manpage for pulse-client.conf has additional information (sorry, I couldn't get the manpage tag to work correctly):


> autospawn= Autospawn a PulseAudio daemon when needed. Takes a boolean
> value, defaults to yes. Note that setting this to "no" doesn't disable
> the systemd service. The autospawn option is only meant to be used on
> systems without systemd. If you use systemd to start PulseAudio, use
> ...


Yes, there is a lot of extra info for Linux-based systems using systemd in the manpage, but setting autospawn to no does work (speaking from experience).


----------



## sko (Jul 21, 2021)

The "autospawn" option is ignored for a lot of scenarios. It only prevents pulse from loading at X startup.
I just rm/mv'ed /usr/local/bin/pulseaudio from my systems and/or replaced it with a softlink to /bin/true to effectively stop pulseaudio from being loaded and messing up my sound configuration.

With the (annoying) frequency of updates for firefox (even ESR!) and the time it takes to build from ports, I rather nuke pulseaudio this way than rebuilding firefox every few days from source.
IMHO there are other even more annoying and bloated dependencies like e.g. akonadi, which pulls a full mysql-server and a ton of other packages. Because of that I usually build okular from ports without the "share" option, which reduces the install size by several 100MB!

Instead of trying to remove dependencies on single packages, I'd rather like to see a "minimal" variant of at least some bigger software packages, which still provides the basic functionality and tries to leverage what is already available in base (e.g. using OSS for sound...), but removing unnecessary bells&whistles that require a whole rats nest of dependencies...


----------



## mer (Jul 21, 2021)

sko said:


> I just rm/mv'ed /usr/local/bin/pulseaudio from my systems and/or replaced it with a softlink to /bin/true to effectively stop pulseaudio from being loaded and messing up my sound configuration.


I do the same with dbus-launch and dbus-daemon


----------



## bsduck (Jul 21, 2021)

astyle said:


> @OP: Sometimes, it feels like you're missing the point of /usr/ports. With some effort up front, it's possible to set up /usr/ports to match the packages (or install the ports.txz distribution from get-go), and then do this:


That's more or less what I do, but that's not the point of this topic. I do have lxqt-panel and alsa-plugins installed, and no PulseAudio installed, that's not the problem. The problem is: a user shouldn't have to use workarounds or build ports locally in order to have a PulseAudio-free desktop. This should be the default. OSS is one of the things that make FreeBSD desktop better than Linux desktop in my opinion, and ports pulling in PulseAudio for no reason are kind of sabotaging this. Like if installing Krita would pull in the Plasma desktop and automatically start it at login.


----------



## Alain De Vos (Jul 21, 2021)

When you install or calligraplan or kile or okular, akonadi get installed ...


----------



## astyle (Jul 21, 2021)

bsduck said:


> That's more or less what I do, but that's not the point of this topic. I do have lxqt-panel and alsa-plugins installed, and no PulseAudio installed, that's not the problem. The problem is: a user shouldn't have to use workarounds or build ports locally in order to have a PulseAudio-free desktop. This should be the default. OSS is one of the things that make FreeBSD desktop better than Linux desktop in my opinion, and ports pulling in PulseAudio for no reason are kind of sabotaging this. Like if installing Krita would pull in the Plasma desktop and automatically start it at login.


To be honest, I agree with the idea. My thinking goes, that would take a rather thorough analysis of the entire ports tree. Consider the fact that there's 3 audio back-ends that any given project can use: PulseAudio, PortAudio, and JACK. Even if you try using GStreamer or PipeWire or an external player for audio (say, audio/mpg123), there's a good chance it will still ultimately have PulseAudio as the back-end.  You can go around asking different projects to rework their reliance on PulseAudio, or you can compile your own.  That's just my take on the situation...


----------



## grahamperrin@ (Jul 21, 2021)

Alain De Vos said:


> … you have 2 configuration files poudriere.conf & make.conf



True, although my /usr/local/etc/poudriere.conf is almost completely vanilla. Two lines occasionally changed: 

`ALLOW_MAKE_JOBS=yes`

`PARALLEL_JOBS=2`


----------



## malavon (Jul 21, 2021)

I also build packages myself, without Pulseaudio (and some others probably). I don't really agree that it's fine to have it on by default because of something that actually happened and took quite some debugging to figure it out: when compiling SDL2 while Pulseaudio is installed, it'll give Pulseaudio preference over OSS (which IMO should always be the default on FreeBSD). Thus, on my system that had it installed but not configured there wouldn't be any sound. 
If you're wondering why I compiled SDL2 outside of my poudriere build, that's because it was a source build used by UE4. Nothing special, but could happen to other people with other software as well. 
For the packages I build I take a pragmatic minimalist approach, I disable what I really don't need or want (like Pulseaudio) and keep the rest at default config to prevent issues with other ports cropping up. If one day a port requires Pulseaudio, I'll either patch it out or just not install/use it.

I also have no idea why Pulseaudio is even useful really, is there software in ports that doesn't have sound if compiled without support for Pulseaudio? I haven't noticed any myself over several years.


----------



## malavon (Jul 21, 2021)

grahamperrin said:


> True, although my /usr/local/etc/poudriere.conf is almost completely vanilla. Two lines occasionally changed:
> 
> `ALLOW_MAKE_JOBS=yes`
> 
> `PARALLEL_JOBS=2`


If you have enough RAM, consider setting `USE_TMPFS=all`, it speeds up builds really nicely.


----------



## sko (Jul 22, 2021)

Yesterday I updated 2 family PCs - both pulled in pulseaudio because of the newly introduced hard dependency by firefox-esr, for both PCs I got a call today because sound isn't working in firefox and some other programs because pulseaudio is spawned (without explicitly enabling/allowing it!) and doesn't work.
building from ports on those machines is completely out of question - these are old PCs (very first dual-core generation...) that would take hours or even days to build firefox and its dependencies; so I again had to use the dirty workaround of deleting /usr/local/bin/pulseaudio

So thinking about it again, this IMHO is a clear violation of POLA by breaking existing installations with default configuration.

If someone wants to use pulseaudio, one is always free to install/configure it and programs may use it (or need to be built with support) - but pulling it in and/or using it as default (which breaks existing configurations more often than not), let alone starting a daemon without enabling it via rc.conf should really be considered a regression and violation of POLA and be reported as a bug.


----------



## Jose (Jul 22, 2021)

sko said:


> If someone wants to use pulseaudio, one is always free to install/configure it and programs may use it (or need to be built with support) - but pulling it in and/or using it as default (which breaks existing configurations more often than not), let alone starting a daemon without enabling it via rc.conf should really be considered a regression and violation of POLA and be reported as a bug.


Hear, hear!

It's sad Freebsd users are being saddled with this Linux crapware that is useless at best on Freebsd.


----------



## astyle (Jul 22, 2021)

Jose said:


> Hear, hear!
> 
> It's sad Freebsd users are being saddled with this Linux crapware that is useless at best on Freebsd.


I have PulseAudio pulled in as a dep when I compile my ports, and I don't care - nothing's broken, and it doesn't take up that much space, either.


----------



## Vull (Jul 22, 2021)

sko said:


> Yesterday I updated 2 family PCs - both pulled in pulseaudio because of the newly introduced hard dependency by firefox-esr, for both PCs I got a call today because sound isn't working in firefox and some other programs because pulseaudio is spawned (without explicitly enabling/allowing it!) and doesn't work.
> building from ports on those machines is completely out of question - these are old PCs (very first dual-core generation...) that would take hours or even days to build firefox and its dependencies; so I again had to use the dirty workaround of deleting /usr/local/bin/pulseaudio
> 
> So thinking about it again, this IMHO is a clear violation of POLA by breaking existing installations with default configuration.
> ...


I basically agree on all points, but may I suggest replacing firefox-esr with just plain firefox? Here I am listening to a youtube video playing on firefox-90.0.1,2 with no special changes made to firefox, yet, in the konsole terminal on the right, you can see that pulseaudio is not running, due to the small edit I made in /usr/local/etc/pulse/client.conf which prevents pulseaudio from respawning, and, in all the cases I've tested so far, from ever starting itself in the first place.


----------



## astyle (Jul 22, 2021)

Vull said:


> I basically agree on all points, but may I suggest replacing firefox-esr with just plain firefox?


Those two are very different beasts - www/firefox-esr is at version 78.12, while regular www/firefox is at 90.0.1... The esr version only gets pulled in as a dependency for some security ports (can't recall off the top of my head exactly which ones), and is not a fuctional drop-in replacement for regular version. Try installing and launching firefox-esr from Konsole, and you will see why.


----------



## Vull (Jul 22, 2021)

astyle said:


> Those two are very different beasts - www/firefox-esr is at version 78.12, while regular www/firefox is at 90.0.1... The esr version only gets pulled in as a dependency for some security ports (can't recall off the top of my head exactly which ones), and is not a fuctional drop-in replacement for regular version. Try launching firefox-esr from Konsole, and you will see why.


I don't have it installed and have no reason to install it. Maybe others do but I'm only offering a suggestion.


----------



## grahamperrin@ (Jul 22, 2021)

malavon said:


> … `USE_TMPFS=all`, it speeds up builds really nicely.



Thanks, I'm already with it. Also: 


```
root@mowa219-gjp4-8570p:~ # zfs get canmount copperbowl/tmp copperbowl/var/tmp
NAME                PROPERTY  VALUE     SOURCE
copperbowl/tmp      canmount  off       local
copperbowl/var/tmp  canmount  on        default
root@mowa219-gjp4-8570p:~ # grep \/tmp /etc/fstab
tmpfs           /tmp                    tmpfs      rw,mode=01777              0     0
/tmp            /compat/ubuntu/tmp      nullfs     rw,late                    0     0
root@mowa219-gjp4-8570p:~ #
```


----------



## Tieks (Jul 22, 2021)

sko said:
			
		

> Yesterday I updated 2 family PCs - both pulled in pulseaudio because of the newly introduced hard dependency by firefox-esr, for both PCs I got a call today because sound isn't working in firefox and some other programs because pulseaudio is spawned



FWIW, I run Firefox-esr built from ports with options Alse/Jack/Pulseaudio/Sndio unset (`make config` says OSS is always available). Runs fine, no problems with sound. So Firefox-esr does work with OSS. However, building it from ports may take several hours on older hardware.
I don't know what this autospawn thing is good for. It reminds me of GW-BASIC times, someone once said his programs worked much better when he included a code line stating 'on error resume next'. Right...


----------



## sko (Jul 22, 2021)

Vull said:


> may I suggest replacing firefox-esr with just plain firefox?



I've been using firefox-esr for several years now as my main browser - basically since they switched to full-retard-mode with their versioning and breaking stuff (plugins) every few days on the way. I don't need the absolute cutting-edge versions, but a reliable workhorse.
The ESR version is IMHO the much more sane and 'boring' variant which will just work (almost...), so I also install it on family/friends systems I maintain because it won't break stuff left and right whenever I come around to update those systems.


----------



## Jose (Jul 22, 2021)

I too switched to Firefox-esr after the latest round of breakage from upstream. I've avoided any Pulseaudio troubles because I build my own packages with Poudriere, and have zapped most nonsense in my make.conf.


----------



## grahamperrin@ (Jul 23, 2021)

sko said:


> retard



All things considered, Firefox Quantum is better than pre-Quantum. www/firefox-esr is post-Quantum. Neither www/firefox-esr nor www/firefox is retarded.


----------



## Vull (Jul 23, 2021)

sko said:


> I've been using firefox-esr for several years now as my main browser - basically since they switched to full-retard-mode with their versioning and breaking stuff (plugins) every few days on the way. I don't need the absolute cutting-edge versions, but a reliable workhorse.
> The ESR version is IMHO the much more sane and 'boring' variant which will just work (almost...), so I also install it on family/friends systems I maintain because it won't break stuff left and right whenever I come around to update those systems.


I did use ESR for quite awhile too, but then had some problems with it, the details of which I no longer recall. My approach to stability at present is to use quarterly packages, and only test upgrades on test installions until I find one satisfactory for my purposes. Different ways to skin slightly similar cats. Using packages instead of ports saves me a lot of compiler time, and I feel like it lends me a little more flexibility to try out different combinations without too many regrets. One major thing that has changed for me is that I no longer feel the same pressure I used to feel when it comes to keeping up with the cutting edges of the most recent developments.


----------



## dieselriot (Jul 23, 2021)

I hear you. Retroarch also pulls pulseaudio in as a dependency by default even though it works great with OSS. Pure BS.


----------



## sko (Jul 23, 2021)

grahamperrin said:


> All things considered, Firefox Quantum is better than pre-Quantum. www/firefox-esr is post-Quantum. Neither www/firefox-esr nor www/firefox is retarded.


I was referring to the illogical version numbering they switched to (omitting the first dot to get "higher" version numbers for marketing) and at the same time pushing out every miniscule patch as a new (minor) version every few days. This is just unbearable to maintain and had/has the overall quality of a beta- or rolling development release with constant breakage - nothing I want on production or family PCs that should "just work". But it seems this is nowadays the broadly accepted "linux way" of doing things...


edit:
regarding the original topic - I've just completed building a few things from ports and at least on my xfce4 desktop install, it seems there are 2 major dependencies of several packages that pull in pulseaudio: qt5-webengine and speech-dispatcher. after rebuilding those without pulseaudio (and jack + alsa) I was able to safely remove pulseaudio without pkg nuking half of the desktop applications. Actually I didn't even rebuild firefox-esr itself, because pulseaudio seems to be a 'third degree dependency' (through one/both of the aforementioned packages).

FTR: yes - one should never mix ports and packages. this was just an excercise to find out what actually pulls in pulseaudio on that system.


----------



## ct85711 (Jul 23, 2021)

While I think it good to removing the hard dependency on PulseAudio (and others), it's not going to help much.  In the end, most software are built for Linux, and not *BSD.  The fact the software is even working on FreeBSD is merely a happen stance and or because some devs added some patches to get it to work.  I am not saying Linux is better, as I do prefer FreeBSD.  It's mostly that the Linux community started believing PulseAudio's devs in that Alsa is dead, even though PulseAudio needs Alsa to work.  Now, OSS on Linux isn't like it is here; so there isn't any complaints that OSS is dead on the Linux side.

Either way we look at it, it's easy to see upstream isn't going to remove PulseAudio's dependency, and probably may also be resistant to supporting others.


----------



## grahamperrin@ (Jul 23, 2021)

sko said:


> … one should never mix ports and packages. …



I have mixed for years. Packages from latest.


----------



## bsduck (Jul 23, 2021)

ct85711 said:


> Either way we look at it, it's easy to see upstream isn't going to remove PulseAudio's dependency, and probably may also be resistant to supporting others.


About programs that indeed require PulseAudio to work: yes. But they are not that many and I don't care about them. I'll even say it's nice to have PulseAudio available on FreeBSD so we can use them too.

What can and should be fixed, is the fact lots of software which doesn't require PulseAudio at all upstream (such as most of KDE software and qt5-webengine) is currently bound to it by our own packaging. That's not a thing to blame the Linux community for. Ironically, it's currently easier to get a fully featured PulseAudio-free desktop on Linux (Void Linux in my experience, probably true with a few other penguins too) than on FreeBSD.

https://docs.freebsd.org/en/books/porters-handbook/makefiles/#makefile-depend says:


> When software has extra dependencies that provide extra features, the base dependencies listed in `*_DEPENDS` should include the extra dependencies that would benefit most users. The base dependencies should never be a "minimal" dependency set. The goal is not to include every dependency possible. Only include those that will benefit most people.


I agree about not going too minimal in enabling features but: does PulseAudio benefit most people? I don't think so. Opinions about it seem to fall in a range between "I don't care about it, it runs fine" and "I hate it". I still have to read someone telling how great it is and being thankful about its default installation.



grahamperrin said:


> I have mixed for years. Packages from latest.


We should think about finally founding that _Beastie Mixing Heretics Society._


----------



## sko (Jul 23, 2021)

grahamperrin said:


> I have mixed for years. Packages from latest.


I did and do that too on several hosts/jails where I only need some other option for a single package (e.g. postgresql for postfix). I simply lock those packages, so pkg won't interfere with those ports and `pkg lock -l` gives me a list of packages I have to manually update via ports...
On a small scale thats perfectly maintainable, but I wouldn't want to do that for dependency nigthmares like a DE or browser.


----------



## grahamperrin@ (Jul 24, 2021)

sko said:


> … dependency nigthmares like a DE or browser.



I never encountered any dependency nightmare from mixing ports with latest packages. No need to lock.


----------



## sko (Jul 24, 2021)

grahamperrin said:


> No need to lock.


Without a lock pkg would just re-install the package on next run because of the changed options.


----------



## hardworkingnewbie (Jul 24, 2021)

Well for me the thing is that Pulseaudio was a piece of software originally written by Lennart Poettering (yup, the later systemd guy) in 2004 to solve some issues which some users back then on Linux might have had then.

Basically it replaced the esd thingy from Enlightenment. Then he later moved on to provide other gifts to the community and handed PA maintainer ship to somebode else. Poettering started Avahi and Systemd, at which he's still working on his quest to squeeze a whole operating system into an init system, also reinventing every wheel and then some he stumbles upon during his eternal quest of creeping featurism bloatware goodness.

It's a consumer level software project, let's call it that. It can do some things on software level which ALSA cannot do, however for most people ALSA would be more than enough. And professionals don't care about Pulseaudio, instead they to normally flock around JACK for good reasons.

Pulseaudio is a stranger on FreeBSD's land so to speak, an answer given to a Linux question and designed with mostly Linux on mind, as usual with Poettering's stuff. And therefore something most FreeBSD people really don't need, nor will it be ever a first class citizen. It just has this shitty tendency to replace ALSA interfaces in many pieces of software, which are sometimes also middleware infrastructure like BlueZ.

So more and more software has it nowadays as hard requirement - if you want audio, you need to have PA, otherwise you are lost.


----------



## malavon (Jul 24, 2021)

hardworkingnewbie said:


> So more and more software has it nowadays as hard requirement - if you want audio, you need to have PA, otherwise you are lost.


I'd be interested to know which FreeBSD ports require it to have audio. I haven't seen any, but of course I only use a small subset of ports.


----------



## bsduck (Jul 24, 2021)

hardworkingnewbie said:


> for most people ALSA would be more than enough


Definitely.



hardworkingnewbie said:


> So more and more software has it nowadays as hard requirement


I'd be interested in an list. I know there are some but haven't met many of them.

Quoting FreshPorts:


> *This port is required by:*
> 
> [...]
> 
> ...


... that's not that much.


----------



## grahamperrin@ (Jul 24, 2021)

malavon said:


> which FreeBSD ports require it …



<https://www.freshports.org/audio/pulseaudio/#dependencies> ▶ … *required by* …

Alternatively: 

`pkg rquery -r FreeBSD '%ro' pulseaudio | sort`



sko said:


> Without a lock pkg would just re-install the package on next run because of the changed options.



Possibly, depending on how things are configured.

My comment about locking was more general, in response to the comment about desktop environments and browsers (not PulseAudio in particular).


----------



## grahamperrin@ (Jul 24, 2021)

bsduck said:


> … not that much.



True, IMHO. 

An example of a port where PulseAudio is optional (not required): emulators/virtualbox-ose | <https://www.freshports.org/emulators/virtualbox-ose/#config>

For people with technical knowledge of PulseAudio: ⚙ D31264 emulators/virtualbox-ose: Update to 6.1.24



> … I'm looking for help fixing the issue. …


----------



## malavon (Jul 24, 2021)

Thanks for the list etc, but I worded it badly. I actually meant (leaf) ports that won't have sound when they're compiled without Pulseaudio support (if any that is). I remember testing OBS and I'm pretty sure that I didn't have any issues playing back sound.


----------



## Menelkir (Jul 24, 2021)

I just realized that telegram-desktop now have pulseaudio as a build requirement, sigh.


----------



## Jose (Jul 24, 2021)

bsduck said:


> Definitely.
> 
> 
> I'd be interested in an list. I know there are some but haven't met many of them.
> ...


And how many are optional? We know it should be optional for alsa-plugins, how many others? I have yet to run into absolutely having to have Pulseaudio. I did have to use apulse on Linux when I ran Steam on it.


----------



## astyle (Jul 24, 2021)

Just based on this thread, un-setting PulseAudio in make.conf can make sense for those who can be bothered. I don't care, it doesn't get in my way.


----------



## Vull (Jul 24, 2021)

Jose said:


> And how many are optional? We know it should be optional for alsa-plugins, how many others? I have yet to run into absolutely having to have Pulseaudio. I did have to use apulse on Linux when I ran Steam on it.


Since upgrading to the 3rd quarter's quarterly upgrades, I now have pulseaudio as a requirement for the speech-dispatcher pre-compiled binary package on my kde5 and plasma5-plasma systems. This wasn't true for the 2nd quarter's versions, and still isn't true for my Mate desktop system.
	
	



```
root@kde5:~ # pkg info -r pulseaudio
pulseaudio-14.2:
        alsa-plugins-1.2.2
        speech-dispatcher-0.10.2
```
This may yet inspire me to attempt building these two components from ports, and yes, mixing ports and packages, in my oh-so-precious free time, but I ain't quite there yet. I'm still able to keep it from running by setting `autospawn = off` in /usr/local/etc/pulse/client.conf and, in any case, I'm not really dependent on the plasma5 desktop environment-- I just happen to like playing around with it. Mate is enough to fullfil my requirements.


----------



## Tieks (Jul 24, 2021)

Jose said:
			
		

> And how many are optional?




```
# grep -R OPTIONS_DEFINE= /usr/ports/* | grep -i PULSEAUDIO | sed -E 's/\/Makefile.*//'
/usr/ports/accessibility/speech-dispatcher
/usr/ports/audio/libcanberra
/usr/ports/audio/drumstick
/usr/ports/audio/xmp
/usr/ports/audio/csound
/usr/ports/audio/openal-soft
/usr/ports/audio/lmms
/usr/ports/audio/ncspot
/usr/ports/audio/deadbeef
/usr/ports/audio/shairport-sync
/usr/ports/audio/noson-app
/usr/ports/audio/libmatemixer
/usr/ports/audio/fasttracker2
/usr/ports/audio/darkice
/usr/ports/audio/alsa-plugins
/usr/ports/audio/linux-c7-alsa-plugins-pulseaudio
/usr/ports/audio/pulseaudio
/usr/ports/audio/cava
/usr/ports/audio/forked-daapd
/usr/ports/audio/aqualung
/usr/ports/audio/mumble
/usr/ports/audio/gsequencer
/usr/ports/audio/lollypop
/usr/ports/audio/linux-c7-pulseaudio-libs
/usr/ports/audio/fluidsynth
/usr/ports/audio/libopenmpt
/usr/ports/audio/musescore
/usr/ports/audio/sonic-visualiser
/usr/ports/audio/libao
/usr/ports/audio/kmix
/usr/ports/audio/rtaudio
/usr/ports/audio/xfce4-pulseaudio-plugin
/usr/ports/audio/bambootracker
/usr/ports/audio/spotifyd
/usr/ports/comms/fldigi
/usr/ports/comms/multimon-ng
/usr/ports/devel/efl
/usr/ports/devel/allegro5
/usr/ports/devel/allegro-devel
/usr/ports/devel/ptlib
/usr/ports/emulators/fmsx
/usr/ports/emulators/citra
/usr/ports/emulators/rpcs3
/usr/ports/emulators/vice
/usr/ports/emulators/virtualbox-ose-legacy
/usr/ports/emulators/virtualbox-ose
/usr/ports/emulators/yuzu
/usr/ports/games/retroarch
/usr/ports/graphics/libprojectm
/usr/ports/multimedia/mythtv
/usr/ports/multimedia/wf-recorder
/usr/ports/multimedia/phonon
/usr/ports/multimedia/QtAV
/usr/ports/multimedia/gnome-mplayer
/usr/ports/multimedia/gmtk
/usr/ports/multimedia/avidemux
/usr/ports/multimedia/quodlibet
/usr/ports/multimedia/pipewire
/usr/ports/net/gtk-vnc
/usr/ports/sysutils/mate-settings-daemon
/usr/ports/x11/waybar
/usr/ports/x11/polybar
/usr/ports/x11/wf-shell
/usr/ports/x11/plasma5-plasma
```

This gives 64 ports where Pulseaudio is an option.


----------



## First_Law_of_Unix (Aug 29, 2022)

How do I remove PulseAudio and use PipeWire?


----------



## Alain De Vos (Aug 29, 2022)

While compiling ports & remove pulseaudio i have in "make.conf" just

```
OPTIONS_SET+=SNDIO
OPTIONS_UNSET+=PULSE 
OPTIONS_UNSET+=PULSEAUDIO
```


----------



## hunter0one (Sep 8, 2022)

How do you exactly *use* sndio though? I couldn't get it to show any devices in OBS Studio, which I built with sndio instead of Pulse.


----------



## First_Law_of_Unix (Sep 9, 2022)

hunter0one said:


> How do you exactly *use* sndio though? I couldn't get it to show any devices in OBS Studio, which I built with sndio instead of Pulse.



Alright it seems OBS is able to only capture input sound of OSS devices. Playing/monitoring sound via OSS seems not possible and would need PulseAudio for that. 

Here is the option for "sndio input client" available:



Another option available is the "Audio Input Capture (OSS)", then able to choose OSS devices to capture input sound via OSS:


Here are some links of how other users are able to do so:








						Solved - How to recored audio from Game on FreeBSD.
					

I am trying to record the audio of Games on FreeBSD, but it seams the FreeBSD does not record the output that year from games. I was success full to record sound from the desktop like Rhythmbox and Firefox but not Games. To me that does not make any sense. I use OBS.   Does anyone knows how to...




					forums.freebsd.org
				











						Solved - switching dsp-devices on-the-fly
					

Hi, sometimes when listening to some music or watching youtube, i wish to simply switch the audio device where the output gets directed to to another device like for example my USB-based headphones. Unfortunately the only way known to me is to restart the application which emits the audiostream...




					forums.freebsd.org
				




However if you are doing some professional audio work, I would stick with pulseaudio/pipewire for now since there are not much apps and pro apps supporting OSS as of yet.


----------



## hunter0one (Sep 9, 2022)

First_Law_of_Unix said:


> However if you are doing some professional audio work, I would stick with pulseaudio/pipewire for now since there are not much apps and pro apps supporting OSS as of yet.


Scratch "as of yet". I think most devs don't think one minute about OSS, because as far as Linux goes, it's such a small margin of users and I have yet to get OSSv4 to properly work on Linux. Seems to get harder with each kernel release.
On the other hand FreeBSD sound works out of the box as expected and I haven't had a better audio experience on any other operating system. 

There are some programs that I'd like to use but potentially need Pulseaudio, such as OBS and Dolphin (the Gamecube emulator) but I've been building everything without Pulseaudio to avoid it so this is the last resort. I don't avoid Pulseaudio because of the stigma, but I have a bad experience with it and ALSA in general (probably boils down to ALSA itself) where I would get a constant popping sound regardless of what configurations I made. I have never had this issue on FreeBSD.


----------



## zirias@ (Sep 9, 2022)

Regarding sound options for ports, I currently have these on my package builder:

```
OPTIONS_UNSET+= ALSA JACK PULSE PULSEAUDIO 
OPTIONS_SET+=   SNDIO PORTAUDIO
```
Enabling `SNDIO` and `PORTAUDIO` is mainly for ports that can't use OSS directly.

My reason to still avoid pulseaudio is a bad experience a *very* long time ago, when Debian introduced it, I wasted a few days trying to get it to work, just to finally disable it. I'm pretty sure quality improved since ... otherwise you'd still see a *lot* more complaints, now that it's more or less the "default". So some day, I'll have to revisit it, because:

I don't see *any* chance to get rid of it being a default option any more.

First reason is the growing amount of software that just can't use anything else. With a reasonable large set of packages on your poudriere builder, you *will* have it build pulseaudio anyways, even with the option disabled. Happened to me because of xrdp, pulseaudio is the only option for remote audio.

Then, it provides some features like e.g. the ability to mix and rewire streams of individual applications. Of course, other sound daemons can do similar things, but with pulseaudio already there because it's just _required_ by a growing number of applications, people will use it. As a consequence, you would restrict features for users of the official repositories if you disabled pulseaudio in the default options.

If you (like me) don't need these features, it's indeed just wasted disk space and RAM, given FreeBSD's excellent implementation of the OSS interface. But indeed, as already mentioned, it isn't _much_ space, so, not really a relevant thing nowadays, you can just live with it...


----------



## hardworkingnewbie (Sep 9, 2022)

hunter0one said:


> Scratch "as of yet". I think most devs don't think one minute about OSS, because as far as Linux goes, it's such a small margin of users and I have yet to get OSSv4 to properly work on Linux. Seems to get harder with each kernel release.


Well an older OSSv3 was the standard audio subsystem of Linux, until ALSA replaced it when in 2002 OSS became proprietary software, which was later changed in 2007. Since then nobody really bothered on Linux about OSS any longer.

ALSA immediately back then received high praise: 








						fuck the skull of alsa
					

Ok, so having acquired an 1/8"-to-RCA, it turns out that yes, the SB0410 will provide S/PDIF out. However, it has the same problem that the CMI8738 had, which is, I can't play two sounds at once. This may be related to the fact that the only XMMS setting that will produce audio is the OSS...




					www.jwz.org


----------



## hunter0one (Sep 9, 2022)

hardworkingnewbie said:


> Well an older OSSv3 was the standard audio subsystem of Linux, until ALSA replaced it when in 2002 OSS became proprietary software, which was later changed in 2007. Since then nobody really bothered on Linux about OSS any longer.
> 
> ALSA immediately back then received high praise:
> 
> ...


The website definitely looks like its from 2005. 
Looks like "high praise" indeed. I get why ALSA was created, and I've attemped to use pure ALSA + dmix, which pops much less, but it still happens. Perhaps I'm mis-remembering the history books, but didn't FreeBSD just continue using the free and open-source version of OSS until OSS v4 came along? Now it's more of its own thing. Maybe Linux could have done the same.



zirias@ said:


> Regarding sound options for ports, I currently have these on my package builder:
> 
> ```
> OPTIONS_UNSET+= ALSA JACK PULSE PULSEAUDIO
> ...


I have the same build options. I've only been using Linux/*BSD since 2017, and in that time I've experienced the _same_ issues people were having with PulseAudio over 10 years ago. No "solution" worked. Neither did Pipewire, which had the same issues. Though, with the way things are going, it looks like Pulse and/or Pipewire will be the norm more than it already is.


----------



## bsduck (Sep 9, 2022)

First_Law_of_Unix said:


> However if you are doing some professional audio work, I would stick with pulseaudio/pipewire for now since there are not much apps and pro apps supporting OSS as of yet.


For such usecases, JACK is the way to go.


----------



## hardworkingnewbie (Sep 9, 2022)

hunter0one: Well what I gave you is jwz ranting about ALSA, so Jamie Zawinski who was one of the original authors back then of Netscape Navigator. So not exactly somebody who shys away from doing low level stuff.


----------



## First_Law_of_Unix (Sep 9, 2022)

hunter0one said:


> Scratch "as of yet". I think most devs don't think one minute about OSS, because as far as Linux goes, it's such a small margin of users and I have yet to get OSSv4 to properly work on Linux. Seems to get harder with each kernel release.
> On the other hand FreeBSD sound works out of the box as expected and I haven't had a better audio experience on any other operating system.
> 
> There are some programs that I'd like to use but potentially need Pulseaudio, such as OBS and Dolphin (the Gamecube emulator) but I've been building everything without Pulseaudio to avoid it so this is the last resort. I don't avoid Pulseaudio because of the stigma, but I have a bad experience with it and ALSA in general (probably boils down to ALSA itself) where I would get a constant popping sound regardless of what configurations I made. I have never had this issue on FreeBSD.


That is true, I try my best to avoid anything other than OSS. Hopefully someday if I have the free time I'll like make professional audio GUI apps using OSS system.


----------



## hunter0one (Sep 26, 2022)

I haven't actually made use of Pulseaudio on FreeBSD, but since its a layer for sound it allows you to switch audio devices on the fly without needing to re-open the application, right? If so, is sndio also capable of this?


----------



## First_Law_of_Unix (Sep 27, 2022)

Well I think you'll run into issues so it's good practice to restart sound servers, drivers and apps to get things working properly after changing low level parameters.
Some commands (below) which you can reload the pulseaudio sound server on the fly.

Check if pulseaudio is running:
`pulseaudio --check`

To stop pulseaudio:
`pulseaudio -k`

To restart pulseaudio:
`pulseaudio -D`

(I simply log out and login again or simply reboot)


----------



## Alain De Vos (Sep 27, 2022)

hunter0one said:


> I haven't actually made use of Pulseaudio on FreeBSD, but since its a layer for sound it allows you to switch audio devices on the fly without needing to re-open the application, right? If so, is sndio also capable of this?


When i boot my pc i know which sound devices i want. So, "on the fly changing", why ?


----------



## hunter0one (Sep 27, 2022)

Alain De Vos said:


> When i boot my pc i know which sound devices i want. So, "on the fly changing", why ?


So you don't have to type a sysctl command each time you want to switch from headphones or speakers for example.


----------



## First_Law_of_Unix (Sep 27, 2022)

hunter0one said:


> So you don't have to type a sysctl command each time you want to switch from headphones or speakers for example.


That is a great burden, do you have two different audio output ports (one for the headphones and speakers) are you using a GUI desktop environment?


----------



## hunter0one (Sep 27, 2022)

First_Law_of_Unix said:


> That is a great burden, do you have two different audio output ports (one for the headphones and speakers) are you using a GUI desktop environment?


Yes, I have the speakers hooked up to the back and the headphones in the front. I gave up and just use the headphones now. I don't use a desktop environment, x11-wm/ctwm currently.


----------



## First_Law_of_Unix (Sep 27, 2022)

Have you tried installing "gtk-mixer":





						FreshPorts -- audio/gtk-mixer: GTK based volume control tool
					

GTK-Mixer is GTK based volume control tool ("mixer").  GUI from xfce4-mixer: https://gitlab.xfce.org/apps/xfce4-mixer but xfce4 and gstreamer does not used.  Features - plugins for support different sound backens - change system default sound card - set volume per line/channel - enable/disable...




					www.freshports.org
				




`pkg install gtk-mixer`

Seems like it only requires x11 which ctwm uses.

You can use gtk-mixer to mute or unmute the audio ports easily since it is a GUI.


----------



## hunter0one (Sep 27, 2022)

I know about gtk-mixer, I have no issues changing the volume of different devices, the problem comes when I want to switch between them. This requires me to change hw.snd.default_unit to the corresponding number of the card listed in /dev/sndstat. I actually use hotkeys in ctwm that use the mixer command to turn the volume up/down and have osdmixer to see what the values are. However, I had to set up scripts to change the aforementiomed sysctl variable and restart osdmixer.


----------



## sko (Sep 27, 2022)

hunter0one said:


> I haven't actually made use of Pulseaudio on FreeBSD, but since its a layer for sound it allows you to switch audio devices on the fly without needing to re-open the application, right? If so, is sndio also capable of this?


I switch between the sound card/speakers and USB DAC/Headphones regularly (using only dsbmixer) and don't have to restart e.g. firefox or vlc. The only thing that seems to (sometimes) stick to the output device is audio/deadbeef, but re-opening is sufficient.

Back when pulseaudio crept into the system, the usual experience would be hanging pulseaudio processes that block the audio device, last application that played sound and more often than not the whole USB bus (i.e. nothing that is attached/detached shows up in dmesg) until you at least killed each and every pulseaudio process but mostly I had to reboot to fix everything.

So NO, pulseaudio is not required to switch devices; in fact it isn't even capable of doing that reliably. OTOH OSS is perfectly capable of this without any problems.


----------



## Alain De Vos (Sep 27, 2022)

hunter0one said:


> So you don't have to type a sysctl command each time you want to switch from headphones or speakers for example.


You need to stop :
sndiod parameters_for_speakers
And start :
sndiod paramaters_for_headphone
This can easily be done on commandline.


----------



## tyson (Sep 27, 2022)

hunter0one said:


> Yes, I have the speakers hooked up to the back and the headphones in the front. I gave up and just use the headphones now. I don't use a desktop environment, x11-wm/ctwm currently.


Im not using FreeBSD now as desktop, but probably could install it and test.
From what I remember last time I was running it, you can just switch to headphones 'on the fly', just need proper setup on device.hints.
Check my post long time ago and snd_hda()
Never liked pulseaudio too, and I was avoiding it as much as possible. FreeBSD OSS is perfectly fine, and the quality of output is way better than Linux/Windows when starting/stopping/switching sound.


----------



## Alain De Vos (Sep 27, 2022)

In sysctl.conf you have

```
hw.snd.default_unit=1
```
In rc.conf:

```
sndiod_flags="-f rsnd/1 -L 127.0.0.1  -m play -s default
```


----------



## hunter0one (Sep 28, 2022)

Alain De Vos said:


> You need to stop :
> sndiod parameters_for_speakers
> And start :
> sndiod paramaters_for_headphone
> This can easily be done on commandline.





Alain De Vos said:


> In sysctl.conf you have
> 
> ```
> hw.snd.default_unit=1
> ...


This is really no different than what Im having to do currently without sndio. I use sysctl to change the unit (between 6 and 7 for me) and then restart the application. Sndio should be capable of mixing in the same way Pulseaudio does, but better.



sko said:


> I switch between the sound card/speakers and USB DAC/Headphones regularly (using only dsbmixer) and don't have to restart e.g. firefox or vlc. The only thing that seems to (sometimes) stick to the output device is audio/deadbeef, but re-opening is sufficient.
> So NO, pulseaudio is not required to switch devices; in fact it isn't even capable of doing that reliably. OTOH OSS is perfectly capable of this without any problems.


This is why I avoid Pulseaudio in the first place, the project is over 10 years old and still has the same issues it did in the beginning. I'll gladly take having to restart an application to change devices, but can't OSS itself handle that perfectly fine? Why doesn't it do this for everything?

Firefox is a notable example. It won't use the new sound device until the tab has been restarted, but each tab of Firefox is actually an independent application (Firefox was one of the first browsers to do this) so its the same as restarting the application.


----------



## First_Law_of_Unix (Sep 29, 2022)

hunter0one said:


> This is really no different than what Im having to do currently without sndio. I use sysctl to change the unit (between 6 and 7 for me) and then restart the application. Sndio should be capable of mixing in the same way Pulseaudio does, but better.
> 
> This is why I avoid Pulseaudio in the first place, the project is over 10 years old and still has the same issues it did in the beginning. I'll gladly take having to restart an application to change devices, but can't OSS itself handle that perfectly fine? Why doesn't it do this for everything?
> 
> Firefox is a notable example. It won't use the new sound device until the tab has been restarted, but each tab of Firefox is actually an independent application (Firefox was one of the first browsers to do this) so its the same as restarting the application.


It's not possible yet to use OSS for all apps on FreeBSD, since FreeBSD is using many Linux stuff ported into FreeBSD. Any Linux stuff ported into FreeBSD means it comes with the "burden" of Pulseaudio in most cases.

However, I think the best thing you can do is to create a batch script, so simply clicking on it will make changes to the output settings from speaker to headphone.
This will be easier for you, rather than typing manually all the time.

Also would like to confirm, are you using two different sound cards, or is it that the two different physical audio ports using the same sound card device (for example motherboard built in sound card chip providing audio for the two different physical audio ports)?

I practically have two different sound cards and one of the sound card has multiple audio ports, I never tried/tested outputting sound at the same time for two different sound cards or multiple physical audio ports. Will look into this and I'm sure it can be done, let you know.


----------



## tyson (Sep 30, 2022)

First_Law_of_Unix said:


> It's not possible yet to use OSS for all apps on FreeBSD, since FreeBSD is using many Linux stuff ported into FreeBSD. Any Linux stuff ported into FreeBSD means it comes with the "burden" of Pulseaudio in most cases.
> 
> However, I think the best thing you can do is to create a batch script, so simply clicking on it will make changes to the output settings from speaker to headphone.
> This will be easier for you, rather than typing manually all the time.
> ...


This is most non-true statement I have ever read. One can use all apps he want if they support OSS, be it browsers/audioplayers etc.
I just did basic installation and Firefox and mpv don't need pulseaudio. Lets say those are most used "audio" apps Id use on any OS be it MacOS/Linux. Ye I know, but who need more than an audio player and browser? If you need more advanced apps, you dont mind to accept some burden.

Also, if you check my other post in this thread, it solves switching between headphones/speakers issue with simple one file edit.
But i will repost it, for your ease of use.
Add to /boot/device.hints

```
#Front
hint.hdaa.1.nid20.config="as=1 seq=0"
#Center
hint.hdaa.1.nid22.config="as=1 seq=1"
#Back/rear
hint.hdaa.1.nid21.config="as=1 seq=2"
#Side
hint.hdaa.1.nid23.config="as=1 seq=4"
#Headphones * MOST IMPORTANT ONE *
hint.hdaa.1.nid27.config="as=1 seq=15"
```
I use 7.1 speakers, and headphones. If you want only stereo output find what is your config with `sysctl -a|grep hdaa` and search for green jack. Magically when you connect headphones it just switch to this output now.


----------



## fernandel (Oct 1, 2022)

I have the same applications installed years... At the time when I used ports I never had pulseaudio on my system but I think about two years ago when I switched to packages I cannot avoid anymore and I do not want to build ports again, special those which pull pulseaudio.


----------



## tyson (Oct 1, 2022)

fernandel said:


> I have the same applications installed years... At the time when I used ports I never had pulseaudio on my system but I think about two years ago when I switched to packages I cannot avoid anymore and I do not want to build ports again, special those which pull pulseaudio.


Yes. Certain desktop environments rely on pulseaudio, for example KDE.
Lots of our ports is software made with Linux in mind, so there will be certain linuxism forced on us.
We can resist, as long as they support OSS.


----------



## fernandel (Oct 1, 2022)

tyson said:


> Yes. Certain desktop environments rely on pulseaudio, for example KDE.
> Lots of our ports is software made with Linux in mind, so there will be certain linuxism forced on us.
> We can resist, as long as they support OSS.


The "problem" are Blender, FreeCAD, Qutebrowser and the most guilty Qt5Webengine. But with building ports I did avoid pulseaudio. Now is what it is.


----------



## hunter0one (Oct 1, 2022)

I built Blender to use for video editing and I built it without Pulseaudio; but it really doesnt compare to Kdenlive so Ive been working on building that now..

I think I posted before that a blacklist system for pkg would be extremely beneficial for anyone who knows what theyre doing, would be much more efficient than building certain ports and locking them because Ive probably got 10+ that are locked.


----------



## fernandel (Oct 1, 2022)

hunter0one said:


> I built Blender to use for video editing and I built it without Pulseaudio; but it really doesnt compare to Kdenlive so Ive been working on building that now..
> 
> I think I posted before that a blacklist system for pkg would be extremely beneficial for anyone who knows what theyre doing, would be much more efficient than building certain ports and locking them because Ive probably got 10+ that are locked.


I do not building packages,


----------



## First_Law_of_Unix (Oct 2, 2022)

tyson said:


> This is most non-true statement I have ever read. One can use all apps he want if they support OSS, be it browsers/audioplayers etc.
> I just did basic installation and Firefox and mpv don't need pulseaudio. Lets say those are most used "audio" apps Id use on any OS be it MacOS/Linux. Ye I know, but who need more than an audio player and browser? If you need more advanced apps, you dont mind to accept some burden.



Alright , tell me exactly how I can get a professional multi-band (at least 8+ bands) equalizer GUI app running on FreeBSD for OSS (good luck finding one).

I'm using this this Linux app (it is a professional infinite frequency bands GUI equalizer) working 100% on FreeBSD for system wide sound but needs Apps to run on pulseaudio:








						GitHub - pulseaudio-equalizer-ladspa/equalizer: Pulseaudio LADSPA Equalizer
					

Pulseaudio LADSPA Equalizer. Contribute to pulseaudio-equalizer-ladspa/equalizer development by creating an account on GitHub.




					github.com
				




Yes, to listen to sound in a civilized manner, I have to use pulseaudio. But if you can do "magic" to make this Linux app "work on OSS", please do so harry potter, I'm all ears, enlighten me on how to get the job done.

Would rather use OSS, I tried and there are no GUI apps for multi band equalizer for OSS system wide sound on FreeBSD. This has been discussed before and others have said the same.

Lastly, please do not show me how to use the command line to tweak multi-band frequencies (it is annoying doing that way), I need to use a GUI interface.


----------



## monwarez (Oct 2, 2022)

hunter0one said:


> I know about gtk-mixer, I have no issues changing the volume of different devices, the problem comes when I want to switch between them. This requires me to change hw.snd.default_unit to the corresponding number of the card listed in /dev/sndstat. I actually use hotkeys in ctwm that use the mixer command to turn the volume up/down and have osdmixer to see what the values are. However, I had to set up scripts to change the aforementiomed sysctl variable and restart osdmixer.


If you don't want to restart application after switching between different devices, then consider using audio/virtual_oss .
With it you can change device output on the fly without needing to restart the application (except for some applications like wine, maybe there is some configuration to be done), you can even take the mic of one device and the speaker of another device which is not feasible with just tuning hw.snd.default_unit .


----------

