Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
alsa hw mixing support for nforce2 audio [How-To]
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
-=GGW=- $ol!d $n4>|e
Veteran
Veteran


Joined: 12 Apr 2004
Posts: 1614
Location: USA

PostPosted: Sat May 21, 2005 7:36 pm    Post subject: alsa hw mixing support for nforce2 audio [How-To] Reply with quote

v.03 (just text, no code examples and no links yet)

WARNING: Do NOT follow this blindy, it is somewhat of a hack and people aren't sure why it works or does not, be sure you know about what your doing before following the guide.

It does not seem like any guide is really up to date for the nvsound module and sound so heres my attemp. :lol:

note that if you havent already and you own an nforce2 mobo with built in sound you have to

Code:

# emerge nforce-audio


now we need to get normal alsa stuff done. (unfortinately I only have experience with using built in alsa modules with a 2.6 kernel, if you try this with a 2.4 using alsa modules and get it to work, please tell me, although I'm not sure of this, i think 2.4 owners should follow a normal alsa guide then emerge nforce-audio and add nvsound to /etc/modules.autoload.d/kernel-2.6.)

Code:

# cd /usr/src/linux
# make menuconfig


You need to have these things checked as built in, not modular.

Code:

   Device Drivers ---> Sound ---> <*> Sound card support
         ---> Advanced Linux Sound Architecture
                    <*> Advanced Linux Sound Architecture
                    <*> Sequencer support
                    <*> OSS Mixer API
                    <*> OSS PCM (digital audio) API
                          --->PCI devices
                                  <*> Intel/SiS/nVidia/AMD/ALi AC97 Controller
          ---> Open Sound System
                    <*> Open Sound System (DEPRECATED)
                    <*> VIA 82C686 Audio Codec


Save the changes and exit. Now we need to recompile the kernel with those options

Code:

# make && make modules_install


Now mount your boot partition and copy over the new files, replace what i called these in /boot according to how you have your bootloader set up.

Code:

# cp arch/i386/boot/bzImage /boot/kernel-2.6
# cp System.map /boot/System.map-2.6
# cp .config /boot/config-2.6


***REBOOT

Code:

# reboot


Configure /etc/modules.d/alsa

Quote:

# ALSA portion
alias char-major-116 snd
alias snd-card-0 snd-intel8x0
# OSS/Free portion
alias char-major-14 soundcore
alias sound-slot-0 snd-card-0 snd-intel8x0

# OSS/Free portion - card #1
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-ossalias /dev/mixer snd-mixer-oss

alias /dev/dsp snd-pcm-oss
alias /dev/midi snd-seq-oss

options snd cards_limit=1


To be safe, check to make sure /etc/devfsd.conf is set up properly

Quote:

# ALSA/OSS stuff
# Comment/change these if you want to change the permissions on
# the audio devices
LOOKUP snd MODLOAD ACTION snd
LOOKUP dsp MODLOAD
LOOKUP mixer MODLOAD
LOOKUP midi MODLOAD
REGISTER sound/.* PERMISSIONS root.audio 660
REGISTER snd/.* PERMISSIONS root.audio 660


and then add nvsound into your /etc/modules.autoload.d/kernel-2.6
then

Code:

# modprobe nvsound
# modules-update


! ! !NOTE: Since nvsound takes care of hw mixing there is no need to set up a /.asoundrc config file for dmixing. Infact, setting one up will break the built in hwmixing and cause conflicts with some programs.

in order to be able to save and restore your alsa mixer level you have to

Code:

# emerge alsa-utils
# emerge alsa-oss


Now since the original /etc/init.d/alsasound will attempt to load modules that are all ready taken car of nvidia and will spit out long annoying ugly looking warning and erros at you when you boot up, we use a modified version of the script.

! ! ! WARNING: this script does not make any checks for you, make sure you actually completle this config before adding it to the boot level or it wont work (it wont cause your comp to crash or anything, just will not unmute your card)

Quote:

#!/sbin/runscript
# $Header: /var/cvsroot/gentoo-x86/media-sound/alsa-utils/files/alsasound,v 1.23 2005/04/21 09:07:45 eradicator Exp $

alsactl=/usr/sbin/alsactl
asoundcfg=/etc/asound.state

opts="${opts} save"

depend() {
need bootmisc localmount
after modules isapnp coldplug hotplug
}

restore_mixer() {
ebegin "Restoring Mixer Levels"

local val=0

if [[ ! -r ${asoundcfg} ]] ; then
ewarn "No mixer config in ${asoundcfg}, you have to unmute your card!"
elif [[ -x ${alsactl} ]] ; then
local CARDS="$(cat /proc/asound/cards | awk '/: / { print $1 }')"
local CARDNUM
for CARDNUM in ${CARDS}
do
[[ -e /dev/snd/controlC0 ]] || sleep 2
[[ -e /dev/snd/controlC0 ]] || sleep 2
[[ -e /dev/snd/controlC0 ]] || sleep 2
[[ -e /dev/snd/controlC0 ]] || sleep 2
${alsactl} -f ${asoundcfg} restore ${CARDNUM}
((val=val+$?))
done
else
eerror -e "ERROR: Cannot find alsactl, did you forget to install media-sound/alsa-utils?"
val=1
fi

eend ${val}
return ${val}
}

save() {
ebegin "Storing ALSA Mixer Levels"

local val=0

if [[ -x ${alsactl} ]] ; then
${alsactl} -f ${asoundcfg} store
val=$?
else
eerror -e "ERROR: Cannot find alsactl."
val=1
fi

eend ${val}
return ${val}
}

start() {
restore_mixer
}

stop() {
save
}


use your favorite text editor to make that and save it as root in /etc/init.d/ as alsarestore or whatever you want it to be called for teh purpose of this guide I will assume you named it alsarestore.

Next you have to unmute your channels.

Code:

# amixer set Master 100% unmute
# amixer set PCM 100% unmute


in order to make the boot script executable, as root do

Code:

# chmod +x /etc/init.d/alsarestore


now we add the script to the boot run level

Code:

# rc-update add alsarestore boot


now activate it so that it will store the sound state

Code:

# /etc/init.d/alsarestore start


Just to be safe

Code:

# alsactl store


if you reboot and the script doesnt work for somereason, either post for help here (I will try to check this guide frequently for the first few weeks of its life after i clean up the alsarestore file i gave you some more) Or, del (delete) the alsarestore from your boot runlevel and go use the normal alsa guide and use alsasound and deal with the warnings and such.

Hope this guide works for you any feedback is welcomed

edit: changed to the correct package to emerge for the nvsound module (thnx thoffmeyer)


Last edited by -=GGW=- $ol!d $n4>|e on Tue Sep 06, 2005 7:15 am; edited 6 times in total
Back to top
View user's profile Send private message
thoffmeyer
Apprentice
Apprentice


Joined: 11 Apr 2004
Posts: 208
Location: GMT -5 Hours

PostPosted: Sat May 21, 2005 11:53 pm    Post subject: Reply with quote

Uh.. there is no nvsound in portage...
_________________
Conrad Guide, Current Maintainer

Join us on IRC
Server: irc.freenode.net
Channel: #conrad
Back to top
View user's profile Send private message
asb002
n00b
n00b


Joined: 30 May 2003
Posts: 47
Location: Rochester, NY, USA

PostPosted: Sun May 22, 2005 2:53 pm    Post subject: Reply with quote

thoffmeyer wrote:
Uh.. there is no nvsound in portage...

Code:
# emerge nforce-audio -s
Searching...   
[ Results for search key : nforce-audio ]
[ Applications found : 1 ]
 
*  media-sound/nforce-audio
      Latest version available: 1.0.0292-r1
      Latest version installed: [ Not Installed ]
      Size of downloaded files: 8,745 kB
      Homepage:    http://www.nvidia.com/
      Description: Linux kernel module for the NVIDIA's nForce SoundStorm audio chipset
      License:     NVIDIA

_________________
Registered Linux User #242361 http://counter.li.org
Back to top
View user's profile Send private message
fourstar
n00b
n00b


Joined: 22 May 2005
Posts: 1

PostPosted: Sun May 22, 2005 5:16 pm    Post subject: Reply with quote

I'm rather confused. Does this overide the other ALSA guides that talk about emerging alsa-driver/headers/tools/lib etc?

Should I follow the steps in this ALSA guide then apply this one?

/edit
Should
Code:

#/etc/init.d/alsasound start
be
Code:

#/etc/init.d/alsarestore start
Back to top
View user's profile Send private message
-=GGW=- $ol!d $n4>|e
Veteran
Veteran


Joined: 12 Apr 2004
Posts: 1614
Location: USA

PostPosted: Sun May 22, 2005 5:24 pm    Post subject: Reply with quote

made appropriate changes to the guide.
Back to top
View user's profile Send private message
thoffmeyer
Apprentice
Apprentice


Joined: 11 Apr 2004
Posts: 208
Location: GMT -5 Hours

PostPosted: Mon May 23, 2005 2:56 am    Post subject: Reply with quote

Yeah, that nvsound thing was a typo, I got ahold of the guy and told him, he fixed it. Anyways, it works awsome :-P. Finally sound mixing, woooooooooohoooooooooooooo
_________________
Conrad Guide, Current Maintainer

Join us on IRC
Server: irc.freenode.net
Channel: #conrad
Back to top
View user's profile Send private message
-=GGW=- $ol!d $n4>|e
Veteran
Veteran


Joined: 12 Apr 2004
Posts: 1614
Location: USA

PostPosted: Mon May 23, 2005 9:38 am    Post subject: Reply with quote

:)

