2

Problem:

I don't hear anything on my sound system when playing audio.

Question:

What is the minimal set of programs required to play something on my machines audio jack or S/PDIF output?

How did I get there?

My system is an up-to-date Debian Stretch system which got created with debootstrap. The system is an Intel NUC5CPYH which is said to have an Intel Braswell chipset.

I ran

apt-get install --no-install-recommends sox libsox-fmt-all

to install the sox audio player. When I tried to play a file, I got

ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
play FAIL formats: can't open output file `default': snd_pcm_open error: No such file or directory

so, after looking at the dependencies of sox and libsox-fmt-all, I ran

apt-get install libsndio6.1 pulseaudio

Now the output of sox seems that it is playing a file fine when asked to do so, except that I don't get any sound output on my sound system. (The sound system is set-up fine.)

Edit #1

The output of cat /proc/asound/cards is

 0 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0x81414000 irq 313

Edit #2

The output of aplay -l is

aplay: device_list:270: no soundcards found...

Solution

I made it work. Now I can say that there were two problems:

  1. My user did not have sufficient rights to access the sound device. (This answer to another question told me that.)
  2. My sound device was muted. (I marked the answer which told me that as "correct")

So, all in all, the steps I had to take were

  1. apt-get install --no-install-recommends sox libsox-fmt-all alsa-utils
  2. Add myself to the audio group: usermod --append --groups audio <username>
  3. Change the alsa volume: alsamixer
  4. Play the song with sox: play <filename>
  • 1
    What's the output of cat /proc/asound/cards ? (Please edit your question to include the answer — don't paste it as a comment, the formatting won't work in a comment.) – derobert Jan 23 '18 at 22:25
  • @derobert: I put the output of that command into the question! – Multisync Jan 24 '18 at 12:35
  • 1
    Just to confirm you do have libasound2 and libasound2-data installed? (I'm pretty sure you do, due to dependencies, but just in case...) – derobert Jan 24 '18 at 17:15
2

Have you checked the volume settings? The system defaults were chosen to be quiet or outright muted because people were annoyed with getting blasted by full-volume sound output on new, unconfigured systems.

Since /proc/asound/cards indicates that the name of your chipset-integrated soundcard is "PCH", try this (install alsamixer first if necessary):

alsamixer -c PCH

This should open up a text-based sound mixer with several sliders: use arrow keys to manipulate them. The M key will toggle the "mute" setting on channels that have them.

The slider labeled "PCM" needs to be at full to get normal sound output: the "Master" slider is the one one to use to adjust the overall volume level. If you find channels whose name includs S/PDIF, you may need to toggle their mute status to get S/PDIF output.

Once you've found good default settings, run alsactl store as root to save the settings as new system defaults.

Your desktop environment may also store your audio settings from one session to another, but setting good system-wide default volumes never hurts.

1

Installing PulseAudio on a system without it where sound already doesn't work isn't likely to solve many problems. Additionally, if Pulse were actually required by sox, it would have been automatically installed alongside sox.

PulseAudio routes sound through ALSA, which controls sound hardware on most systems, and ALSA can't detect any sound hardware or is misconfigured for it, so you have deeper issues than installing pulse would fix. Pulse is allowing the app to start and run, but has no devices (if my interpretation of the issue is correct) that it can find to output audio to, so you get no sound.

I would first uninstall PulseAudio for the time being (install it once sound is working if you want it).

Then, check if you have OSS (another sound system) running on your machine. If it is, it will prevent ALSA from interfacing with audio hardware properly. If it is, and you don't use OSS, remove that. The package name on my Debian (sid) installation is oss4-base.

With all of that removed, reboot the computer if you can, although it probably won't matter unless OSS was installed.

Then, run aplay -l (part of the alsa-utils package) and see what it outputs. On my computer, it outputs:

**** List of PLAYBACK Hardware Devices ****
card 0: MID [HDA Intel MID], device 0: CX20585 Analog [CX20585 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: MID [HDA Intel MID], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

If you don't get any devices listed, you've still got problems I have no idea how to approach fixing without more information.

  • I didn't get any devices listed, but that was due to permission problems I found out. aplay -l didn't find my sound device, while sudo aplay -l did. – Multisync Jan 24 '18 at 22:21
  • 1
    @Multisync add your user to the audio group (e.g., sudo adduser YOUR-USER-NAME audio). Then after logout/login it should work w/o sudo – derobert Jan 25 '18 at 17:48
  • that means that it's likely what @derobert said, and it's simply a permsissions error rather than a pulse dependency. Did you get this solved? – Wyatt8740 Jan 26 '18 at 21:29
0

On my system, I find that pulseaudio often disables the only actual working audio output. This is a bug in pulseaudio, but I haven't looked in enough detail as to what the actual bug is, so I've been ignoring it for the most part.

The way I do get sound is by starting alsamixer, a CLI tool to manage ALSA volume levels, then hit 'F6' to choose the actual ALSA audio card rather than the broken virtual pulseaudio one, and then enable the speaker mixer and bring its volume up from zero.

  • Pulseaudio doesn't "disable the only actual working output". Many ALSA hw outputs can only be used by a single client (this is why you need dmix in ALSA), and if Pulseaudio is running, Pulseaudio is this single client. Which means any other client can't use them, except through Pulseaudio. So if anything, this is an ALSA "bug" (though it's by design). The idea to start debugging by stopping Pulseaudio and checking the alsamixer settings is very valid, though. – dirkt Jan 24 '18 at 19:51
  • When I say "disables the only actual working output", I mean it mutes the "speaker" output and sets its volume level to 0% (zero, nada). How is that not "disabling" it? This has nothing to do with mixing. – Wouter Verhelst Jan 25 '18 at 17:20
  • Huh? The only time I've seen this happening is when it switches from speakers to headphones. Which is easy to fix by switching back to speakers :-). And no, muting something is not disabling it. Opening something exclusively "disables" it for every other application. – dirkt Jan 25 '18 at 17:22
  • That's just a matter of terminology... muting something, for all intents and purposes, disables any sound coming out of it. – Wouter Verhelst Jan 25 '18 at 17:23
  • Muting speakers and headphones in turn (which ALSA also does, though it uses different code) is completely different from making it impossible for other applications to use the sound output. I don't care how you call it, but please don't use confusing terminology for it, because it makes it hard for other people to understand what you are talking about. And if on your system Pulseaudio on startup mutes the speaker, which seems to be specific for your system, find out the problem and fix it. OTOH, it's impossible to fix the problem of exclusive grab of ALSA devices. – dirkt Jan 26 '18 at 5:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.