LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   No sound from aplay/play is it card no.? (https://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

aus9 10-26-2013 11:01 PM

ok lets clear up what your sound modules are pls as per Daedra. so post your contents pls

Code:

lsmod | grep snd
in reply 4 I said I used google so won't berate myself there if the actual module name is snd-bt87 or something else

it looks like it might be called snd_bt87x

aus9 10-27-2013 03:50 AM

since no-one has replied OP must be asleep?

I shall attempt to correct my index syntax for possible tv card for /etc/modprobe.d/sound.conf

Quote:

options snd-usb-audio index=2
options snd_bt87x index=1
2)
Quote:

AND that bttv is set to card 0 and slot 0 so I am presuming that is the native order for ALL sound devices
since we agree your tv card is not your preferred output device, until you have a correctly working index=n config file,
we can not say too much.

but in terms of trouble shooting, I prefer we don't get excited by alias names.

waddles 10-27-2013 04:34 AM

I am feeling a little miffed at myself now. I saw "modules" and for whatever reason thought (obviously brain dead) that was something related to the hardware description (like a slot or whatever) talk about getting myself lost. Of course I DO know what a module is DAH! LOLFOF. Thanks!

Is /etc/asound.state the alsa configuration file?

Now if I got it right I will insert:
Code:

alias snd-card-0 snd_via82xx  #V8235 audio
alias sound-slot-0 snd_via82xx
options snd_via82xx index=0
alias snd-card-1 snd_bt87x    #Bt878 tv
alias sound-slot-0 snd_bt87x
options snd_bt87x index=1
alias snd-card-2 sn9c102      #camera webcam
alias sound-slot-0 sn9c102
options sn9c102 index=2

into /etc/modprobe.d/sound.conf
reboot
run alsamixer without a card designator
and all be happy.

waddles 10-27-2013 07:08 AM

Followed process outlined in last message but when I ran alsamixer without a card designator I still get the camera.
With -c 2 I get invalid card index: 2 & with -c1 get Bt878.
Was there a problem with the sound.conf file entries? I ran dmesg and saw:
[ 4.880085] cannot find the slot for index 0 (range 0-1), error: -16
[ 4.880206] VIA 82xx Audio: probe of 0000:00:11.5 failed with error -16
Was I supposed to runt alsactl init before reboot?

aus9 10-27-2013 09:19 AM

waddles

pls post the output of the lsmod grep command as requested in reply 15 & 16

Stop using alias bits for trouble shooting---- please please!

2) if alsamixer -c1 shows your tv card then either your index config file failed and the order gave index=0 to maybe another device
or this line="options snd_bt87x index=1" worked as expected.

3) why are your claiming your webcam is module sn9c102?
me thinks its snd-usb-audio

4) The trouble when people refuse to post the lsmod command is then I have to look at my own kernel config and
guess what you mean is snd_via82xx

could be wrong and its late

5)
Quote:

Was I supposed to runt alsactl init before reboot?
No you were supposed to use my config and not leap ahead

now that I think I know your module it looks like its going to be

Quote:

options snd-usb-audio index=2
options snd_bt87x index=1
Yep it has not changed! It may change if I could see your lsmod output.

If you really want to force it, add a line

options snd_via82xx index=0

6)
Quote:

Is /etc/asound.state
No its a system wide mixer level config file for the default sound device.
Alsa will use other mixer level config files as well.

Don't worry about mixer levels until we get your index right.


good nite Sir

waddles 10-27-2013 12:04 PM

In response to UR 1) & 4):
Code:

