You are not logged in.

#1 2018-04-28 00:03:21

edoelas
Member
Registered: 2018-04-27
Posts: 56

[SOLVED] Alsa only plays one audio simultaneously

The problem explained below has been solved thanks to V1del. The solution is at the end of this post.

I'm using alsa and I don't know why I can only play one audio simultaneously. I will explain some cases that cause me problems:
- I can play a youtube video but when I open a second one it stays frozen in the second 0.
- Firefox the sound simply doesn't work.
- I can open two instances of mpv Media Player in order to watch an .mp4 file, but the second one doesn't have audio.
- If I'm playing another audio in the system mpv won't open .mp3 files
- Telegram desktop doesn't do anything when I pres the play button on a video while another audio is being played in the system.
- If I'm watching a youtube video in one tab and I open another, in order to be able to start the video I have to pause the first one, wait a few seconds and refresh the page.

I'm not sure which information I should provide in order to be helped but there is the output of some commands that I have seen similar threads.

  • aplay -l

    **** List of PLAYBACK Hardware Devices ****
    card 0: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: HDMI [HDA Intel HDMI], device 8: HDMI 2 [HDMI 2]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: HDMI [HDA Intel HDMI], device 9: HDMI 3 [HDMI 3]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: HDMI [HDA Intel HDMI], device 10: HDMI 4 [HDMI 4]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 1: PCH [HDA Intel PCH], device 0: ALC283 Analog [ALC283 Analog]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
  • cat .asoundrc

    pcm.!default {
        type hw
        card PCH
    }
    
    ctl.!default {
        type hw           
        card PCH
    }

    This file has been modified, see EDIT 1

  • cat /etc/asound.conf
    (there is nothing in this file)

  • speaker-test (with no other audio being played)

    speaker-test 1.1.6
    
    Playback device is default
    Stream parameters are 48000Hz, S16_LE, 1 channels
    Using 16 octaves of pink noise
    Channels count (1) not available for playbacks: Invalid argument
    Setting of hwparams failed: Invalid argument
  • speaker-test (with other audio being played)

    speaker-test 1.1.6
    
    Playback device is default
    Stream parameters are 48000Hz, S16_LE, 1 channels
    Using 16 octaves of pink noise
    Playback open error: -16,Device or resource busy
  • lsmod | grep snd

    snd_hda_codec_hdmi     57344  1
    snd_hda_codec_realtek   110592  1
    snd_hda_codec_generic    86016  1 snd_hda_codec_realtek
    snd_hda_intel          45056  0
    snd_hda_codec         151552  4 snd_hda_intel,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_codec_realtek
    snd_hda_core           94208  5 snd_hda_intel,snd_hda_codec,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_codec_realtek
    snd_hwdep              20480  1 snd_hda_codec
    snd_pcm               135168  4 snd_hda_intel,snd_hda_codec,snd_hda_core,snd_hda_codec_hdmi
    snd_timer              36864  1 snd_pcm
    snd                    98304  8 snd_hda_intel,snd_hwdep,snd_hda_codec,snd_timer,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_codec_realtek,snd_pcm
    soundcore              16384  1 snd
  • cat /proc/asound/cards

     0 [HDMI           ]: HDA-Intel - HDA Intel HDMI
                          HDA Intel HDMI at 0xc4210000 irq 54
     1 [PCH            ]: HDA-Intel - HDA Intel PCH
                          HDA Intel PCH at 0xc4214000 irq 51

SOLUTION:
After deleting ~/.asoundrc I edited /etc/asound.conf adding these lines:

defaults.pcm.!card "PCH";
defaults.ctl.!card "PCH";

And now the sound works perfectly.

See https://bbs.archlinux.org/viewtopic.php … 2#p1782232

EDIT 1:
The .asoundrc file has been modified due to the advice of V1del and now does not contain anything. Now I have no sound in browsers or MPV but I can hear strange noises when aplay -D default:PCH exampleName.


(If there is any problem with my English that difficults the understanding let me know in order to improve it)

Last edited by edoelas (2019-02-17 11:45:31)

Offline

#2 2018-04-28 01:29:20

Omar007
Member
Registered: 2015-04-09
Posts: 368

Re: [SOLVED] Alsa only plays one audio simultaneously

My best guess is that your hardware doesn't support hardware mixing. In which case, either set up dmix or use PulseAudio.

Offline

#3 2018-04-28 09:21:52

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,435

Re: [SOLVED] Alsa only plays one audio simultaneously

Note the red warning box above the instruction you followed to set your PCH card to default.

Alternatives are properly defining the order in modprobe.d or using

defaults.pcm.!card "PCH"
defaults.ctl.!card "PCH"

or doing a more "complicated" setup like Omar linked to where you manually set up the dmix definitions·

Last edited by V1del (2018-04-28 10:49:10)

Offline

#4 2018-04-28 10:25:39

edoelas
Member
Registered: 2018-04-27
Posts: 56

Re: [SOLVED] Alsa only plays one audio simultaneously

I have deleted the content of .asoundrc in order to avoid problems with this, but I'm not sure where I should have to include that lines.
I also have edited the first post explaining what I have changed and which have been the results.
Thanks.

I have found the file where should add the lines (the ones told by V1del) on this page ALSA project: Setting the default device and it works pefect now. Thanks V1del, I will post the solution in the first post.

Last edited by edoelas (2018-04-28 10:36:36)

Offline

#5 2018-04-28 10:42:44

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,435

Re: [SOLVED] Alsa only plays one audio simultaneously

You could've just used them in your .asoundrc instead of the ones you have. /etc/asound.conf and ~/.asoundrc are always interchangeable. One is only parsed for your own user and the other is more global.

However glad to hear, while you adjust the first post to add a solution, don't forget to edit the title so that it includes [SOLVED]  or similar.

Last edited by V1del (2018-04-28 10:49:53)

Offline

Board footer

Powered by FluxBB