Manjaro Difference between revisions of "ALSA"

Difference between revisions of "ALSA"

From Manjaro
imported>Handy
(Improve translation tags.)
 
(11 intermediate revisions by 4 users not shown)
Line 1: Line 1:
=Who's this page for=
<languages/>
__TOC__
<translate>
==Overview== <!--T:1-->
The [https://www.alsa-project.org/wiki/Main_Page Advanced Linux Sound Architecture (ALSA)] provides audio and MIDI functionality to the Linux operating system.


This page is for those of us that for whatever reason prefer not to have PulseAudio on our systems - or - have to remove PA & use the underlying kernel's native ALSA sound to be able to get working sound on our systems.  
==Use ALSA on with Applications requiring PulseAudio== <!--T:2-->
<br clear="all"/>
Using applications which require PuleAudio on systems which only have ALSA installed can be accomplished through the use of '''apulse''' which is a pulse emulator for ALSA.
==Some applications are being created to use PulseAudio only==


Due to this PA only situation (which I expect to only get worse), it can be a real pain when we want to use such an application on our ALSA only systems.
===Install apulse=== <!--T:3-->
Install '''apulse''' from the [[Arch_User_Repository|AUR]] using a your preferred package manager or the command:
{{UserCmd|command=pamac build apulse}}


Many of us may have found this out since Firefox version 52.+. has gone PulseAudio only with apparently no chance of that changing in the future.
<!--T:4-->
<br clear="all"/>
It is built from source so it may take some time to install. Once it is done, create a basic config file using the command:
==Fortunately there is a way around this problem that is pleasingly simple==
{{UserCmd|command=cp /usr/share/apulse/asoundrc.sample ~/.asoundrc}}


Install '''apulse''' from the AUR. Apulse has only 2 dependencies - '''alsa-lib''' & '''glib2''' , & is also only 141KB in size.
===Using apulse=== <!--T:5-->
Using apulse is a simple typing '''apulse <program>''' in a terminal. For example:
{{UserCmd|command=apulse /usr/lib/firefox/firefox}}


When installed via the terminal you will see the following:
<!--T:6-->
If all is working, you should now have sound in Firefox without needing pulseaudio


For using PulseAudio emulation (ex. in skype):
==Selecting the Primary Audio Device== <!--T:7-->
If your system keeps on using the wrong device (HDMI instead of PCH or vica versa for example), you can force ALSA to use the correct device.  Start by getting a list of your audio devices with the command:
1. create a proper .asoundrc
{{UserCmd|command=cat /proc/asound/cards}}
  $ cp /usr/share/apulse/asoundrc.sample ~/.asoundrc
2. run apulse <program-name> [parameters]
  $ apulse skype
So once you have used the command in no '''1.''' above ''(you don't have to edit anything, just do the copy)'' you can test apulse by entering a command that will call your PulseAudio only application, & test its sound as seen in '''2.''' above using skype as an example.


I did the following, as I have manually installed Firefox(ESR) on my system. So, due to my running Openbox, I entered the following in OBMenu, to add a call for Firefox to the Openbox menu that would call Firefox & use apulse to emulate PulseAudio sound & therefore give me sound in Firefox:
<!--T:8-->
Note the number of the sound device that you want to make the primary. Then using a [[Viewing_and_editing_configuration_files|text editor]], put the following into '''/etc/asound.conf''' (You may need to create '''/etc/asound.conf''' if it doesn't already exist).</translate>
{{UserCmd|command=sudo nano /etc/asound.conf}}


apulse /opt/firefox/firefox-bin
<!--T:9-->
{{File||file=/etc/asound.conf|
content=<pre>defaults.pcm.card 1
defaults.ctl.card 1</pre>}}
<translate>
<!--T:10-->
Replace 1 in the above example with the number you noted down above.


Then I loaded the Steam web page & had it play one of the game videos. When I did this I had sound, & I was/am VERY happy about that, as I am one of those who would personally rather not have PulseAudio installed on my machines.
==See also== <!--T:11-->
 
* [https://github.com/i-rinat/apulse The official apulse site]
Enjoy!
* [https://forum.manjaro.org/t/how-to-run-pulseaudio-only-apps-on-an-alsa-only-system/34235 apulse Forum Topic]
<br clear="all"/>
</translate>
=Support=
[[Category:Contents Page{{#translation:}}]]
 
[[Category:Audio{{#translation:}}]]
Following is a link to this page's forum counterpart where you
can post any related feedback: [https://forum.manjaro.org/index.php?topic=4808.0]
 
<br clear="all"/>
[[Category:Contents Page]]

Latest revision as of 12:13, 22 May 2024

Other languages:
English • ‎Türkçe • ‎русский • ‎فارسی

Overview

The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI functionality to the Linux operating system.

Use ALSA on with Applications requiring PulseAudio

Using applications which require PuleAudio on systems which only have ALSA installed can be accomplished through the use of apulse which is a pulse emulator for ALSA.

Install apulse

Install apulse from the AUR using a your preferred package manager or the command:

user $ pamac build apulse COPY TO CLIPBOARD


It is built from source so it may take some time to install. Once it is done, create a basic config file using the command:

user $ cp /usr/share/apulse/asoundrc.sample ~/.asoundrc COPY TO CLIPBOARD


Using apulse

Using apulse is a simple typing apulse <program> in a terminal. For example:

user $ apulse /usr/lib/firefox/firefox COPY TO CLIPBOARD


If all is working, you should now have sound in Firefox without needing pulseaudio

Selecting the Primary Audio Device

If your system keeps on using the wrong device (HDMI instead of PCH or vica versa for example), you can force ALSA to use the correct device. Start by getting a list of your audio devices with the command:

user $ cat /proc/asound/cards COPY TO CLIPBOARD


Note the number of the sound device that you want to make the primary. Then using a text editor, put the following into /etc/asound.conf (You may need to create /etc/asound.conf if it doesn't already exist).

user $ sudo nano /etc/asound.conf COPY TO CLIPBOARD


/etc/asound.conf
defaults.pcm.card 1
defaults.ctl.card 1

Replace 1 in the above example with the number you noted down above.

See also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.