lsmod | grep snd
snd_seq_dummy          1119  0
snd_seq_oss            25900  0
snd_seq_midi_event      4696  1 snd_seq_oss
snd_seq                42680  5 snd_seq_dummy,snd_seq_oss,snd_seq_midi_event
snd_pcm_oss            34554  0
snd_mixer_oss          14726  1 snd_pcm_oss
snd_via82xx            17595  0
gameport                6861  1 snd_via82xx
snd_ac97_codec        90095  1 snd_via82xx
snd_bt87x              8213  0
snd_usb_audio          71686  0
ac97_bus                834  1 snd_ac97_codec
snd_hwdep              4772  1 snd_usb_audio
snd_mpu401_uart        5095  1 snd_via82xx
snd_usbmidi_lib        15681  1 snd_usb_audio
snd_pcm                59843  5 snd_pcm_oss,snd_via82xx,snd_ac97_codec,snd_bt87x,snd_usb_audio
snd_rawmidi            15638  2 snd_mpu401_uart,snd_usbmidi_lib
snd_seq_device          4505  4 snd_seq_dummy,snd_seq_oss,snd_seq,snd_rawmidi
snd_timer              15717  2 snd_seq,snd_pcm
snd                    43891  15 snd_seq_oss,snd_seq,snd_pcm_oss,snd_mixer_oss,snd_via82xx,snd_ac97_codec,snd_bt87x,snd_usb_audio,snd_hwdep,snd_mpu401_uart,snd_usbmidi_lib,snd_rawmidi,snd_pcm,snd_seq_device,snd_timer
snd_page_alloc          5925  3 snd_via82xx,snd_bt87x,snd_pcm
soundcore              4641  1 snd

In prior message /etc/modprobe.d/sound.conf had:
alias snd-card-0 snd-bt87x
alias sound-slot-0 snd-bt87x
Note bt878 was slot 0 so figured that is where it would be when I made it card 1 in message #18

/proc/asound/Bt878/pcm0c/info now shows Bt878 as card 1/dev 0
/proc/asound/camera/pcm0c/info shows camera as card 0/dev 0
/proc/asound/V8235/pcm0c/info shows no V8235

2) Doesn't -c1 in alsamixer point at card 1? and in both configs of sound.conf Bt878 has been on card 1 so I must be missing something as I don't see the problem.
3) because that is what the instructions for the camera had set out. I did notice that it did not appear in the lsmod|grep snd list. I thought it may have been snd_usb_audio or snd_hwdep.

5) My sound.conf file is now:
Code:

alias snd-card-0 snd_via82xx  #V8235 audio
alias sound-slot-0 snd_via82xx
options snd_via82xx index=0
alias snd-card-1 snd_bt87x    #Bt878 tv
alias sound-slot-0 snd_bt87x
options snd_bt87x index=1
alias snd-card-2 sn9c102      #camera webcam
alias sound-slot-0 sn9c102
options sn9c102 index=2

From what U say it looks like this file should be corrected for the wrong audio module. Sorry for dropping the lsmod list earlier. Will try to correct later as the sun is up and I forgot to sleep last night. Oh, and yes on the revised order.

GazL 10-27-2013 12:57 PM

Throw that sound.conf away and use this instead:
options snd slots=snd-via82xx,snd-bt87x,snd-usb-audio


All that alias and index= stuff just over-complicates things.

aus9 10-27-2013 08:22 PM

I wish someone would listen about trouble shooting

I am getting frustrated but I have sound so its your choice to ignore me

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

stop all configs for alias until we get your index sorted

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

2) Your lsmod shows that your onboard module is in fact snd_bt87x
but its codec comes from module snd_ac97_codec

3) That does not impact on your index vaules but lets move on
Quote:

In prior message /etc/modprobe.d/sound.conf had:
alias snd-card-0 snd-bt87x
alias sound-slot-0 snd-bt87x
this tells me, you do not understand anything about alias config
that may sound rude but is the MAIN reason why I continue to rant about you
not use alias in config

GRRRRR

that config line is trying to make a bad syntax snd-bt87x get index=0
no no no

notice your module name is snd_bt87x means understem not hypen

and we were trying to NOT make your tv card index=0 and you continue to try to thwart me.

GRRRRR

Please keep the world simple and allow alsa to to auto configure your onboard card to get index=0
by allowing all other devices forced onto other index values

