Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Dmix - this time I want it to work
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
melange
Tux's lil' helper
Tux's lil' helper


Joined: 16 Sep 2004
Posts: 110

PostPosted: Thu Dec 23, 2004 10:57 pm    Post subject: Dmix - this time I want it to work Reply with quote

after over a month of searching and (obviously) no succes I hope that you guys can help me :)

To make a long story short:

*I have a ASUS a7n8x-x motherboard whit onboard soundcard (nforce2).
*I want to be able to play multiple sounds simultaneously
*I read (most of) this thread (https://forums.gentoo.org/viewtopic.php?t=122076) - but it didn't help :(

here's what I've done:

*Updated alsa
Code:

arvid@becky arvid $ qpkg -I -v | grep alsa
media-libs/alsa-oss-1.0.7 *
media-libs/alsa-lib-1.0.7 *
media-sound/alsa-headers-1.0.7 *
media-sound/alsa-utils-1.0.6 *
media-sound/alsaplayer-0.99.76 *
media-plugins/gst-plugins-alsa-0.8.5 *


*Edited my ~/.asoundrc - so now it looks like this:
Code:

pcm.dmixer {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:0,0"
        period_time 0
        period_size 1024
        buffer_size 8192
 rate 44100
    }

    bindings {
        0 0
        1 1
    }
}

pcm.dsp0 {
    type plug
    slave.pcm "dmixer"
}

pcm.!default {
        type plug
        slave.pcm "dmixer"
}

pcm.default {
 type plug
 slave.pcm "dmixer"
}

ctl.mixer0 {
    type hw
    card 0
}


*restarted alsa (it didn't say I should anywhere - but I guess it doesn't hurt)

BUT - it's still not possible to play to songs at once :/ and mplayer is just running whitout sound when it's started like this:
Code:
mplayer -ao alsa9:default movie.avi


I guess it's the ~/.asoundrc which is the problem - but I must admit I have no idea about what it does (just did copy/paste)

I hope you can help - thanks in advance

melange
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Thu Dec 23, 2004 11:02 pm    Post subject: Reply with quote

not an nforce base card (using ac97 intel) but this one works for me with multi-sound playing...

Code:

# Set default sound card
# Useful so that all settings can be changed to a different card here.
pcm.snd_card {
     type hw
     card 0
}

# Allow mixing of multiple output streams to this device
pcm.dmix {
     type dmix
     ipc_key 1024
     slave.pcm "snd_card"
     slave {
          # This stuff provides some fixes for latency issues.
          # buffer_size should be set for your audio chipset.
          period_time 0
          period_size 1024
          buffer_size 8192
     }

     bindings {
          0 0
          1 1
     }
}

# Allow reading from the default device.
# Also known as record or capture.
pcm.dsnoop {
     type dsnoop
     ipc_key 2048
     slave.pcm "snd_card"

## Possible artsd full duplex fix:
#     slave {
#          period_time 0
#          period_size 1024
#          buffer_size 8192
#     }

     bindings {
          0 0
          1 1
     }
}

# This is what we want as our default device
# a fully duplex (read/write) audio device.
pcm.duplex {
     type asym
     playback.pcm "dmix"
     capture.pcm "dsnoop"
}

###################
# CONVERSION PLUG #
###################
# Setting the default pcm device allows the conversion
# rate to be selected on the fly.
# duplex mode allows any alsa enabled app to read/write
# to the dmix plug (Fixes a problem with wine).
pcm.!default {
     type plug
     slave.pcm "duplex"
}

# Apparently this is wrong (breaks mplayer for me opening the device)
#ctl.!default {
#     type plug
#     slave.pcm "snd_card"
#}

########
# AOSS #
########
# OSS dsp0 device
pcm.dsp0 {
     type plug
     slave.pcm "duplex"
}

# OSS control for dsp0 (needed?...this might not be useful)
ctl.dsp0 {
     type plug
     slave.pcm "snd_card"
}

# OSS control for dsp0 (default old OSS is mixer0)
ctl.mixer0 {
     type plug
     slave.pcm "snd_card"
}

Back to top
View user's profile Send private message
evoweiss
Veteran
Veteran


Joined: 07 Sep 2003
Posts: 1678
Location: Edinburgh, UK

PostPosted: Fri Dec 24, 2004 1:10 am    Post subject: Re: Dmix - this time I want it to work Reply with quote

melange wrote:
after over a month of searching and (obviously) no succes I hope that you guys can help me :)

.
.
.

*restarted alsa (it didn't say I should anywhere - but I guess it doesn't hurt)


There is no need to restart alsa. Also, are you specifying that your audio be outputted to dmix? I'm not currently home, so I am unable to check, but you need to specify this for some programs. In the meanwhile, trying seeing whether you can use aplay and direct the output to dmix (somebody ought to have posted on this somewhere and I've helped folks out before).

Quote:

Code:
mplayer -ao alsa9:default movie.avi


The current version of mplayer has a different ao flag that you need to set. It changes with major version changes. Currently, for me at least, it's alsa1x. You can check what it is by typing in mplayer -ao help.

My .asoundrc file is:

Code:

pcm.dmixer {
     type dmix
     ipc_key 1024
     slave {
         pcm "hw:0,0"
         period_time 0
         period_size 1024
         buffer_size 8192
  rate 44100
     }

     bindings {
         0 0
         1 1
     }
 }

 pcm.dsp0 {
     type plug
     slave.pcm "dmixer"
 }

 pcm.!default {
         type plug
         slave.pcm "dmixer"
 }

 pcm.default {
  type plug
  slave.pcm "dmixer"
 }

 ctl.mixer0 {
     type hw
     card 0
 }


and my .mplayer/config file has the following setting for audio:

Code:

ao=alsa1x:default


I'd try getting mplayer able to play multiple streams first (try it with music) and then move on to getting your music player working as well. My music player, amarok with the xine engine, automatically plays correctly.

Alex
Back to top
View user's profile Send private message
melange
Tux's lil' helper
Tux's lil' helper


Joined: 16 Sep 2004
Posts: 110

PostPosted: Fri Dec 24, 2004 11:43 am    Post subject: Reply with quote

Well - now I've been trying a lot of different ~/.asoundrc (and looking alot at http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix ) - and almost with the same result.

Code:

$ alsaplayer -o alsa -d plug:dmix some.mp3 &
$ aplay -D plug:dmix some.wav &

Well - this is actually working :? they are both playing at the same time

Code:

ao=alsa1x:default

now mplayer plays as normal - i.e. with sound but no mixing :(

Code:

mpg123 Song.mp3

this plays Song.mp3 (why shouldn't it?)

Code:

aoss mpg123 Song.mp3

this also plays the song - but superfast (4min song in 2sec)

right now my ~/.asoundrc looks like this:
Code:

pcm.dsp0 {
    type plug
    slave.pcm "hw:0"
}
# or:
#  pcm.dsp0 pcm.default
# if "default" hasn't been redefined

ctl.mixer0 {
    type hw
    card 0
}


if I change ~/.asoundrc to
Code:

pcm.dsp0 {
    type plug
    slave.pcm "dmix"
}
# mixer0 can stay unchanged, because it isn't used anyway, I guess ;)
ctl.mixer0 {
    type hw
    card 0
}


mpg123 gives me this error:
Code:

arvid@becky Xmas $ aoss mpg123 Shakin\'\ Stevens\ -\ Marry\ Christmas\ Everyone.mp3
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2 and 3.
Version 0.59s-r8 (2000/Oct/27). Written and copyrights by Michael Hipp.
Uses code from various people. See 'README' for more!
THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!
Title  : Merry Christmas Everyone        Artist: Shakin' Stevens
Album  : Absolute Christmas              Year  : 2001
Comment:                                 Genre : Unknown

Playing MPEG stream from Shakin' Stevens - Marry Christmas Everyone.mp3 ...
Found new ID3 Header
MPEG 1.0 layer III, 192 kbit/s, 44100 Hz stereo

Audiodevice: No supported audio rate found for 44100 Hz and 2 channels !
Use '-vv' to list all possible audio rates and
choose a supported rate with the '-r <rate>' option.


any suggestions?
Back to top
View user's profile Send private message
evoweiss
Veteran
Veteran


Joined: 07 Sep 2003
Posts: 1678
Location: Edinburgh, UK

PostPosted: Fri Dec 24, 2004 3:04 pm    Post subject: Reply with quote

melange wrote:

Code:

$ alsaplayer -o alsa -d plug:dmix some.mp3 &
$ aplay -D plug:dmix some.wav &

Well - this is actually working :? they are both playing at the same time


Ok, this means your dmix is working and the mixer is called dmix in the way you set it up.

Quote:

Code:

ao=alsa1x:default

now mplayer plays as normal - i.e. with sound but no mixing :(


Change to ao=alsa1x:dmix and it should work.

Quote:

Code:

mpg123 Song.mp3

this plays Song.mp3 (why shouldn't it?)

Code:

aoss mpg123 Song.mp3

this also plays the song - but superfast (4min song in 2sec)


Wouldn't aoss tell alsa to mimic the oss which is something you don't really want?

As per your other questions, I'm really not sure about them as I have a bit of a different setup than you do and I don't understand all the ins and outs of dmix. However, you're making progress. I'm sure somebody will be able to help you with that.

Best,

Alex
Back to top
View user's profile Send private message
melange
Tux's lil' helper
Tux's lil' helper


Joined: 16 Sep 2004
Posts: 110

PostPosted: Fri Dec 24, 2004 4:18 pm    Post subject: Reply with quote

evoweiss wrote:

As per your other questions, I'm really not sure about them as I have a bit of a different setup than you do and I don't understand all the ins and outs of dmix.


But that's okey :) ao=alsa1x:dmix did the trick and it's working now :D

thanks a lot
Back to top
View user's profile Send private message
evoweiss
Veteran
Veteran


Joined: 07 Sep 2003
Posts: 1678
Location: Edinburgh, UK

PostPosted: Fri Dec 24, 2004 4:24 pm    Post subject: Reply with quote

melange wrote:

But that's okey :) ao=alsa1x:dmix did the trick and it's working now :D

thanks a lot


Great... quick tip is that, if you happen to upgrade mplayer and sound stops working, it's probably because they renamed the audio output flag to something else. It took me some time to figure this out.

Best,

Alex
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia 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