Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] Could not open playback device 'default'
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
disperato
Tux's lil' helper
Tux's lil' helper


Joined: 27 Apr 2004
Posts: 120

PostPosted: Wed Apr 18, 2012 1:12 am    Post subject: [solved] Could not open playback device 'default' Reply with quote

Using mplayer...
I'm at loss as to why I get these errors (whatever user I'm playing, root too, and my user is in audio group):

Code:
Playing Amy_Winehouse_-_Will_You_Still_Love_Me_Tomorrow.mp3.
Audio only file format detected.
Clip info:
 Title: Will You Still Love Me Tomorro
 Artist: Amy Winehouse
 Album: Album
 Year:
 Comment:                             
 Track: 15
 Genre: Other
Load subtitles in /download/music/
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
[AO_ALSA] Playback open error: No such file or directory
[JACK] cannot open server
[AO SDL] Samplerate: 44100Hz Channels: Stereo Format s16le
[AO SDL] Unable to open audio: No available audio device
AL lib: alsa.c:512: Could not open playback device 'default': No such file or directory
AO: [openal] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A:  27.0 (26.9) of 212.0 (03:32.0)  0.4%


mplayer works, but I'd like to track down where on hell programs using alsa are looking for that "default" device and where I can set the full path to it.
In /dev I only have a directory related to sound (no dsp, or other sound devices) and it lists:

Code:
drwxr-xr-x  2 root root       60 Apr 17 18:14 by-path
crw-rw----+ 1 root audio 116,  5 Apr 17 18:14 controlC0
crw-rw----+ 1 root audio 116,  4 Apr 18 02:47 pcmC0D0c
crw-rw----+ 1 root audio 116,  3 Apr 18 02:47 pcmC0D0p
crw-rw----+ 1 root audio 116,  2 Apr 17 16:15 pcmC0D3p
crw-------  1 root root  116,  1 Apr 17 18:14 seq
crw-rw----+ 1 root audio 116, 33 Apr 17 18:14 timer

I'm having issues with audio in virtual machines (another post), and it's certainly due to alsa misconfiguration. Docs on alsa I've found on their webpage and on the internet do not point me in the right direction.
_________________
The free men's path is always obstructed by mediocrity.


Last edited by disperato on Fri Apr 27, 2012 11:51 pm; edited 1 time in total
Back to top
View user's profile Send private message
shrike
Apprentice
Apprentice


Joined: 20 Feb 2004
Posts: 187
Location: Closer to home

PostPosted: Wed Apr 18, 2012 3:28 am    Post subject: Reply with quote

disperato,

ALSA sees 'card0' as it's 'default ' audio device in /proc/asound/. The 'default' card can set via the /etc/asound or ~/.asoundrc files, useful with more than one sound card.

In my case the analog device whose output terminates on the green 3.5mm jack on my box ss not 'card0', it is card2:

Code:


# grep Codec /proc/asound/card*/codec*
# /proc/asound/card1/codec#0:Codec: ATI R6xx HDMI
# /proc/asound/card2/codec#0:Codec: Realtek ALC892

# ls -l /proc/asound/
# dr-xr-xr-x 4 root root 0 Mar 25 15:03 card0
# dr-xr-xr-x 3 root root 0 Mar 25 15:03 card1
# dr-xr-xr-x 6 root root 0 Mar 25 15:03 card2
# -r--r--r-- 1 root root 0 Mar 25 15:03 cards
# -r--r--r-- 1 root root 0 Mar 25 15:03 devices
# lrwxrwxrwx 1 root root 5 Mar 25 15:03 Generic -> card1
# lrwxrwxrwx 1 root root 5 Mar 25 15:03 Generic_1 -> card2
# -r--r--r-- 1 root root 0 Mar 25 15:03 hwdep
# lrwxrwxrwx 1 root root 5 Mar 25 15:03 M2496 -> card0
# -r--r--r-- 1 root root 0 Mar 25 15:03 modules
# -r--r--r-- 1 root root 0 Mar 25 15:03 pcm
# dr-xr-xr-x 2 root root 0 Mar 25 15:03 seq
# -r--r--r-- 1 root root 0 Mar 25 15:03 timers
# -r--r--r-- 1 root root 0 Mar 25 15:03 version


