# alsa hw mixing support for nforce2 audio [How-To]

## -=GGW=- $ol!d $n4>|e

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.  :Laughing: 

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

```

# 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.)

```

# cd /usr/src/linux

# make menuconfig

```

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

```

   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

```

# 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.

```

# cp arch/i386/boot/bzImage /boot/kernel-2.6

# cp System.map /boot/System.map-2.6

# cp .config /boot/config-2.6

```

***REBOOT

```

# reboot

```

Configure /etc/modules.d/alsa

 *Quote:*   

> 
> 
> # ALSA portion
> 
> alias char-major-116 snd
> ...

 

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
> ...

 

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

then

```

# 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 

```

# 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 $
> ...

 

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.

```

# amixer set Master 100% unmute

# amixer set PCM 100% unmute

```

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

```

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

```

now we add the script to the boot run level

```

# rc-update add alsarestore boot

```

now activate it so that it will store the sound state

```

# /etc/init.d/alsarestore start

```

Just to be safe

```

# 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

----------

## thoffmeyer

Uh.. there is no nvsound in portage...

----------

## asb002

 *thoffmeyer wrote:*   

> Uh.. there is no nvsound in portage...

 

```
# 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

```

----------

## fourstar

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

```

#/etc/init.d/alsasound start

```

be

```

#/etc/init.d/alsarestore start

```

----------

## -=GGW=- $ol!d $n4>|e

made appropriate changes to the guide.

----------

## thoffmeyer

Yeah, that nvsound thing was a typo, I got ahold of the guy and told him, he fixed it. Anyways, it works awsome  :Razz: . Finally sound mixing, woooooooooohoooooooooooooo

----------

## -=GGW=- $ol!d $n4>|e

 :Smile: 

thnx!

----------

## Scoody

I can't get it to work.  :Crying or Very sad: 

While App1 uses the soundcard and App2 tries to use it, App2 has to wait for App1 to "release" the soundcard.

----------

## -=GGW=- $ol!d $n4>|e

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

----------

## Scoody

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..

----------

## floe-de

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 ?

----------

## -=GGW=- $ol!d $n4>|e

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  :Laughing: 

----------

## hardskinone

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

```

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

}

```

----------

## Myszak

Hello!

I have one problem.

when i try to start alsarestore with comend ./alsarestore start 

i have warning

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

what i have to do?

----------

## -=GGW=- $ol!d $n4>|e

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.  :Razz: 

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

can you please post your alsarestore?

----------

## Myszak

this is my alsarestore

```

#!/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.

----------

## Garr

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  :Smile: 

nvidia have acknowledged the problem and say it will be fixed in the next version.

----------

## darcon

 *Quote:*   

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

 

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

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

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.

----------

## -=GGW=- $ol!d $n4>|e

 *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 
> 
> edit: spoke too soon, hardware mixing doesn't work 
> ...

 

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

----------

## darcon

 *-=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

----------

## gaminggeek

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

```
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

----------

## goulash

awesome thanks for this works perfectly  :Smile:  :Smile:  :Smile: 

----------

## frenkel

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...

----------

## darcon

@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.

----------

## smoked

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   :Wink: 

----------

## mog

oh well, thanks for this  :Razz:  ... should have read the last post first ... would have saved me a quite a bit of time ...

----------

## ECantona

I have pure 64 bit system and nforce4 chipset, I didn't follow this guide but I have followed Gentoo's ALSA guide and I definitely don't have hardware mixing. So what am I missing? Do have to add deprecated OSS support into my kernel, or do I have to emerge nforce-audio from testing branch? I am a bit confused  :Rolling Eyes: 

----------

## NewBlackDak

NForce4 onboard sound has no DSP, so there will never be HW mixing for it.  I've seen a thread on SW mixing setup though.

----------

## Sheepdogj15

how about nforce3? does that also lack the "DSP" thing?

yeah, the dmix Howto in the Gentoo Wiki is what i'd recommend for software mixing (works with my nforce3 250Gb). still, it seems more of a hack then a solution. i'll probably get a SB Audigy card soon, as that supports HW mixing and would probably be nicer than nforce's builtin sound.

----------

## dhasenan

Tried this, doesn't work.

I'm using gentoo-sources 2.6.11-r11. On 2.6.11-r6, I had sound working, though it was stuck at 48KHz (which made Flash exciting). I tried it with OSS disabled at first and ALSA enabled, then with both ALSA and OSS enabled. Every time, Rhythmbox complains about not being able to create audio output elements, whatever that means.

----------

## Miszczu

I do everything like in 1st post and ... hw mixing dosen't work :/ I have sound on alsa and oss drivers, but only on jack, on optical s/pdif there isn't any sound, alasmixer recognize my card, but nvmixer don't

Thx for any answer

----------

## Mben

seems to work for me. i dont understand why eaither though

----------

## neodingo

this is the first tutorial that has actually worked for my nForce2 board, i have to use aoss for multiple streams, but it works, and it barely ever pops, even playing q3a/ut2k4!!!! hazaaaa for gentoo

----------

## Snake

Does this tutorial work also for nvidia nforce1?

----------

## Snake

Ok I tried it and sound and nvmixer works, but nvmixer doesn't save options, so when I close it and run it again ewerything is det to default. Any suggestions? I would also like to know if it is possible to adjust freqences? I also get this error at boot: FATAL: Module snd_intel8x0 not found.

----------

## sparkmaul

