# Center speaker not working - was working last install???



## caesius (Jan 28, 2010)

I've reinstalled FreeBSD and everything's back to normal except only _two_ of the five speakers of my 5.1 sound system is working. They _all worked_ last install, what could have changed?


```
> cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 32bit 2009061500/i386)
Installed devices:
pcm0: <HDA Realtek ALC885 PCM #0 Analog> (play/rec) default
pcm1: <HDA Realtek ALC885 PCM #1 Analog> (play/rec)
pcm2: <HDA Realtek ALC885 PCM #2 Digital> (play/rec)
```


```
> cat /boot/loader.conf
nvidia_load="YES"
snd_hda_load="YES"
```

*What I've observed:*
Only two of the sound jacks on the sound unit have any "signal" coming out of them, i.e., sound only comes out of a speaker if I plug it into the "Front Left" or "Front Right" jack.

*From this I gather:*
FreeBSD no longer recognizes the 5.1 ability of my sound card.

*What I need direction towards:*
Somewhere to start probing for the problem.

Cheers


----------



## SirDice (Jan 28, 2010)

With the hda driver you can configure which output does what. Perhaps this changed slightly compared to your last install. Have a look at the snd_hda(4) man page.


----------



## mav@ (Jan 28, 2010)

caesius said:
			
		

> *From this I gather:*
> FreeBSD no longer recognizes the 5.1 ability of my sound card.



It's opposite. HDA driver in FreeBSD 8-STABLE recently got multichannel support. That's why it no more just duplicates stereo stream to all channels. To make use of real 5.1 audio, you should tell vchans of sound(4) that you really have such speaker set connected. Read sound(4) about dev.pcm.0.play.vchanformat sysctl.


----------



## caesius (Jan 28, 2010)

Thanks mav, I've had a good read of the man page. I've now changed etc/sysctl.conf:

```
> cat /etc/sysctl.conf | tail -2
dev.pcm.0.play.vchanformat=s16le:5.1
dev.pcm.0.play.vchans=6
```

But nothing has changed


----------



## SirDice (Jan 28, 2010)

Did you reboot? You can also use the sysctl command to set them by hand.


----------



## caesius (Jan 28, 2010)

SirDice said:
			
		

> Did you reboot? You can also use the sysctl command to set them by hand.



Yes, I did, I set them with sysctl, tested, then wrote to /etc/sysctl.conf and rebooted and tested again, just to be safe.

This is so frustrating - I need my multichannel sound! Thanks though SirDice.


----------



## mav@ (Jan 28, 2010)

caesius said:
			
		

> I've now changed etc/sysctl.conf:
> 
> ```
> > cat /etc/sysctl.conf | tail -2
> ...



First line is correct and should work. Now if you run `mplayer -channels 6 some_multichannel_file` you should get real 5.1 sound.

Second line is wrong. Remove it.


----------



## caesius (Jan 28, 2010)

Ok mav, I've done that:

```
> cat /etc/sysctl.conf | tail -1
dev.pcm.0.play.vchanformat=s16le:5.1
```

I have rebooted and tried to use the command you gave me above to play some music that used to play thru all speakers but *still* only two are playing.

I really don't want to have to downgrade to an older version of FreeBSD/start using WIN32 hard drive but I'm not settling for two speakers.


----------



## mav@ (Jan 28, 2010)

I think you are trying to play regular mp3 files, which are stereo by definition. Such files will be played now only to the front speakers pair. That is correct. Previous behavior was a hack in snd_hda driver and was removed, as now we have real multichannel sound support.

To use all speakers in your system you should play some multichannel audio content, such as DVD or files with AC3/DTS audio stream.

Other way is to turn stereo content into multichannel on-fly, using some up-mix method. Is is not a very good idea, as it doesn't give you more detailed sound (as there is no more information in a audio stream), but instead just reduce sound localization and/or introduce additional noises. At this moment sound(4) doesn't implement any up-mix. You may look for some plug-in for your audio player to do it. MPlayer can be configured to do trivial up-mix by using `-af channels=...` option.


----------



## caesius (Jan 28, 2010)

mav@ said:
			
		

> I think you are trying to play regular mp3 files, which are stereo by definition. Such files will be played now only to the front speakers pair. That is correct. Previous behavior was a hack in snd_hda driver and was removed, as now we have real multichannel sound support.
> 
> To use all speakers in your system you should play some multichannel audio content, such as DVD or files with AC3/DTS audio stream.
> 
> Other way is to turn stereo content into multichannel on-fly, using some up-mix method. Is is not a very good idea, as it doesn't give you more detailed sound (as there is no more information in a audio stream), but instead just reduce sound localization and/or introduce additional noises. At this moment sound(4) doesn't implement any up-mix. You may look for some plug-in for your audio player to do it. MPlayer can be configured to do trivial up-mix by using `-af channels=...` option.



Yes, you're good at picking things up, this is just ordinary MP3s I'm playing.

I understand your explanation and I'm glad that real multichannel sound support is now available (I'm sure it was no easy task...)

BUT

I really liked the way my old MP3s played thru all speakers! I don't mind if it was just two channels being split or whatever I want it back. Are there any plans to implement a simple sysctl or something to bring this behavior back?

Thanks, Benjamin.


----------



## caesius (Jan 28, 2010)

I guess what I'm asking is in relation to this:



> Previous behavior was a hack in snd_hda driver and was removed, as now we have real multichannel sound support.



How can I get his hack back?


----------



## mav@ (Jan 28, 2010)

If you wish, you may try to do it. Go to hdac_stream_setup() function in hdac.c file, and replace 0x0001 constants there by something like 0x0111. Those constants define mapping between audio channels and standard 5.1/7.1 outputs.

After that, you should be able to switch between modes by changing dev.pcm.0.play.vchanformat between 5.1 and 2.0. Setting it to 2.0 should tell driver to do up-mix.


----------



## itanic (Feb 9, 2010)

Would that be the 0x001 in these lines?:


```
uint16_t chmap[2][5] = {{ 0x0010, 0x0001, 0x0201, 0x0231, 0x0231 }, /* 5.1 */
                                { 0x0010, 0x0001, 0x2001, 0x2031, 0x2431 }};/* 7.1 */
```

i.e. change to:


```
uint16_t chmap[2][5] = {{ 0x0010, 0x0111, 0x0201, 0x0231, 0x0231 }, /* 5.1 */
                                { 0x0010, 0x0111, 0x2001, 0x2031, 0x2431 }};/* 7.1 */
```


----------



## itanic (Feb 9, 2010)

Sorry, answered my own question.

Worked like a charm, thanks a bunch!!!


----------