thnx!
Back to top
View user's profile Send private message
Scoody
n00b
n00b


Joined: 28 Jan 2005
Posts: 69
Location: Norway

PostPosted: Mon May 23, 2005 5:35 pm    Post subject: Reply with quote

I can't get it to work. :cry:
While App1 uses the soundcard and App2 tries to use it, App2 has to wait for App1 to "release" the soundcard.
_________________
Scoody.
Back to top
View user's profile Send private message
-=GGW=- $ol!d $n4>|e
Veteran
Veteran


Joined: 12 Apr 2004
Posts: 1614
Location: USA

PostPosted: Mon May 23, 2005 6:20 pm    Post subject: Reply with quote

this program flawlessly mixes alsa sounds, however, it can not mix oss and alsa, if you try to use an oss prog while using an alsa program the one you open up later will either not have sound, or segfault because failiure to open sound card, you can try running it using aoss if you post tha apps I might be able to give more help
Back to top
View user's profile Send private message
Scoody
n00b
n00b


Joined: 28 Jan 2005
Posts: 69
Location: Norway

PostPosted: Mon May 23, 2005 7:16 pm    Post subject: Reply with quote

I've tried with mplayer and amarok so far.
Running two mplayer's simultaneously fails like described above, and mplayer and amarok togheter (uses xine-lib I think with alsa enabled)
mplayer -ao alsa <file>