For the past several months, I've been using the OSS-only nvsound module, without any ALSA stuff whatsoever.  It automatically does nice hardware mixing between anything that outputs to /dev/dsp.

In my kernel, I compile in "<*> Sound card support" and leave ALSA and OSS unselected.

Then I just emerge nforce-audio, and modprobe nvsound.  That creates a /dev/dsp, and everything just seems to work as well as it did back in Windows.

(note that nforce-audio in Portage is currently a couple versions behind, but it'll grab the latest if you make a copy into a Portage overlay, and rename the file to nforce-audio-1.0.0310.ebuild, or whatever the latest version is at the time you read this)

----------

## feivelda

If anyone uses alsa and has mixing: This is not hardware mixing. The alsa-lib from version 1.0.10 above, also the pre, support dmix out of the box.

And this causes pops on some machines.

----------

## cordor

alsa works perfect for me, except that i need nvmixer(need nvsound) to activate 4.0 or 5.1 speakers. Anyone knows a solution to change speakers settings without using nvmixer?

----------

## Garak128

I dunno, I keep trying alsa, dmix, or nvsound (oss?) every month or 2.. They all work.. But hardware mixing? I can never get any mixing to work at all. If I try to run something that plays sound, while another sound apps running, like amarok playing music.. I get mad errors/lockups/etc... Pretty much given up on it, hoping an update will fix it someday.

I keep alsa and stuff up to date, but nope still nothing will mix.

----------

## metalshark

I use OSS2Jack and run Jack continuously with this asound.conf

```
pcm.!default {

        type plug

        slave { pcm "jack" }

}

pcm.jackplug {

        type plug

        slave { pcm "jack" }

}

pcm.jack {

        type jack

        playback_ports {

                0 alsa_pcm:playback_1

                1 alsa_pcm:playback_2

                2 alsa_pcm:playback_3

                3 alsa_pcm:playback_4

                4 alsa_pcm:playback_5

                5 alsa_pcm:playback_6

        }

        capture_ports {

                0 alsa_pcm:capture_1

                1 alsa_pcm:capture_2

        }

}
```

on a BIOStar 200N. My .jackdrc looks like

```
/usr/bin/jackd -v -R -p512 -dalsa -dhw:0 -r48000 -p1024 -n2 -m -S -i2 -o6 -zt -H -M
```

and the revelant lspci stuff:

```
00:05.0 Multimedia audio controller: nVidia Corporation nForce Audio Processing Unit (rev a2)

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

```

Running zugaina-gensync on ~x86 with a fusd and a oss2jack ebuild found on the net (can post links).

Cedega, Mplayer, Kaffeine and Amarok run simulatenously, even if I run:

```
mplayer -ao oss sound.mp3

mplayer -ao alsa sound.mp3

mplayer -ao jack sound.mp3
```

Jamin crashes oss2jack though (and also causes fictional dropouts if you don't run qjackctl on softmode).

The nvsound malarky on the Gentoo Wiki and this guide caused me no end of grief - I know I don't have hardware mixing or multiuser sound support - but I have Jack with no dropouts - ALSA/OSS/JACK progs running at the same time - and more free time on my hands. Please lemme know if someone gets all three working with hardware mixing!!!

----------

## Gentree

Yes links would be good. You refer to OSS , is this via alsa-oss? version numbers please , this stuff changes every time I look at it. Syncing versions, alsa, kernel,jack seem essencial to make sense of any of it.

I'm reluctantly having to use the onchip sound device since my ensoniq PCI seems to disagrree with this mobo. (AN7) In fact the onchip is pretty crappy despite the optical I/O since I get infernal popping from anything that moves on the screen: mouse = zzzzzzzzzzzzzzzt , text cusor pops continucally etc. I've had this on some sound cards before but the ensoniq seems better isolated.

I'm pissed off about the ensoniq because I need the gameport too. All was fine with my heavily o'c KX7-333 but now both (either) the snd card and my AHA-2940w cause a stack dump during the boot sequence.

Argh, even the smiley icons on the forum make a noise!  This must GO!  :Evil or Very Mad: 

----------

## NeddySeagoon

Gentree,

This thread is a horrible mish-mash of alsa and oss. One post even talks about dmix, which is ALSA software mixing.

Anyway, for your mouse noise problem, try the kernel option nohlt.

Read about it in /usr/src/linux/Documentaion/kernel-parameters.txt

----------

## Gentree

many thanks,

I had a look at the doc and maybe missed how to apply the options but adding nohlt to my kernel line in grub.conf made no difference at all. In fact the noise during boot sounds like a storm is brewing.   :Mad: 

in fact the doc said not much about what it does.

```

  nohlt   [BUGS=ARM]

  no-hlt    [BUGS=IA-32] Tells the kernel that the hlt

      instruction doesn't work correctly and not to

      use it.

  nohalt    [IA-64] Tells the kernel not to use the power saving

      function PAL_HALT_LIGHT when idle. This increases

      power-consumption. On the positive side, it reduces

      interrupt wake-up latency, which may improve performance

      in certain environments such as networked servers or

      real-time systems.

```

thx

----------

## NeddySeagoon

Gentree,

nohlt does not work for everyone, you add it to the end of the kernel line in grub.conf

It works by preventing the CPU going into low power states and 'waking up' every interrupt.

The switching between CPU power states causes fluctuations on the power supply which are coupled into soundcards.

Some motherboard/sound cards are more susceptable than others.

----------

## Gentree

OK, didnt work here. Thanks for the tip anyway.

 :Cool: 

----------

