# Pulseaudio in FreeBSD



## usakhncit (Sep 17, 2019)

Hi
I am slowly configuring my FreeBSD according to .my needs (and taste). In this context, I have installed 'pulseaudio' and 'alsa-utils'. However, pulseaudio is not being recognized by applications like audacious, mplayer etc. They are using 'oss' as audio output plugin. Moreover, Multimedia in System Settings of KDE is not showing audio server (which I think should display). So, am I missing something here? What am I doing wrong that pulseauido is not appearing in my system? Thanks
PS: please check attached screenshot.


----------



## twllnbrck (Sep 18, 2019)

Hi,
FreeBSD as such comes with OSS. And pulseaudio is (fortunately I think) disabled by default on many ports/pkg. So you need to customize the build options of multimedia/mplayer and x11/kde5 and enable pulseaudio. Do you install sw via pkg(8) or ports?


----------



## usakhncit (Sep 18, 2019)

twllnbrck said:


> Hi,
> FreeBSD as such comes with OSS. And pulseaudio is (fortunately I think) disabled by default on many ports/pkg. So you need to customize the build options of multimedia/mplayer and x11/kde5 and enable pulseaudio. Do you install sw via pkg(8) or ports?


Hi "twllnbrk", how are you? Nice to see you here, after helping me in lklfuse  
As for your question, I have installed kde5, pulseaudio, mplayer, audacious etc. all from pkg.


----------



## twllnbrck (Sep 19, 2019)

Using pkg(8) for a desktop/laptop is suited in 99% of cases. But packages are build against the default settings (options) and these are up to the maintainer of a port. When you need customized versions, then you need ports. But building all the sw you need from source can be a time consuming exercise. 
I have 3-4 packages where I need some changes to the default options, e.g. for sound in virtualbox vms I had to enable pulseaudio. In such a case you have 3 options: 
First building everything from ports which can be annoying on desktops/laptops. 
Or you can use pkg(8) and build only the ports where you need customization. I used ports-mgmt/portmaster and `pkg lock` for 2 years after switching to FreeBSD but mixing pkg and ports is not recommended because you can run into major problems especially with dependencies.
The third and recommended option is using ports-mgmt/poudriere or ports-mgmt/synth to build your own pkg repository with customizations. I switched to poudriere a few month ago and Im happy with it. I use the repo for my desktop and thinkpad both running 12.0-RELEASE. Here is a short guide for setting up poudriere.
But in the end its up to you which method you choose.
Best regards


----------



## D-FENS (Sep 19, 2019)

I myself installed pulse also via pkg(8), only exception is multimedia/ffmpeg because the binary package does not have any MP3 encoders. Apps like Firefox, Audacious, mplayer and KDE work just fine with pulse.

Make sure you installed all necessary packages, for example: audio/plasma5-plasma-pa and audio/pavucontrol, multimedia/phonon.
Just make a package search on FreshPorts and look at anything with "pulse audio" and "KDE/plasma". The integrations need to be installed.
Then open the mixers like audio/pavucontrol and the KDE mixer and make sure you are not muted and the levels are sensible. You should be able to hear sound.


----------



## twllnbrck (Sep 19, 2019)

roccobaroccoSC said:


> I myself installed pulse also via pkg(8), only exception is multimedia/ffmpeg because the binary package does not have any MP3 encoders. Apps like Firefox, Audacious, mplayer and KDE work just fine with pulse.


Yes of course you can install pulseaudio via pkg(8). But I thought pulseaudio support is disabled by default on x11/kde5 and multimedia/mplayer. However, I can be mistaken since I'm neither a KDE user nor do I make much use of pulseaudio (except for virtualbox).


----------



## D-FENS (Sep 19, 2019)

twllnbrck said:


> Yes of course you can install pulseaudio via pkg(8). But I thought pulseaudio support is disabled by default on x11/kde5 and multimedia/mplayer. However, I can be mistaken since I'm neither a KDE user nor do I make much use of pulseaudio (except for virtualbox).


Use VLC or MPV instead of mplayer.
And for KDE, I think it does support pulse. I use it via the packages. You need the package audio/plasma5-plasma-pa for that.


----------



## twllnbrck (Sep 19, 2019)

I dont use mplayer. Indeed I use mpv and mpd with ncmpcpp for music. But zetrotrack000  asked for pulseaudio support in mplayer and plasma and it is disabled in the default options.