lets try again shall we....and yes I know multiple people are giving you advice
but I am the expert here and I guarantee we will get it correct but obey me
--sorry if that sounds arrogant but sometimes the truth hurts!

################
FRESH START
###############

A) delete all /etc/asound* files if found
B) delete all home folder .asoundrc files if found
C) delete your current crappy sound.conf and start again
do these commands at your home folder as a local user pls

Code:

sudo rm -rf /etc/asound*
rm -rf .asound*
sudo rm -rf /etc/modprobe.d/sound.conf

sudo echo "options snd-usb-audio index=2
options snd_bt87x index=1
" > /etc/modprobe.d/sound.conf

D) full reboot

run alsamixer as a local user and press F6 report if order is now correct pls

card 0 via*
card 1 bt*
card 2 (may not show if not inserted) we don't care at this stage)

E) Once we have correct index, we can adjust mixer levels and save them

so assuming I am correct

Code:

sudo alsactl store

good luck

BTW I don't wish to annoy you any more than necessary so if you don't like me just say so
I can move on

waddles 10-27-2013 10:07 PM

Sorry to have upset.
In UR #23, 2) I agree with U on the module for TV card and that is what I have claimed consistently.
R U introducing a side topic when U brought up snd_ac97_codec?
What is the relevance?

3) I think U may have locked in on my #5 message where I had cut and pasted from the initial sound.conf where it was hyphenated.
Regarding index(ing), I asked in my #5 if index number was to be the same as
card number. I didn't see a response so presumed true after going back and l
ooking.
Trying again is index#=card#?

Under fresh start, A)-C) I will rename in lieu of removing just in case.
Promise to remove if all is well after reboot.

Could U summarize the reason(s) for use of index= and degredation of aliases from sound.conf?
My recall, dimmed by too many Oreos, has me locked to a degree on the aliases from the prior versions of HOW TO if I am correct. I may need to re-read if that is where the info is at.

Off to do D.
LATER...
Boot successful, alsamixer reported as promised, no related fail messages from dmesg, aplay functional.
NOT ANNOYED AT ALL!! You have been very very helpful. Will now alsactl store.
Awaiting UR responses to above so I can close this.

aus9 10-28-2013 12:02 AM

codec what is the relevance?
Its the software to assist in the playing of sound files

I will try to give you a link later or you could google it yourself but will shown mine as example

Quote:

snd 54848 8 snd_hwdep,snd_timer,snd_hda_codec_idt,snd_pcm,snd_seq,snd_hda_codec,snd_hda_intel,snd_seq_device
this can be simplified to say we need a hardware kernel module and we need a software module for the codec.
Actually there are a number of hardware modules in that box and 2 codecs.

2) I assume your sound is now good so have you retested your command in your first post?

3) ahhh now index is kind of the same as card numbers but not the same
thats easy ?

Let me explain further, you can force a device to have an index of say 4 or -1 but alsa counts devices from zero
so keep the world simple. so in my configs yes index is always card number

but other people can force away from true count of devices.

b) now plug in your webcam if its on an usb lead and ensure its index or card number is 2

solve it anytime as I sometimes search for my posts and thanks for confidence in my
;)

waddles 10-28-2013 12:24 AM

Appreciate U sticking with me as U did. I am sure U also have the synapse jumps like myself where the begin and end are well known but the middle has gotten frayed. Its like typing and fumble fingering.

Still marveling at use of indexing so wondering what the hey alias is for?

aus9 10-28-2013 05:37 AM

Can you now marked this as solved as your other questions are trivial
and I am not here to spoon feed you even if I admit to making mittakesss

https://www.kernel.org/doc/Documentation/sound/alsa/
has some nice stuff I am sure you will spot

http://alsa.opensrc.org/Asoundrc
Is one of the main uses of alias

I know you know that I know you know what an alias so more
crudely if my name is
johnnyrottenappleatdusk but I call myself dusky which would you prefer
to put into an asoundrc file?

good bye and good luck


All times are GMT -5. The time now is 04:08 AM.