I also tried rmmod'ing the nvsound without it making a difference while playing..
_________________
Scoody.
Back to top
View user's profile Send private message
floe-de
Apprentice
Apprentice


Joined: 25 Jul 2002
Posts: 233

PostPosted: Mon May 23, 2005 8:37 pm    Post subject: Reply with quote

On boot the alsasound deamon say that he can't find the snd_intel8x0 modul,
that right beacuase I compiled it in the kernel.

My question is, is it needed to compile the sound driver in the kernel or can I
make a module so that the error message doesn't apear ?
Back to top
View user's profile Send private message
-=GGW=- $ol!d $n4>|e
Veteran
Veteran


Joined: 12 Apr 2004
Posts: 1614
Location: USA

PostPosted: Tue May 24, 2005 12:42 am    Post subject: Reply with quote

I don't like compiligng things as modules, modules make me feel like my system is cluttered, It seemed easier for me to edit the init scrip than to compile them in as modules and make sure all the things are working :lol:
Back to top
View user's profile Send private message
hardskinone
Guru
Guru


Joined: 02 Jan 2004
Posts: 460

PostPosted: Thu May 26, 2005 8:22 am    Post subject: Reply with quote

Thanks for the howto. However I have to use the follow ~/.asoundrc for having several sounds together.

Code:

pcm.nforce-hw {
    type hw
    card 0
}

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

pcm.nforce {
    type dmix
    ipc_key 1234
    slave {
        pcm "hw:0,0"
        period_time 0
        period_size 1024
        buffer_size 4096
        rate 44100
    }
}

ctl.nforce-hw {
    type hw
    card 0
}

_________________
Playlinux.net
Back to top
View user's profile Send private message
Myszak
n00b
n00b


Joined: 26 May 2005
Posts: 3
Location: Poland

PostPosted: Thu May 26, 2005 12:28 pm    Post subject: Reply with quote

Hello!

I have one problem.
when i try to start alsarestore with comend ./alsarestore start
i have warning

Code:
* ERROR:  "./alsarestore" has syntax errors in it; not executing...


what i have to do?
Back to top
View user's profile Send private message
-=GGW=- $ol!d $n4>|e
Veteran
Veteran


Joined: 12 Apr 2004
Posts: 1614
Location: USA

PostPosted: Thu May 26, 2005 5:59 pm    Post subject: Reply with quote

Thnx for the asoundrc file, I'll test it out when I get home but so far, not having a asoundrc file has enabled mixing to work best with the most programs for me. :P

The syntax errors are either because you copied it wrong, or more likely, I edited the original weirdly. :lol:

can you please post your alsarestore?
Back to top
View user's profile Send private message
Myszak
n00b
n00b


Joined: 26 May 2005
Posts: 3
Location: Poland

PostPosted: Thu May 26, 2005 10:19 pm    Post subject: Reply with quote

this is my alsarestore

Code:

#!/sbin/runscript
# $Header: /var/cvsroot/gentoo-x86/media-sound/alsa-utils/files/alsasound,v 1.23 2005/04/21 09:07:45 eradicator Exp $

alsactl=/usr/sbin/alsactl
asoundcfg=/etc/asound.state

opts="${opts} save"

depend() {
need bootmisc localmount
after modules isapnp coldplug hotplug
}

restore_mixer() {
ebegin "Restoring Mixer Levels"

local val=0

if [[ ! -r ${asoundcfg} ]] ; then
ewarn "No mixer config in ${asoundcfg}, you have to unmute your card!"
elif [[ -x ${alsactl} ]] ; then
local CARDS="$(cat /proc/asound/cards | awk '/: / { print $1 }')"
local CARDNUM
for CARDNUM in ${CARDS}
do
[[ -e /dev/snd/controlC0 ]] || sleep 2
[[ -e /dev/snd/controlC0 ]] || sleep 2
[[ -e /dev/snd/controlC0 ]] || sleep 2
[[ -e /dev/snd/controlC0 ]] || sleep 2
${alsactl} -f ${asoundcfg} restore ${CARDNUM}
((val=val+$?))
done
else
eerror -e "ERROR: Cannot find alsactl, did you forget to install media-sound/alsa-utils?"
val=1
fi

eend ${val}
return ${val}
}

save() {
ebegin "Storing ALSA Mixer Levels"

local val=0

if [[ -x ${alsactl} ]] ; then
${alsactl} -f ${asoundcfg} store
val=$?
else
eerror -e "ERROR: Cannot find alsactl."
val=1
fi

eend ${val}
return ${val}
}

start() {
restore_mixer
}

stop() {
save
}


this is the same as oryginal.
Back to top
View user's profile Send private message
Garr
n00b
n00b


Joined: 06 Mar 2003
Posts: 10

PostPosted: Fri May 27, 2005 5:08 am    Post subject: Skype crashes with nforce 1.0.0301 heres a patched ebuild :) Reply with quote

Befair at nvnews wrote the patch and Valheru from nvnews wrote an ebuild for the patch.

https://bugs.gentoo.org/show_bug.cgi?id=91496

awesome work fellas :)