----------



## usakhncit (Sep 20, 2019)

The following packages are installed:

```
audio/plasma5-plasma-pa
audio/pavucontrol
multimedia/phonon
```
But still pulseaudio is missing. I did not try VLC, I will try it today.
But there is another thing. I was thinking to move towards pulseaudio, because I think OSS is not properly functioning in my system. Because, if a play a song then start some other memory consuming task (like large file copying), the song starts to hang. This does not happen in Linux, and I have 8GB RAM, so memory is not a problem. Moreover, in audacious in my playlist if one song ends and next is playing then there no sound, unless I stop and replay that song.


----------



## usakhncit (Sep 20, 2019)

twllnbrck said:


> Using pkg(8) for a desktop/laptop is suited in 99% of cases. But packages are build against the default settings (options) and these are up to the maintainer of a port. When you need customized versions, then you need ports. But building all the sw you need from source can be a time consuming exercise.
> I have 3-4 packages where I need some changes to the default options, e.g. for sound in virtualbox vms I had to enable pulseaudio. In such a case you have 3 options:
> First building everything from ports which can be annoying on desktops/laptops.
> Or you can use pkg(8) and build only the ports where you need customization. I used ports-mgmt/portmaster and `pkg lock` for 2 years after switching to FreeBSD but mixing pkg and ports is not recommended because you can run into major problems especially with dependencies.
> ...


Thanks for your suggestion, but at this early stage, when I am learning and trying to fix hardware/software basic issues, I think I am not ready to try that. But in future I think I will definitely give it a try.


----------



## twllnbrck (Sep 20, 2019)

zetrotrack000 said:


> Thanks for your suggestion, but at this early stage, when I am learning and trying to fix hardware/software basic issues, I think I am not ready to try that. But in future I think I will definitely give it a try.


Before switching to poudriere you can build only x11/kde5 from ports and enable pulseaudio. It will take some time but should work. As I said I did the same with virtualbox and openbox ports and never had any big problems. Just make sure you lock the port with `pkg lock` after install to prevent pkg(8) to reinstall it with the next `pkg upgrade`.
 I would recommend ports-mgmt/portmaster cause you can configure it to use packages for the dependencies. But take your time to setup your system.


----------



## shkhln (Sep 20, 2019)

zetrotrack000 said:


> I was thinking to move towards pulseaudio, because I think OSS is not properly functioning in my system.



That won't help you. PulseAudio doesn't do actual audio part itself, it plays sound through ALSA on Linux and through OSS on FreeBSD.



zetrotrack000 said:


> Because, if a play a song then start some other memory consuming task (like large file copying), the song starts to hang.



Why would file copying be a memory consuming task?


----------



## usakhncit (Sep 20, 2019)

shkhln said:


> Why would file copying be a memory consuming task?


On my system, I noticed that when I copy a large file to USB stick, it consumes some resources.


----------



## shkhln (Sep 20, 2019)

_Some_ resources, yes. Usually nothing notable. Can you describe your situation in a bit more detail? Are you using USB sound card, by the way?


----------



## usakhncit (Sep 20, 2019)

shkhln said:


> _Some_ resources, yes. Usually nothing notable. Can you describe your situation in a bit more detail? Are you using USB sound card, by the way?


Yes. Wow, you guessed it right. I am using usb sound card. Which is sometimes detected by FreeBSD and sometimes not.


----------



## shkhln (Sep 20, 2019)

Well, USB audio is known to be a bit flaky. Which card is it?


----------



## usakhncit (Sep 20, 2019)

shkhln said:


> Well, USB audio is known to be a bit flaky. Which card is it?


Presently, I am on Linux system and it detects the usb sound card as:

```
Bus 001 Device 002: ID 0d8c:013c C-Media Electronics, Inc. CM108 Audio Controller
```


----------



## shkhln (Sep 20, 2019)

As I don't have any personal experience with USB audio devices, let's see whether anyone else here has any ideas. You still need to describe your issue in more detail, though.


----------



## usakhncit (Sep 20, 2019)

shkhln said:


> As I don't have any personal experience with USB audio devices, let's see whether someone else here has any ideas. You still need to describe your issue in more detail, though.


The original issue was that i was trying to move to pulseaudio. That usbaudio card problem was left pending by me, until you guessed it


----------

