LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   [Solved] USB Speaker (https://www.linuxquestions.org/questions/slackware-14/%5Bsolved%5D-usb-speaker-4175430423/)

688a 10-04-2012 01:32 AM

[Solved] USB Speaker
 
Hi there.

I have a Logitech USB speacker connected to my laptop. Trying to make it work, I searched the similar questions here.

I've found some threads and answer was to user alsamixer.

My question is, I can see my speaker in alsamixer by pressing F6. But how to make it work? The sound is coming from my laptop's speaker. Funny thing is I can control the volume by my Logitech speacker, but sound never comes out from it! How to make the usb speaker the master?

Thank guys.

zhjim 10-04-2012 01:43 AM

Not sure which distro your running. But with debian and only using alsa (pulseaudio never did what it ought to) I can get another sound card going by setting up a local .asoundrc file. One could also do it system wide but that would need root privileges each time I change my sound setup.

Heres my .asoundrc which goes into your home directory
Code:

#defaults.ctl.card 2
#defaults.pcm.card 2
#defaults.timer.card 2

All lines are commented cause I right now don't have another soundcard inserted. To see your soundcards and numbers see /proc/asound/cards.
Just be aware that when you change your sound setup and .asoundrc accordingly you have to restart the program you want to use the new setting with.

688a 10-04-2012 09:50 PM

Quote:

Originally Posted by zhjim (Post 4796729)
Not sure which distro your running. But with debian and only using alsa (pulseaudio never did what it ought to) I can get another sound card going by setting up a local .asoundrc file. One could also do it system wide but that would need root privileges each time I change my sound setup.

Heres my .asoundrc which goes into your home directory
Code:

#defaults.ctl.card 2
#defaults.pcm.card 2
#defaults.timer.card 2

All lines are commented cause I right now don't have another soundcard inserted. To see your soundcards and numbers see /proc/asound/cards.
Just be aware that when you change your sound setup and .asoundrc accordingly you have to restart the program you want to use the new setting with.

Thx zhjim. My machine is running Slackware 14.
I can see my speaker in /proc/asound/cards, but I can't find the conf file .asoundrc! would it be in a different file name?

zhjim 10-05-2012 01:40 AM

You have to create it if its not there. As far as I recall mine wasn't there either. Just fire up your favorite editor and create it.
Mind the . (dot) at the start of the file

Code:

$ vi /home/$(id -un)/.asoundrc

chrisretusn 10-05-2012 06:35 PM

I have a Logitech Z205 my solution is to place the following in /etc/asound.conf. I used that instead of ~/.asoundrc because I wanted it as a global change since I have more than one user account on this laptop.

Code:

# Force USB speaker to default
pcm.!default {
type hw
card Z205
}

ctl.!default {
type hw
card Z205
}

I used Z205 in the above because I also have a Web Cam with a microphone, they does always take the same card.

You can get the information you need to use with "aplay -l".

This is the output on my system
Code:

bash-4.2$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC861-VD Analog [ALC861-VD Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Z205 [ Logitech Z205], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Output of arecord -l showing card assigment for web cam mic
Code:

bash-4.2$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC861-VD Analog [ALC861-VD Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: USB20Camera [USB2.0_Camera], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

The USB speaker takes card 1 because I plugged it in after booting before my web cam. If the devices are left in on a reboot or turn on, the web cam takes card 1, the Z205 takes card 2.

688a 10-06-2012 11:28 AM

Quote:

Originally Posted by zhjim (Post 4796729)
Not sure which distro your running. But with debian and only using alsa (pulseaudio never did what it ought to) I can get another sound card going by setting up a local .asoundrc file. One could also do it system wide but that would need root privileges each time I change my sound setup.

Heres my .asoundrc which goes into your home directory
Code:

#defaults.ctl.card 2
#defaults.pcm.card 2
#defaults.timer.card 2

...

Quote:

Originally Posted by chrisretusn (Post 4798432)
I have a Logitech Z205 my solution is to place the following in /etc/asound.conf. I used that instead of ~/.asoundrc because I wanted it as a global change since I have more than one user account on this laptop.

Code:

# Force USB speaker to default
pcm.!default {
type hw
card Z205
}

ctl.!default {
type hw
card Z205
}

I used Z205 in the above because I also have a Web Cam with a microphone, they does always take the same card.

You can get the information you need to use with "aplay -l".
....



Hi both there.

I've tried to add both files in my machine:

Quote:

defaults.ctl.card 1
defaults.pcm.card 1
defaults.timer.card 1
/home/dww/.asoundrc lines 1-3/3 (END)
Quote:

pcm.!default {
type hw
card Z205
}
ctl.!default {
type hw
card Z205
}
/etc/asound.conf lines 1-8/8 (END)
Still my Z205 (Oh... I've a Z205 too :)) is not working either! Here is the output of aplay in my computer! Should I not have both files at the same time? I'm kinda giving up...

Quote:

dww@r380:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 0: ALC663 Analog [ALC663 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Z205 [ Logitech Z205], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
dww@r380:~$

chrisretusn 10-06-2012 02:28 PM

What is the output of:

aplay -v /usr/share/sounds/pop.wav

-or-

aplay -v /usr/share/sounds/alsa/Noise.wav

Also aplay -L

zhjim 10-07-2012 12:11 PM

I would use only one of the files. Did not look it up but on the corner of mind there is a info that .asoundrc takes precedence over /etc/asound.conf if both files exists. Also in your .asoundrc I would use the number 2. Dunno why but I'd say as you have three cards listed counting up from zero up makes your Z205 number 2. (Also its written as "card 1"). Or just use the name of the card like you have in your asound.conf.

Just make .asoundrc and asound.conf look the same. Use chrises example. As you both have the same gear it should get you going.

chrisretusn 10-07-2012 09:29 PM

Yes .asoundrc does take precedence over asound.conf as it loads on user log in. You normally would only use one or the other, not both. I use asound.conf because I have more than one user account on this laptop and I'd rather do it system wide rather than by user.

688a 10-08-2012 07:26 AM

Thx guys. It is working now. :cool:


All times are GMT -5. The time now is 03:43 AM.