pcm.!default {
    type hw
    card Generic_1

}
ctl.!default {
    type hw
    card Generic_1
}


With the above present in my user's home directory as the file .asoundrc the 'default' sound card is 'Generic_1'.

But with the error msg "[JACK] cannot open server" I wonder if mplayer is set to use 'jack' rather than ALSA as it's audio device. Not that you can't use Jack, you can..

In any case, run the grep and ls commands shown in the code above to get your bearings. And check if either /etc/asound or ~/.asoundrc are present.

I have no experience with VMs.

shrike
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Wed Apr 18, 2012 4:29 am    Post subject: Re: Could not open playback device 'default' Reply with quote

disperato wrote:
are looking for that "default" device

The pcm "default" is initially set in /usr/share/alsa/pcm/default.conf - as a matter of academic interest :)
Back to top
View user's profile Send private message
shrike
Apprentice
Apprentice


Joined: 20 Feb 2004
Posts: 187
Location: Closer to home

PostPosted: Wed Apr 18, 2012 4:42 am    Post subject: Reply with quote

PaulBredbury,

Good to know.

Thanks,

shrike
Back to top
View user's profile Send private message
disperato
Tux's lil' helper
Tux's lil' helper


Joined: 27 Apr 2004
Posts: 120

PostPosted: Fri Apr 27, 2012 11:50 pm    Post subject: Reply with quote

(works for me - for the inpatients, solution is in the last 15 lines)

Dear PaulBredbury and shrike, thank you for your help. I have looked at the files you suggest and it has helped to exclude configuration errors in them. Alarmed by that I tried to boot from the previous kernel I had several weeks ago.

I'm on 3.2.12, previous was 2.6.32-r24. Starting the laptop with the old kernel, I had no errors at all while using mplayer. Here is the significant output:
Code:
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...


When switched to 3.2.12 though, it yelded:
Code:
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
[AO_ALSA] Playback open error: No such file or directory
[JACK] cannot open server
[AO SDL] Samplerate: 44100Hz Channels: Stereo Format s16le
[AO SDL] Unable to open audio: No available audio device
AL lib: alsa.c:512: Could not open playback device 'default': No such file or directory
AO: [openal] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...


that means mplayer had fell back to openal (and played the song with good sound quality, but a bit limited volume range) given that alsa was not working for it (or should I say that was not working directly, due to the fact that openal must use either alsa or oss?). But oddly enough it was working with the 2.6.32-r24...

the suggestion by PaulBredbury, about alsa configuration making it prefer the jack device, made me check the .asoundrc file. I'm not an expert but from syntax it had been configured to juggle jack and speakers depending on the jack sensors response. I remembered that this file was shaped (after the usual lurking) at a time when the laptop was recent and jack sensing was a novelty and I switched from oss (pure) to alsa. Renaming the .asoundrc in root and user dirs, and restarting the daemon was useless though.

Then I tried the brute force method: as root, with 3.2.12 kernel loaded:

emerge --unmerge alsa-headers alsa-lib alsa-utils alsa-oss
cd
#backup:
mv /var/lib/alsa var_lib_alsa
emerge alsa-oss alsa-utils --keep-going --quiet-build
#this pulled in alsa-headers along with alsa-lib

and mplayer started working without errors, while playing better than before (reasonable volume response to settings).

As for the virtual machine, in the script that launches it, there was no more need of setting environment variables, while before I had to set the appropriate combination in the following:
#SDL_AUDIODRIVER=alsa
#AUDIODEV=hw
#QEMU_AUDIO_DRV=sdl
#QEMU_AUDIO_DRV=alsa
#QEMU_SDL_SAMPLES=2048

For this reason I'm tagging this thread as [solved] (works for me)
_________________
The free men's path is always obstructed by mediocrity.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum