# M-Audio Revolution 7.1 (envy24ht) - not working?



## mart (Dec 7, 2008)

Has anyone managed to get an envy24ht card working correctly, without resorting to OSS4?  I _think_ I've configured things correctly, but I get _hugely_ distorted sound from mplayer, mpg123, flac123 etc.  Speed/samplerate seems correct, but you can barely hear the real audio through the static/clipping.

The man page for snd_envy24ht indicates the device (M-Audio Revolution 7.1) is supported, and http://wiki.freebsd.org/soundsystem shows it should be working.



> snd_envy24ht(4) already has support for more than 10 cards, including all cards made by Terratec and M-Audio that are based on VT172x.



More info:-


```
[mart@bsddesktop /usr/home/mart]$ uname -a
FreeBSD bsddesktop 7.0-RELEASE-p6 FreeBSD 7.0-RELEASE-p6 #0: Mon Nov 24 06:43:33 UTC 2008     root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386

[mart@bsddesktop /usr/home/mart]$ cat /boot/loader.conf
snd_envy24ht_load="YES"

[mart@bsddesktop /usr/home/mart]$ cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 32bit 2007061600/i386)
Installed devices:
pcm0: <Envy24HT audio (M-Audio Revolution 7.1)> at io 0xdf80:32,0xdc00:128 irq 22 [GIANT] (1p:1v/3r:1v channels duplex default)

[mart@bsddesktop /usr/home/mart]$ mixer
Mixer vol      is currently set to 100:100
Mixer treble   is currently set to   0:0
Mixer synth    is currently set to   0:0
Mixer pcm      is currently set to 100:100
Mixer speaker  is currently set to   0:0
Mixer line     is currently set to  75:75
Mixer mic      is currently set to   0:0
Mixer cd       is currently set to   0:0
Mixer mix      is currently set to   0:0
Recording source: mic

[mart@bsddesktop /usr/home/mart]$ sudo pciconf -vl
# <... snip ...>
pcm0@pci0:2:10:0:10class=0x040100 card=0x36301412 chip=0x17241412 rev=0x01 hdr=0x00
    vendor     = 'VIA Technologies Inc (Was: IC Ensemble Inc)'
    device     = 'VT1720/24 Envy24PT/HT PCI Multi-Channel Audio Controller'
    class      = multimedia
    subclass   = audio

[mart@bsddesktop /usr/home/mart]$ sudo cat /var/log/messages
# <... snip ...>
Dec  7 01:26:30 bsddesktop kernel: pcm0: <Envy24HT audio (M-Audio Revolution 7.1)> port 0xdf80-0xdf9f,0xdc00-0xdc7f irq 22 at device 10.0 on pci2
Dec  7 01:26:30 bsddesktop kernel: pcm0: [GIANT-LOCKED]
Dec  7 01:26:30 bsddesktop kernel: pcm0: [ITHREAD]
Dec  7 01:26:30 bsddesktop kernel: pcm0: system configuration
Dec  7 01:26:30 bsddesktop kernel: SubVendorID: 0x1412, SubDeviceID: 0x3630
Dec  7 01:26:30 bsddesktop kernel: XIN2 Clock Source: 49.152MHz(192kHz*256)
Dec  7 01:26:30 bsddesktop kernel: MPU-401 UART(s) #: not implemented
Dec  7 01:26:30 bsddesktop kernel: ADC #: 1
Dec  7 01:26:30 bsddesktop kernel: DAC #: 4
Dec  7 01:26:30 bsddesktop kernel: Multi-track converter type: I2S(with volume, 192KHz support, 24bit resolution, ID#0x0)
Dec  7 01:26:30 bsddesktop kernel: S/PDIF(IN/OUT): 0/1 ID# 0x00
Dec  7 01:26:30 bsddesktop kernel: GPIO(mask/dir/state): 0x3fff85/0x4000fa/0x72
```

I tried OSS4 (briefly) on a previous install, and it seemed to work well, but I'd prefer to use the official driver if possible.  Can anyone confirm this is supposed to work, or see anything I have set up incorrectly?


----------



## mart (Dec 9, 2008)

Replying to my own post in case someone else runs into this issue.

FreeBSD ships with out-of-date envy24ht drivers that contain known hw initialization bugs for M-Audio Revolution Cards (5.1 and 7.1).

*Solution:*  A forum post here has instructions from Konstantin Dimitrov on how to compile updated snd_spicds and snd_envy24ht modules.  I'm happy to confirm the instructions work perfectly on my 7.0-p6, and I'm now listening to crystal clear audio 

*What's the process for having these updates included in future releases?*


----------



## mart (Dec 31, 2008)

mart said:
			
		

> *What's the process for having these updates included in future releases?*