nvidia have acknowledged the problem and say it will be fixed in the next version.
Back to top
View user's profile Send private message
darcon
n00b
n00b


Joined: 26 Jun 2004
Posts: 46

PostPosted: Wed Jun 08, 2005 4:59 pm    Post subject: Reply with quote

Quote:
alias sound-service-0-12 snd-pcm-ossalias /dev/mixer snd-mixer-oss

you missed a return there I think, otherwise great guide :D

edit: spoke too soon, hardware mixing doesn't work :(

edit2:
I got rid of all alsa support and just left
Quote:
---> Open Sound System
<*> Open Sound System (DEPRECATED)
without any drivers in my kernel. Then modprobed nvsound and now hardware mixing works great, even music sounds clearer. Also video stopped playing in mplayer when using nvsound version 1.0.0292-r1, but upgrading to 1.0.0301 fixed it.
Back to top
View user's profile Send private message
-=GGW=- $ol!d $n4>|e
Veteran
Veteran


Joined: 12 Apr 2004
Posts: 1614
Location: USA

PostPosted: Thu Jun 09, 2005 11:47 pm    Post subject: Reply with quote

darcon wrote:
Quote:
alias sound-service-0-12 snd-pcm-ossalias /dev/mixer snd-mixer-oss

you missed a return there I think, otherwise great guide :D

edit: spoke too soon, hardware mixing doesn't work :(

edit2:
I got rid of all alsa support and just left
Quote:
---> Open Sound System
<*> Open Sound System (DEPRECATED)
without any drivers in my kernel. Then modprobed nvsound and now hardware mixing works great, even music sounds clearer. Also video stopped playing in mplayer when using nvsound version 1.0.0292-r1, but upgrading to 1.0.0301 fixed it.


hmm, can you send more specifics of this, I'm not completely up to date on this, but at the time I wrote the guide, nvsound took all the input, mixed it and converted it to oss, but I'm not sure how you would controll volume with those or why if it is doing this that alsamixer still controlls volume correctly, also i think with the next release they are planning on alsa improvements, dunno, havn't been keeping up with it... prolly should have.

/me slaps himself
Back to top
View user's profile Send private message
darcon
n00b
n00b


Joined: 26 Jun 2004
Posts: 46

PostPosted: Sun Jun 12, 2005 2:51 am    Post subject: Reply with quote

-=GGW=- $ol!d $n4>|e wrote:

hmm, can you send more specifics of this, I'm not completely up to date on this, but at the time I wrote the guide, nvsound took all the input, mixed it and converted it to oss, but I'm not sure how you would controll volume with those or why if it is doing this that alsamixer still controlls volume correctly, also i think with the next release they are planning on alsa improvements, dunno, havn't been keeping up with it... prolly should have.

/me slaps himself

From what I read in other threads you're suppose to be using either oss or alsa for sound in linux but not both. But if you want to use nvidia's driver you've got to use oss. So i got rid of everything alsa and use oss exclusively. To control sound i can't use alsamixer since I don't have alsa installed, so i use nvmixer that came with nvidia's drivers. It's a gui which makes it easier, also it's got some advanced options like speaker setup and some channel swap options.


Last edited by darcon on Tue Jun 14, 2005 4:24 pm; edited 1 time in total
Back to top
View user's profile Send private message
gaminggeek
Apprentice
Apprentice


Joined: 13 Nov 2003
Posts: 231
Location: New Zealand

PostPosted: Sun Jun 12, 2005 8:18 am    Post subject: Reply with quote

I have a nforce2 mobo but I don't think mine has hardware mixing can you please clear this up here is an out put of lspci

