SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
In case of interest, here are my configurations for "PA installed (to keep packages as they are), but never running, instead using JACK with ALSA and qjackctl (both jack and qjackctl are in the sbopkg repo)"
(Disclaimer, I don't use things like discord and co, for which this might fail)
(In fact, NO WARRANTY AT ALL FOR ANYTHING HERE, IT WORKS FOR ME BUT I CANNOT GUARANTEE IT WORKING FOR ANYONE ELSE)
(Also, some of this is sourced from other authors, names forgotten =-/, but this has worked for me for years now)
/etc/asound.conf:
Empty file
/etc/pulse/client.conf:
Code:
; default-sink =
; default-source =
; default-server =
; default-dbus-server =
autospawn = no
allow-autospawn-for-root = no
; daemon-binary = /usr/bin/pulseaudio
; extra-arguments = --log-target=syslog
; cookie-file =
; enable-shm = yes
; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB
; auto-connect-localhost = no
; auto-connect-display = no
#I have other entries but only this one is part of the setup
#Also, slackpkg might want to overwrite this on kernel updates, keep your eyes peeled in any case
/sbin/modprobe snd_aloop
The following sets up a loopback based configuration that is used to divert alsa data into JACK for those applications that don't have JACK support.
"ploop" will be a JACK input that programs like Skype can use
"cloop" will be the JACK output that you connect to the system output (or any tool chain) that will play back ALSA sourced data
Note: This setup might not work for systems with multiple soundcards, including the ones from GPUs (HDA Intel etc, and might need some rearranging at boot, but I forgot how that's done =-/ )
~/.asoundrc
Code:
pcm.amix {
type dmix
ipc_key 219345
slave.pcm "hw:Loopback,0,0"
slave.period_size 1024 # Divide/Multiply these by two to adjust the buffer, too low a buffer can be crackly
slave.buffer_size 8192 # Too high a buffer can feel laggy
slave.rate 48000 # adjust this to your cards sampling rate
}
# capture PCM device: using loopback subdevice 0,1
pcm.asnoop {
type dsnoop
ipc_key 219346
slave.pcm "hw:Loopback,0,1"
}
# duplex device combining our PCM devices defined above
pcm.aduplex {
type asym
playback.pcm "amix"
capture.pcm "asnoop"
}
# ------------------------------------------------------
# for jack alsa_in and alsa_out: looped-back signal at other ends
pcm.ploop {
type plug
slave.pcm "hw:Loopback,1,1"
}
pcm.cloop {
type dsnoop
ipc_key 219348
slave.pcm "hw:Loopback,1,0"
}
# ------------------------------------------------------
# default device
pcm.!default {
type plug
slave.pcm "aduplex"
}
pcm.card0 {
type plug
slave.pcm "aduplex"
}
Now for qjackctl
Under "Setup":
On the settings->Parameters tab:
I have alsa as my driver, 48000 as the sample rate, Frames/Period 512, Periods/Buffer 6, but you might want different settings depending on lag/crackles
Midi driver I have at: seq
On the Options tab:
Execute script after Startup: ~/scripts/loop2jack.sh (that's my script location)
loop2jack.sh:
Code:
#!/bin/sh
# loop client creation
/usr/bin/alsa_out -j ploop -dploop -q 1 2>&1 1> /dev/null &
/usr/bin/alsa_in -j cloop -dcloop -q 1 2>&1 1> /dev/null &
# give it some time before connecting to system ports
sleep 1
# cloop ports -> jack output ports
jack_connect cloop:capture_1 system:playback_1
jack_connect cloop:capture_2 system:playback_2
For general JACK input/output node management, I use "patchage", but you can also use qjackctls patchbay, in fact, I use that too to permanently/automatically do some connections.
This whole shebang should give you a running JACK audio system that also deals with ALSA pretty much transparently, if you don't hear anything, its probably because some output is not connected to the "system: playback" one, but at least the alsa ones should work since the loop2jackscript connects them.
(Remove the whitespace between : and p, hufffff, I'm too dumb to escape this bugger)
Now, for pulseaudio:
I simply use "apulse" from the sbo repo and, I think this is the default, in the slackbuild of it, set it to install itself at a non path location.
This means that any pulse application needs "apulse" in front of it.
For example, I use the opentoonz animation software and compile it a lot, too.
I let it use pulse audio, since I have it on my system (but not actually used), so to start opentoonz, I run (inside a script because I run it from my build directory, so the script also sets up LD_LIBRARY_PATH stuff, etc) "apulse OpenToonz"
or
apulse discord
or
apulse othersillyprogramthatexpectspulse
And since apulse is kind of a mock interface that routes things to alsa, you will hear things, hopefully.
Anyway, this combines the amazing disdain for pulse, the compatibility with alsa, and the flexibility of jack (so you can still have a lot of fun with audio shenanigans, like DAWs and processing nodes and so fort) into the most superlative linux audio experience.
In my opinion, anyway.
Last edited by Geist; 01-14-2020 at 09:56 PM.
Reason: that freaking smiley on system: playback, have whitespace you little expletive (slashes didn't escape it...)
In case of interest, here are my configurations for "PA installed (to keep packages as they are), but never running, instead using JACK with ALSA and qjackctl (both jack and qjackctl are in the sbopkg repo)"
there is a simpler way to run jack in slackware, instead of using the loopback device: use pulseaudio as a jack client!
Thanks, but I really don't want to run pulseaudio, even the normal mixer frustrated me. I 'learned' (well, cobbled together) my setup once and it worked ever since (with some tweaks to buffer lengths here and there, and later on adding some extra tools in the chain).
I can use alsamixer and co for the alsa parts, and jack for everything else. No need for the weird pulseaudio sinks and whatnot. It's mostly my ignorance on that part, but I'm just not willing to learn it, just to end up with a lesser wannabe JACK.
Alsa has more of a reason to be integrated like this because Alsa is more simpleminded. Pulse into Jack is like an almost duplication of functionality.
Anyway, maybe someone else will benefit from your setup.
Thank you, Geist. That is a BUNCHA work! Kudos. In fact that will be a substantial bit of work just for me to try that out, but I feel compelled to do so just to compare... I think. A lot depends on how soon the new Official Release comes out since my -Current install works perfectly with Pulse not installed at all and I prefer to keep things simple. There's just a few things in KDE that don't work on 14.2 like System Notifications but that seems a small sacrifice well worth it to have Pure ALSA.
While writing this immediately after reading your cool post I've just decided I am going to just clone my 14.2 on another partition so I don't have to undo it on my Main if anything "goes South" (ie: -I do use Discord regularly).
Simple answer - That does bug me but only a little bit. Firstly I only use discord for team communication in a single game and in my case, only to listen for team coordination and I dfon't have the Discord app installed. I use the browser version. As that article points out they can't be certain anything at all nefarious is going on, that they could just be monitoring for QOS.
If they are an offender they are small potatoes and I say that not as one of the clueless that thinks "What's the problem? I don't have anything to hide", when the problem is far larger. If I'm going to spend time fighting surveillance I'd rather spend it fighting the big battles like opposing the US Attorney General demanding backdoors into all encryption. That's not only really big and really offensive, that's really ignorant and stupid.
Thanks, I hope it will help, and yeah, the laundry list of stuff to do is why I thought a "no warranty" is warranted, hehe.
It's a PITA to juggle all those files, and slackpkg does indeed want to overwrite some of the files, like asound.conf and the modprobe one, etc, so, gotta watch those, but it does honestly work for me and at this point I have:
Several "HD Intel" 'cards', one oneboard soundcard (because my fancy card didn't survive the PC upgrade, it's pci only and this MB only has pci-e slots..), one usb cheapo card for my equally crappy mic since the onboard card had too much crackle.
And it all works.
I merely had to add an additional entry in my 'loop2jack.sh' script to setup a jack node for the usb card, and then I connect them to the 'ploop' node like zo:
Code:
/usr/bin/alsa_in -j usbmic -dhw:2 -q 1 2>&1 1> /dev/null &
# system microphone (RME analog input 3) to "ploop" ports
jack_connect usbmic:capture_1 ploop:playback_1
jack_connect usbmic:capture_1 ploop:playback_2
hw:2 happens to be the identifier or something for that usb thing.
All those 'HDA Intels" are a blight...at least for me because I don't use HDMI audio..
Anyway, good luck. I'll try to deliver some support if I can, too.
Also, discord DID work for me with apulse once (so, okay, I did use it before) but that was for giving someone a talked to tutorial and they didn't want mumble...
But then it stopped working after some update, either a discord one, or a system one, so yeah.
It may or may not work, no guarantee.
Oh, right, I just remembered one and a half hitches!
Sometimes some games with Linux ports don't have audio with this, it's very rare (although with as little gaming I do it might be more common, but I seriously doubt it...) but it happens.
In my case it was Darkest Dungeon.
The fix for that is to momentarily move the .asoundrc to something like .asoundrc_backup, kill jack, and start the game, it should have audio then.
Once done, move (or copy) the backup back to the .asoundrc, I suppose a symlink would be better in hindsight, hah.
But yeah this is the worst worst case scenario that happened to me, 'theoretically more awful things' work just fine, like this weird ass hacky Windows VST (virtual instrument) bridge wrapper thing that uses wine to somehow bridge sound from a windows only VST into jack...works perfectly, I use it to integrate a modeled piano VST into my Linux audio stuff.
Works a charm.
But now for the 'and a half' hitch.
Some games or applications may have sound that lags a bit, in that case, lower the buffer sizes in .asoundrc which I pointed out with comments.
This should also rarely happen, in fact it only happens for one game I'm making from scratch with SDL and SDL mixer, and, come to think of it, I might actually have fixed that from within code, so, maybe this hitch is only a quarter of one...
Anyway, this might all sound awful, but I'm seriously lazy and I wouldn't even suggest it if it were actually TOO much work, the scripts remained the same for ages for me, the only PITA is the initial setup and having to take care not to have slackpkg nuke the configs with its config prompts after an update.
Simple answer - That does bug me but only a little bit. Firstly I only use discord for team communication in a single game and in my case, only to listen for team coordination and I dfon't have the Discord app installed. I use the browser version. As that article points out they can't be certain anything at all nefarious is going on, that they could just be monitoring for QOS.
If they are an offender they are small potatoes and I say that not as one of the clueless that thinks "What's the problem? I don't have anything to hide", when the problem is far larger. If I'm going to spend time fighting surveillance I'd rather spend it fighting the big battles like opposing the US Attorney General demanding backdoors into all encryption. That's not only really big and really offensive, that's really ignorant and stupid.
I haven't actually done any research of my own, but I vaguely remember that the people behind Discord had a social networking app before discord and were sued for several violations of what was it, Californian or Floridian privacy laws, or something.
I wish I could remember it, and the video that also spoke about it seems to be missing from YT now...
Anyway, this might still count as small potatoes in the grand scheme of things, but if the things I've heard are true then the Discord people are not too trustworthy.
I don't know... pulse audio has transcended time in it's pulseaudacity.
Here is a fine art painting (a bit nsfw, though) that depicts a ripple through the past due to pulse. Click
The bloodied woman represents pulse audio.
The dagger represents the desire to remove pulse audio.
The bare breasts represent the allure of pulse.
The torch and the snake represent flame wars and systemD.
The almost naked man represents the desire to give almost anything to be rid of it.
The clasped ears represent the aftermath of "flat-volumes" being on, and Skype wanting his attention while he was listening to some lyre music on his audiophile setup at low volume.
Certainly seems like bigger potatoes to me than pulseaudio...
Naturally!... as it is a "use case" situation. If Pulse simply makes your casual listening easier in a multi sound card, one-size-fits-all environment effortless, then of course it appeals to you and doesn't have anything on the Cost side of any Cost/Benefit analysis. This is especially true if you have the common onboard sound chip and tiny dektop size speakers of 20 watts or so. If, OTOH, you have truly serious Hi Fidelity speakers that are an effort to lift just one, powered by hundreds of watts to bring out deep detail in a flat response environment and further commonly record or edit recorded music, then you might experience why some don't like Pulse and find the Cost side weighty indeed, and the Benefit side utterly lacking.
My posts about my hatred of Pulse should not be misconstrued to assume that I think it should not exist. I just would prefer that it was a simple choice rather than trying to remove "The Alien" from my face. I don't disregard that ALSA has some responsibility in this either, since someone could have recognized Linux's need for a "Conductor" and built on something like Jack with an acceptable, easy default to get there.
Reboot to make sure there are no running PulseAudio processes
Next # slackpkg update-all will replace each of your _alsa binaries with Pulse version. To avoid this open /etc/slackpkg/slackpkg.conf and find PRIORITY line:
Code:
PRIORITY=( patches %PKGMAIN extra pasture testing )
Swap %PKGMAIN and extra so that it looks like this:
Code:
PRIORITY=( patches extra %PKGMAIN pasture testing )
Now your updater will work correctly.
At this point you have gone pure ALSA, it is time to make it work properly.
You have to set correct default card, replace HDMI with PCH in my case (I have only two options).
Basically you just want to replace what does not work with what does.
Use aplay -l to list your devices:
As you can see 'card 0' is what I need. So I put the following in /etc/asound.conf:
Code:
# /etc/asound.conf
pcm.!default {
type hw
card 0
}
ctl.!default {
type hw
card 0
}
From now on your sound has to work, you can test it with mocp (this is default Slackware package).
Do not forget to rebuild third-party packages that you installed from SlackBuilds for instance.
This is mpv only in my case.
The problem is that different programs cannot play sounds simultaneously. If you watch a movie in a video player then you cannot pause it and play any kind of sound in a web browser or music via a music player without closing the video player. Or if you run Oracle VirtualBox, then you cannot play sounds on your host machine whatsoever.
You are going to face with something like this (this is mpv error):
Code:
[ao/alsa] Playback open error: Device or resource busy
dmix solves this and gives you equalizer.
You install this and this (dependency of the first package).
Add the following to your /etc/asound.conf:
Code:
# /etc/asound.conf
ctl.equal {
type equal;
}
pcm.plugequal {
type equal;
slave.pcm "plug:dmix";
}
pcm.!default {
type plug;
slave.pcm plugequal;
}
Use alsamixer -D equal to access equalizer.
Problem you may run into: remember we set default card in /etc/asound.conf? Their order may change at boot so that the card you need is not 0, 1 or whatever it is you have in your asound.conf anymore. In order to prevent this you can define ordering (I recommend doing this anyway).
According to what archlinux wiki tells, you have to find required card using cat /proc/asound/modules or lsmod | grep snd and set indexing explicitly in /etc/modprobe.d/alsa-base.conf (This configuration assumes you have one mia sound card using snd_mia and one (e.g. onboard) card using snd_hda_intel):
I have two sound cards, HDMI and PCH, indexing starts from 0. Therefore if I set HDMI to be 1, then PCH will be 0 because there are no cards anymore to take this place. Anyway I encourage you to peruse arch wiki and play with output you get using the above mentioned commands to find exactly what you need.
The last thing to cope with is that some applications may drop ALSA support, for example Firefox. In order to fix this, you just install apulse. It will make applications think they are using PulseAudio but they are actually not, they talk to ALSA. Of course we are going to keep it between us
--------------------------------------- Sources I used to write this comprehensive guide:
Thank you for all the hard work getting to this! I am with you and enorbet about pulseaudio. It's the disease that got away from the 'clean room' and infected everything and everybody. It gives zero ability to play nice with it - I akin it and systemd to the Nazi invasion of Poland: Germany - "You either give up and give in, or we stomp your little waste-of-air butts.", Poland - "Never!", <10 shots fired and 24 hours later, figuratively, but one can *almost* say literally>...Poland, suddenly a part of Germany - "What just happened?!".
ALSA was and is for those with discerning listening needs for thier music, etc. Pulse is just like the abortion systemd...trying to do it all at one time and failing at most of it, but since it seems to be easier, and humans are for the most part basically lazy and *will* take the easier route 9 times out of 10...
Anyway, thank you for the work on this. I'm going to try it on my liveslak as I don't have a spare drive to use and install current on for testing.
Thank you for all the hard work getting to this! I am with you and enorbet about pulseaudio. It's the disease that got away from the 'clean room' and infected everything and everybody. It gives zero ability to play nice with it - I akin it and systemd to the Nazi invasion of Poland: Germany - "You either give up and give in, or we stomp your little waste-of-air butts.", Poland - "Never!", <10 shots fired and 24 hours later, figuratively, but one can *almost* say literally>...Poland, suddenly a part of Germany - "What just happened?!".
ALSA was and is for those with discerning listening needs for thier music, etc. Pulse is just like the abortion systemd...trying to do it all at one time and failing at most of it, but since it seems to be easier, and humans are for the most part basically lazy and *will* take the easier route 9 times out of 10...
Anyway, thank you for the work on this. I'm going to try it on my liveslak as I don't have a spare drive to use and install current on for testing.
"As an online discussion grows longer, the probability of a comparison involving Nazis or Hitler approaches 1" -Godwin's Law
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.