The envy drivers are also borked in the 7.1RC2 i just upgraded to - grrr.  I can manually patch and rebuild the relevant drivers, again, with the newer files listed above, but it's be nice to have these updated in the official release.  Again, this is not to gain new features, *the drivers shipped in 7.0 and 7.1RC2 do not function correctly without these patches...*


----------



## joel@ (Dec 31, 2008)

mart said:
			
		

> What's the process for having these updates included in future releases?


Konstantin needs to send-pr a patch or contact a developer with commit privileges to the src tree.


----------



## mart (Dec 31, 2008)

joel@ said:
			
		

> Konstantin needs to send-pr a patch or contact a developer with commit privileges to the src tree.



Thanks Joel!  I dug some more after posting and discovered that Konstantin had committed some changes to perforce on Dec 28th (go figure!).  Although a smaller patch than the one I referenced above, it looks like change #155365 might cover the issue I'm having.  I'll try it out tomorrow on my 7.1-rc2.

So... Given the changes are in perforce, does this mean they'll be automatically incorporated into a future release, or are further steps required?


----------



## mart (Dec 31, 2008)

mart said:
			
		

> I'll try it out tomorrow on my 7.1-rc2.



Ok, the new changes now in perforce solve the volume and distorted audio issues I was having.  Perfectly.  Thank you Konstantin!

It seems to be a much less invasive patchset than the one referenced earlier, now isolated to the envy24ht module alone.

Updated instructions for anyone wanting to try this out:


```
1. Download the updated source files from perforce:

   [url=http://perforce.freebsd.org/fileDownLoad.cgi?FSPC=//depot/user/kosio/envy24ht/envy24ht.c&REV=2]http://perforce.freebsd.org/fileDownLoad.cgi?FSPC=//depot/user/kosio/envy24ht/envy24ht.c&REV=2[/URL]
   [url=http://perforce.freebsd.org/fileDownLoad.cgi?FSPC=//depot/user/kosio/envy24ht/envy24ht.h&REV=2]http://perforce.freebsd.org/fileDownLoad.cgi?FSPC=//depot/user/kosio/envy24ht/envy24ht.h&REV=2[/URL]

2. Replace your originals:

   $ cd /usr/src/sys/dev/sound/pci
   $ sudo mv envy24ht.c envy24ht.c.orig
   $ sudo mv envy24ht.h envy24ht.h.orig
   $ sudo mv /my/download/directory/envy24ht.* .
   $ sudo chown root:wheel envy24ht.*
   $ sudo chmod 644 envy24ht.*

3. Rebuild

   $ cd /usr/src/sys/modules/sound/driver/envy24ht
   $ sudo make clean
   $ sudo make
   $ sudo make install

4. Reboot (or kload snd_envy24ht if you prefer) and enjoy one of the best audio chipsets ever made :)
```

Again, hopefully these will make it into an official release soon...


----------



## joel@ (Jan 1, 2009)

mart said:
			
		

> So... Given the changes are in perforce, does this mean they'll be automatically incorporated into a future release, or are further steps required?


No, they won't be automatically incorporated. The Perforce repository is just a place where lots of random FreeBSD hacking occurs. It has no real relationship with our svn repository (from which we build our releases). Konstantin still needs to talk to someone that can review and commit his code to svn.


----------



## mart (Jan 2, 2009)

joel@ said:
			
		

> The Perforce repository is just a place where lots of random FreeBSD hacking occurs.



Ah, understood.  I wasn't sure if was an official staging area - thanks for clarifying.  

I've emailed the author, so I guess its in his hands now.


----------



## mart (May 4, 2009)

It seems this was still not addressed for the 7.2-RELEASE   However, the instructions posted above can still be used to correct things (just verified on 7.2-RELEASE).

NOTE:  You may as well grab the very latest version which adds support for Envy24HT-S audio (Terrasoniq TS22PCI).  Just use the more recent urls...

http://perforce.freebsd.org/fileViewer.cgi?FSPC=//depot/user/kosio/envy24ht/envy24ht.c&REV=3
http://perforce.freebsd.org/fileViewer.cgi?FSPC=//depot/user/kosio/envy24ht/envy24ht.h&REV=2


----------



## joel@ (May 24, 2009)

For the record: all the latest fixes for envy cards from Konstantin will be in the 8.0 release.


----------



## mart (May 26, 2009)

Thanks for the update Joel.  Konstantin has done some excellent work, and it's good to hear it'll be included in 8.0.

Sadly, it will be too late for me.

I'd planned on moving all my machines over to FreeBSD (mix of development workstations, desktops and servers) but, after a long evaluation, those plans have been scrapped.

I plan on keeping a couple of smaller FreeBSD instances as VMs (hence still checking the forums), but not as the prime OS as I'd hoped.


----------

