LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   No sound from aplay/play is it card no.? (http://www.linuxquestions.org/questions/slackware-14/no-sound-from-aplay-play-is-it-card-no-4175481962/)

waddles 10-24-2013 02:53 AM

No sound from aplay/play is it card no.?
 
I am having problems with an application I wrote and verified under version 13.0.
I notice when I change cards from 0 to 2 I get an alsamixer display for my webcam(0), BTTV card, and a display, respectivel, like I am used to which allows alsactl to modify it. I have played with setting card 2 but both play and aplay give errors. The ALSA & aplay error is:
ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave
aplay: main:660: audio open error: No such file or directory
With play I get:
ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave
/usr/bin/play FAIL formats: can't open output file `default': snd_pcm_open error: No such file or directory

I am thinking that maybe it is trying to use a card other than card 2.
Could this be my problem or is it elsewhere?

aus9 10-24-2013 03:10 AM

Hi

it might help if you advise what sound device are you expecting to play sound from
--make and model

then post the output for these commands pls

Code:

aplay -l
aplay -L

hint, aplay normally uses card with index=0
normally a webcam has no output devices only and maybe a mic input

waddles 10-24-2013 03:50 AM

aplay -l:
**** List of PLAYBACK Hardware Devices ****
card 2: V8235 [VIA 8235], device 0: VIA 8235 [VIA 8235]
Subdevices: 4/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
card 2: V8235 [VIA 8235], device 1: VIA 8235 [VIA 8235]
Subdevices: 1/1
Subdevice #0: subdevice #0

aplay -L:
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=V8235
VIA 8235, VIA 8235
Default Audio Device
front:CARD=V8235,DEV=0
VIA 8235, VIA 8235
Front speakers
surround40:CARD=V8235,DEV=0
VIA 8235, VIA 8235
4.0 Surround output to Front and Rear speakers
surround41:CARD=V8235,DEV=0
VIA 8235, VIA 8235
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=V8235,DEV=0
VIA 8235, VIA 8235
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=V8235,DEV=0
VIA 8235, VIA 8235
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
iec958:CARD=V8235,DEV=0
VIA 8235, VIA 8235
IEC958 (S/PDIF) Digital Audio Output

Using a command to play a wave file from the installed product:
xlin=/usr/share/apps/kolf/sounds/blackholeeject.wav
/usr/bin/aplay "$xlin"

Here is what alsamixer sees:
┌───── Sound Card ──────┐
│- (default) │
│0 USB camera │
│1 Brooktree Bt878 │
│2 VIA 8235 │
│ enter device name...│
│───────────────────────┘
Excuse my editing of above.

aus9 10-25-2013 06:12 AM

ok no worries about editting

Firstly I am still assuming you want a playback device to have index=0?

There are 2 main ways of doing that

1) If slackware has it, edit with root powers your /etc/modprobe.d/alsa-base.conf file and either
specify options for your usb sound module to get index=1 or 2

2) create a .(dot)asoundrc file in your home folder to specify card 2 device 0


3) Have you already set up an asoundrc file in which case pls post the contents
or modify some alsa file---in which case pls post the contents
----The reason I ask is, normally usb sound devices get loaded later than any onboard devices etc

#####
do you agree that card2 is to be your target device?

As we are not mind readers, pls be blunt and tell us which device you want as the output device pls

##############

LEAPING AHEAD
I will assume you want usb device NOT to grab index=0

The easiest way to stop this is edit with root powers file
/etc/modprobe.d/alsa-base.conf and add this line pls

Quote:

options snd-usb-audio index=2
full reboot required to re-check

now you may also like to force the other card away from index=0 but you need to post your module for it pls