Code:
root@cbb caleb # lspci
0000:00:00.0 Host bridge: nVidia Corporation nForce2 AGP (different version?) (rev a2)
0000:00:00.1 RAM memory: nVidia Corporation nForce2 Memory Controller 1 (rev a2)
0000:00:00.2 RAM memory: nVidia Corporation nForce2 Memory Controller 4 (rev a2)
0000:00:00.3 RAM memory: nVidia Corporation nForce2 Memory Controller 3 (rev a2)
0000:00:00.4 RAM memory: nVidia Corporation nForce2 Memory Controller 2 (rev a2)
0000:00:00.5 RAM memory: nVidia Corporation nForce2 Memory Controller 5 (rev a2)
0000:00:01.0 ISA bridge: nVidia Corporation nForce2 ISA Bridge (rev a4)
0000:00:01.1 SMBus: nVidia Corporation nForce2 SMBus (MCP) (rev a2)
0000:00:02.0 USB Controller: nVidia Corporation nForce2 USB Controller (rev a4)
0000:00:02.1 USB Controller: nVidia Corporation nForce2 USB Controller (rev a4)
0000:00:02.2 USB Controller: nVidia Corporation nForce2 USB Controller (rev a4)
0000:00:04.0 Ethernet controller: nVidia Corporation nForce2 Ethernet Controller (rev a1)
0000:00:06.0 Multimedia audio controller: nVidia Corporation nForce2 AC97 Audio Controler (MCP) (rev a1)
0000:00:08.0 PCI bridge: nVidia Corporation nForce2 External PCI Bridge (rev a3)
0000:00:09.0 IDE interface: nVidia Corporation nForce2 IDE (rev a2)
0000:00:1e.0 PCI bridge: nVidia Corporation nForce2 AGP (rev a2)
0000:02:00.0 VGA compatible controller: nVidia Corporation NV31 [GeForce FX 5600XT] (rev a1)
root@cbb caleb #



cheers gaminggeek
Back to top
View user's profile Send private message
goulash
n00b
n00b


Joined: 23 Apr 2004
Posts: 47
Location: Perth, Western Australia

PostPosted: Sun Jun 12, 2005 12:59 pm    Post subject: Reply with quote

awesome thanks for this works perfectly :):):)
Back to top
View user's profile Send private message
frenkel
Veteran
Veteran


Joined: 13 May 2003
Posts: 1034
Location: .nl

PostPosted: Mon Jun 13, 2005 1:45 pm    Post subject: Reply with quote

Since when does this module support hw mixing? A year ago I bought a motherboard with VIA chipset, because nvforce2 boards didn't support hw mixing in Linux...
Back to top
View user's profile Send private message
darcon
n00b
n00b


Joined: 26 Jun 2004
Posts: 46

PostPosted: Mon Jun 13, 2005 3:56 pm    Post subject: Reply with quote

@gaminggeek
Quote:
0000:00:06.0 Multimedia audio controller: nVidia Corporation nForce2 AC97 Audio Controler (MCP) (rev a1)

I think thats all you need, however my board has two entries
Quote:
0000:00:05.0 Multimedia audio controller: nVidia Corporation nForce MultiMedia audio [Via VT82C686B] (rev a2)
0000:00:06.0 Multimedia audio controller: nVidia Corporation nForce2 AC97 Audio Controler (MCP) (rev a1)


@Frenkel
Nvidia added support for hw mixing on August 13, 2004 (version 1.0-0283), but I had some problems with that driver so I switched back to intel8x0. Version 1.0-0301 works great tho.
Back to top
View user's profile Send private message
smoked
n00b
n00b


Joined: 11 Jan 2005
Posts: 38

PostPosted: Tue Jun 14, 2005 3:42 pm    Post subject: Reply with quote

I'd say this guide was ...ahem, misguided.

1. nvsound is an OSS module.
2. The snd_intel8x0 module, that is the only explanation i can see for any alsa output working after followint this guide, does not support hardware mixing.
3. The gentoo alsa guide specifically tells you to not compile OSS into your kernel if you use alsa. It seems likely there's a good reason for this. I'm pretty sure that two different modules trying to access the same hardware at the same time is a bad idea.
4. You use the alsa-oss module and have oss compiled in the kernel. Why this doesn't fail spectacularly is a mystery to me. Which one do you expect to be used?

In short, it should be clear that this guide will not give you alsa hardware mixing. What it does give you is a thoroughly messed up sound system. I guess it's a personal preference whether you enjoy that ;)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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