lsmod (and find the bt module as I don't have one)

google suggest it might be snd-bt87x in which case your next line would be

Quote:

options snd-bt87x index=1

waddles 10-26-2013 01:01 AM

Probably mislead U with reference to "other than card 2". I am a bit sensitive to this as I had to do an enormous fiddle under a previous version of Slackware as it would flip card references with bootup. So my question in #1 has to do with is it showing card 2 and somehow using another card.

So using card 2 is OK, which as U C is V8235 the onboard audio.

So that I am clear with references to "index", I presume when U said "playback device to have index=0?" that U R meaning CARD=V8235,DEV=0 (and that arrangement is OK). From my last paragraph, I am guessing Slack has made sound card "2 VIA 8235" as that is what alsamixer believes.

Slack does not use a /etc/modprobe.d/alsa-base.conf file. I am guessing U R refering to /etc/asound.conf which I think should be the AlSA configuration and looks like:
Code:

state.V8235 {
        control.1 {
                iface MIXER
                name 'Master Playback Switch'
                value true
                comment {
                        access 'read write'
                        type BOOLEAN
                        count 1
                }
        }        control.2 {
                iface MIXER
                name 'Master Playback Volume'
                value.0 23
                value.1 22
                comment {
                        access 'read write'
                        type INTEGER
                        count 2
                        range '0 - 31'
                        dbmin -4650
                        dbmax 0
                        dbvalue.0 -1200
                        dbvalue.1 -1350
                }
        }
        control.3 {
                iface MIXER
                name 'Center Playback Switch'
                value true
                comment {
                        access 'read write'
                        type BOOLEAN
                        count 1
                }
        }
        control.4 {
                iface MIXER
                name 'Center Playback Volume'
                value 31
                comment {
                        access 'read write'
                        type INTEGER
                        count 1
                        range '0 - 31'
                        dbmin -4650
                        dbmax 0
                        dbvalue.0 0
                }
        }
... "ad naseum"

Truncated for space.

And lastly there is NO .asoundrc" file anywhere, according to find.

Here is some info from /proc/asound/card2/pcm0p/info:
card: 2
device: 0
subdevice: 0
stream: PLAYBACK
id: VIA 8235
name: VIA 8235
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 4 <---pcm0c shows a 1
subdevices_avail: 4 <---pcm0c shows a 1

So it looks to me like it is playing fair with its designations.

ADDED LATER:
Just for drill, here is my /etc/modprobe.d/sound.conf file:
# --- BEGIN: Generated by ALSACONF, do not edit. ---
# --- ALSACONF version 1.0.24.2 ---
alias snd-card-0 snd-bt87x
alias sound-slot-0 snd-bt87x
# --- END: Generated by ALSACONF, do not edit. ---

Notice from message #3 that ALSA believes the bt87x card is card 1 not 0. If this is relevent, what is causing the card flipping?

Daedra 10-26-2013 01:28 AM

This is an old post but it might help you out. It sounds like you need to set your soundcards in the correct order, making your main soundcard index=0 so that its the first soundcard the system will use. See this post http://www.linuxquestions.org/questi...3/#post3485381

waddles 10-26-2013 02:33 AM

THANKS! Daedra. From what I just added to my last message it looks like U R correct.
I have just one sound card, I think, as it is onboard. I guess the webcam and TV card are the other 2 cards.
I am unsure of the enumerations but would this cause my system to implode(LOL) on itself:
alias snd-card-0 camera
alias sound-slot-0 camera
alias snd-card-1 Bt87x
alias sound-slot-0 Bt87x
alias snd-card-2 V8235
alias sound-slot-0 V8235
I got the id's & info from /proc/asound/x/pcm0c/sub0/info, where x= camera, Bt878, & V8235 but not sure id's shouldn't be Bt87x Digital and VIA 8235.

Daedra 10-26-2013 02:52 AM

You are basically correct except that the last part should be your module, not the name of your device. For instance my system has a Xonar and a webcam microphone, so I don't call my sound card

alias snd-card-0 xonar

I call it by its module, like so

alias snd-card-0 snd-virtuoso

I have never tried it any other way so I am not sure if the other way will work or not, but this is how I have always got it to work. From your post above it looks like you are on the right track.

Daedra 10-26-2013 02:55 AM

Also you can always blacklist the sound module your are not using if you are sure you don't need it. Like my video card's hdmi sound module will some times wreck havoc and take over slot 0 if i don't set my index's, its an easy enough fix but since I don't need it I just blacklist it and I never have to worry about it again.

aus9 10-26-2013 03:36 AM

waddles

Pls don't get excited by creating alias names until you resolve the big picture ok?
do NOT run alsaconf as its confused by index numbers until we fix
to keep it simple pls use root powers to delete ALL references to alias sound device lines

Your reference to /etc/asound.conf means the mixer levels run system-wide. (I am on debian which normally uses /var/lib/alsa/asound.state)
Use root powers to move it onto an usb stick ---as a backup in case I am wrong.

Now since Daedra and hangdog from the other post both confirm slackware uses /etc/modprobe.d/sound.conf
(amended due to reply 12 from allend, with thanks)
---ignore all previous posts and start anew then full reboot with new contents as follows

cat /etc/modprobe.d/sound.conf
Quote:

options snd-usb-audio index=2
options snd_bt87x index=1
Now we know you have only 3 sound devices so what we have done is force usb if its ever plugged in---to only be able to get index=2
ditto your tv card index=1
----what ever remains gets index=0

WOO HOO

so after using root powers to delete one file and edit one file
full reboot
upon reboot, as a local user run alsamixer

alsamixer without a card number MUST show you the mixer for your onboard sound device or I shall spank myself
we can then adjust the sound levels and save them with

Code:

sudo alsactl store
re-check that new mixer levels, system wide are created at /etc/asound.conf
if not pls report so
---we can always force a store at a independent location
eg
sudo alsactl -f /home/waddles/mysound.state store

Daedra 10-26-2013 03:45 AM

also waddles, you may have to create the file /etc/modprobe.d/sound if its not already there.

allend 10-26-2013 10:51 AM

I suggest you use the filename sound.conf as there has been a change in recent times that files in /etc/modprobe.d/ without the .conf suffix are ignored.

aus9 10-26-2013 06:22 PM

cheers I have amended by earlier post allend

waddles 10-26-2013 06:53 PM

@Daedra: 'scuse ignorance but where do I find the module name?
Is there a reason to want the audio on card 0 rather than where it is at card 2? The webcam and tv are not currently in use but will be soon.

@aus: I do not have an: /etc/asound.conf what I have there is /etc/asound.state (in #5 me bad, humble apologies).
Am I correct in presuming that Debian is using index= where Slack uses Card inside /etc/modprobe.d/sound.conf (that's what it is for sure)?
Now I notice that the current sound.conf shows a card & slot pairing. AND that bttv is set to card 0 and slot 0 so I am presuming that is the native order for ALL sound devices. I Didn't build that one, at least not intentionally.
Further, since sound.conf has bttv on card 0 but note in message #3 that alsamixer says it is on card 1.
Also /proc/asound/Bt878/pcm0c/info shows card 1 also.
So why are alsamixer and sound.conf different? This makes me wonder how much effect changing sound.conf can have? So are U ready for a spanking? I guess I am asking which of these is driving the car.

Daedra 10-26-2013 07:56 PM

"lsmod | grep snd" will give you a list of all installed sound modules. And as my understanding, you want your main sound card in index=0. Some programs will automatically look to your default sound for output and if that is for instance your webcam microphone it will not work, that is why you set the order in the /etc/modprobe.d/sound.conf file. I think there is more than one way around this problem but the advice you got above for allend, aus9, and myself is the preferred method. Just for an example this is my sound.conf file. Like I said I have a xonar D1 soundcard, Logitech Pro 9000 webcam, and my videocards hdmi sound module. Since I have no use for my videocard soundm, I blacklist the module which is snd-hda-intel. That now leaves me two sound cards. Once I know the name of the modules that represent my sound card I can set my order, snd-virtuoso is my xonar, and snd-usb-audio is my webcam microphone.

alias snd-card-0 snd-virtuoso
alias sound-slot-0 snd-virtuoso
options snd-virtuoso index=0
alias snd-card-1 snd-usb-audio
alias sound-slot-1 snd-usb-audio
options snd-usb-audio index=1

You should be able to do the exact same thing as long as you know what your snd modules are. B


All times are GMT -5. The time now is 06:40 PM.