Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Homebrew CMI 8738 drivers (Read 547894 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Homebrew CMI 8738 drivers

Reply #50
Has anyone been able to get 24bit output before I rush out and buy a cheap generic 8768 card (sweex 7.1)?


I haven't been able to get 24 bit output through SPDIF, not even with the official drivers. The specifications are not available/incomplete with regard to this mode.

The 'official' datasheets for the 8738 chip state that it doesn't support 96kHz sample rate on the SPDIF out interface, but it actually does - the DAC of the chip can't handle it though. So I guess that either the datasheets are incorrect (which is pretty likely considering that the official drivers don't support 24bit output, but other completely useless stuff like 'karaoke'), or they never got around the implementation.

Up for now I am unaware of anybody ever being able to successfully play 24bit stuff with a 8768 soundcard.

Homebrew CMI 8738 drivers

Reply #51
The driver might have failed to install - the x64 version of vista doesn't allow unsigned drivers, and since I'm not able to sign the drivers by myself or cash out ~500 usd to msft, you will need to disable this policy by pressing F8 each time you boot and selecting the relevant item in the menu.

Just curious - can't you sign drivers without paying money to Microsoft? As far as I can see the authenticode tools should be available with the freely downloadable .NET SDKs, all you need is a code signing certificate which is available from various vendors - the cheapest I've seen so far is Comodo's $99 one, which is a good bit less than $500. There might also be better deals out there if you shop around a bit. If several people need 64-bit drivers you might find enough people willing to sponsor something like that.

Some relevant links:
Windows Kernel-mode Driver Signing Requirements
Signing and Checking Code with Authenticode
.NET Framework SDK v1.1
Comodo code-signing certificates

Homebrew CMI 8738 drivers

Reply #52
qristus, thanks for the info. The authenticode thing is way cheaper than I thought.

I see two problems though:
1. I wanna remain anonymous for the time being, and the signing authorities require a background check. So this is an obvious conflict.
2. The drivers don't exactly do what the microsoft specifies, e.g.
- the SPDIF interface remains turned on even if DRM stuff is being played
- the driver hasn't been thoroughly checked with Driver Verifier et al. which ensure that the driver meets all the specifications. I'm quite certain that it'll pass these checks with minor or no modification though.
As a result, the certificate might be blacklisted by msft in future patches of Vista, which renders the whole thing useless, of course.

Mayble people will find a way to add a self-made certificate authority to the trusted verification roots of the kernel mode in Vista so it'll chow down all the homebrew drivers which are signed with a certificate which roots to the self-created CA.

Imho, the entire thing with the mandatory driver signing just proves to be a scheme to lock out the user from his system in order to enforce that digital rights managed 'premium content' doesn't get ripped. It doesn't add a thing to the overall security of windows, and it doesn't improve the quality of a driver.

Homebrew CMI 8738 drivers

Reply #53
It seems to work fine with the Terratec 5.1 FUN (8738):

Debugview:

00000000   0.00000000   Driver Version: 0.9.6   
00000001   0.00000643   Configuration:   
00000002   0.00001062       IO Base:      0xCC00   
00000003   0.00001425       MPU Base:    0x0   
00000004   0.00001900       Chip Version: 55   
00000005   0.00002235       Max Channels: 6   
00000006   0.00002570       CanAC3HW:    1   


I've forced the Winamp FLAC decoder to output 24bits  and always starts playing. The logfiles indicate that sometime 16, 24 or 32 bit output is tried :


Format.nChannels            = 2
Format.nSamplesPerSec      = 44100
Format.wBitsPerSample      = 16
Format.nBlockAlign          = 4
Format.nAvgBytesPerSec      = 176400
Format.cbSize              = 22
Samples.wValidBitsPerSample = 16
dwChannelMask              = 00000003

Different Flac file:

Attempting to CreateRenderPin with the following WaveFormatExtensible (first attempt):
Format.nChannels            = 2
Format.nSamplesPerSec      = 44100
Format.wBitsPerSample      = 32
Format.nBlockAlign          = 8
Format.nAvgBytesPerSec      = 264600
Format.cbSize              = 22
Samples.wValidBitsPerSample = 24
dwChannelMask              = 00000003

Failed to create pin on first attempt!

Attempting to CreateRenderPin with the following WaveFormat (2nd attempt):
Format.nChannels            = 2
Format.nSamplesPerSec      = 44100
Format.wBitsPerSample      = 24
Format.nBlockAlign          = 6
Format.nAvgBytesPerSec      = 264600
Format.cbSize              = 0
Samples.wValidBitsPerSample = 0
dwChannelMask              = 00000000

Sadly the DAC remains silent when the bit depth goes over 16bit... It is capable of playing 24bit files with an Envy 24 Chaintech AV-710 card so it's probably the 8738 chip.

Switching between other sample rates works fine until now, that's a big change from those problematic VIA ENVY drivers.

I'm still tempted to try a 8768 card for 24bit output later next week...

Homebrew CMI 8738 drivers

Reply #54
I'm still tempted to try a 8768 card for 24bit output later next week...


I fiddled around a bit with the 8768 and I haven't got any real results: All the other open source drivers (*BSD, Linux) lack support for 24 bit modes, and I suspect that the official windows drivers resample to 16 bit internally because the register dump while playing 24 bit streams through kernel streaming looks almost identical to the register dump when playing 16 bit.

Another thing is that I don't have the means to tell a 16 bit stream from a 24 bit stream because my receiver is only capable of displaying the sample rate (samples per second), not the bit rate (bits per sample). So I'd be glad if someone would be kind enough to provide me with sufficient information whether the 8768 chip can actually do 24 bit with the official drivers or not.

Homebrew CMI 8738 drivers

Reply #55
Maybe we can also test it without a DAC? If we use a card with proven 24bit capabilities and feed the 8768 SPDIF output to the 24bit card's SPDIF input?

Homebrew CMI 8738 drivers

Reply #56
Maybe we can also test it without a DAC? If we use a card with proven 24bit capabilities and feed the 8768 SPDIF output to the 24bit card's SPDIF input?

Yeah, that would be a nice way to test it.
I don't use the DAC and my driver aims at perfect digital connectivity in the first place anyway, so I'd implement it even if the DAC decides to choke on 24 bit streams.

Homebrew CMI 8738 drivers

Reply #57
Hi again,

I tried the Winamp Kernel-streaming plugin with your drivers,
but I couldn't pick any output in the ks-settings, there was nothing to choose from.
Any idea, what this could be about?

Homebrew CMI 8738 drivers

Reply #58
Hi again,

I tried the Winamp Kernel-streaming plugin with your drivers,
but I couldn't pick any output in the ks-settings, there was nothing to choose from.
Any idea, what this could be about?


You're probably running Vista and installed the WaveRT drivers. The Kernel Streaming stuff doesn't work with them, so you just have to install the normal non-WaveRT drivers.
With WaveRT drivers, bitperfect output will be possible when there is a WASAPI (Windows Audio Session Application Programmable Interface) plugin which supports the exclusive mode.

Homebrew CMI 8738 drivers

Reply #59
[/quote]
I haven't been able to get 24 bit output through SPDIF, not even with the official drivers. The specifications are not available/incomplete with regard to this mode.
[/quote]
AFAIK the CMI8738 had a demo program on the CD that was able to play 24 bit wav files.
If I'm correct, you might use it to reverse-engineer 24 bit spdif mode....

Homebrew CMI 8738 drivers

Reply #60
AFAIK the CMI8738 had a demo program on the CD that was able to play 24 bit wav files.
If I'm correct, you might use it to reverse-engineer 24 bit spdif mode....


Well, I just tested the official drivers again, and I used the 'Media Rack' demo progam this time. I disabled the analog stuff in the 'CMI Audio Config' applet and set the SPDIF-out to 48kHz. The results are still the same: the contents of the main registers are virtually identical, no matter if a 16 bit or 24 bit file is played. Additionally, I tested the official drivers against the kernel streaming with identical results.
This strongly suggests that the hardware doesn't have the capabilites for playing 24 bit streams, and that the entire functionality for that resides in the official drivers. I haven't got the means to tell a 16 bit stream from a 24 bit stream, and this feature might not have been implemented in the official drivers for some reason, so there's still some (albeit very limited) uncertaintly left.
By the way, the 'Dolby Digital Live technology' marketing mumbo-jumbo for the more expensive cards (Auzentech) is just another 'marketing gag' - the hardware should be almost identical except for a few register flags or eeproms or some other marks. The actual encoding happens entirely in the drivers.

Homebrew CMI 8738 drivers

Reply #61
I've seem to run into some trouble with the drivers. After replacing an 8738 with an 8768 card using kernel stream output started failing (error opening device). I replaced the card with the previous 8738 but that didn't help.

At the end I had to revert to the original Terratec Aureon 5.1 drivers which still worked. Is there a way for to troubleshoot what's happening? The debug log of the Winamp kernel streaming plugin only says that it can't create a render pin which doesn't help much either. Also Foobar and Reclock don't work with kernel output anymore so it doesn't seem to be application specific.


Thanks!

edit: and a happy 2007!

Homebrew CMI 8738 drivers

Reply #62
I've seem to run into some trouble with the drivers. After replacing an 8738 with an 8768 card using kernel stream output started failing (error opening device). I replaced the card with the previous 8738 but that didn't help.

At the end I had to revert to the original Terratec Aureon 5.1 drivers which still worked. Is there a way for to troubleshoot what's happening? The debug log of the Winamp kernel streaming plugin only says that it can't create a render pin which doesn't help much either. Also Foobar and Reclock don't work with kernel output anymore so it doesn't seem to be application specific.


Thanks!

edit: and a happy 2007!


Uhm.. Windows prefers signed over unsigned drivers and installs them silently if they are in the inf cache. So what you should try is to delete all the oem*.inf files from the \windows\inf folder and disable all the stuff which got put on your system during previous installations. I think that some cmedia application is blocking the kernel mixer in some way, so you should disable all the 'mixer.exe', 'rundll32 CMICNFG3.cpl' etc stuff in the 'Startup' tab of msconfig.exe, reboot and install my drivers fresh.

Homebrew CMI 8738 drivers

Reply #63
Thanks for the advice! It's finally working again.

That c-media mixer had slipped in (probably signed driver preference of XP as you wrote) and then a lot of cleaning up with sysinternals autostarts.

Next, the Terratec card could not be recognized anymore as an 8738 device, but putting it in another PCI slot "fixed" this....   

Winamp started playing then, still no sound, so disabling a lot of programs at startup and it was working (I'll find out later which was one of them was responsible).

Now I'm using an 8768 card which seems to work at 24bit, but the dac reports no sample rate... The winamp kernal log reports that a 24bits pin is created at the second attempt:

Attempting to CreateRenderPin with the following WaveFormat (2nd attempt):
Format.nChannels            = 2
Format.nSamplesPerSec      = 44100
Format.wBitsPerSample      = 24
Format.nBlockAlign          = 6
Format.nAvgBytesPerSec      = 264600
Format.cbSize              = 0
Samples.wValidBitsPerSample = 0
dwChannelMask              = 00000000


OpenOutput: Successfully Created Pin, Format - BPS: 24 FREQ: 44100 NCHANNELS: 2 VALIDBPS: 0
Output Opened

Foobar also plays at 24bits and again the dac remains silent.

Homebrew CMI 8738 drivers

Reply #64

Minimum level

Maximum level

Certified driver!?

I have a CMI 8738 sound card. Windows Vista (32bit) automatically installed a driver for this device. I'm a simple man, all I need is just the simple 2 channel speaker output and microphone input. I don't need SPDIF or other advanced features. But as you see in the screen capture, the maximum microphone input level is 0DB! I can't record my voice. What is wrong? Do you have the same problem or my sound card is out of order? This sound sound card works fine under Windows XP.

Homebrew CMI 8738 drivers

Reply #65
I noticed that the driver sometimes generates output at 96khz while the source is clearly of a lower sample rate (for example, online radio). 

At this moment I'm listening to http://portal.omroep.nl/radio4 (use "luister live"). When I select the 96kbit stream a sample rate of 44.1khz is displayed, but when I select the 32kbit stream the samplerate jumps to 96khz.

The WMP stream properties state that the samplerate of the 32kbit stream is 32khz, which is below the 8768 (and my DAC's) capabilities. Is it the chip automatically choosing the samplerate in this case?


@Sin Jeong-hun


Certified driver!?

I have a CMI 8738 sound card. Windows Vista (32bit) automatically installed a driver for this device. I'm a simple man, all I need is just the simple 2 channel speaker output and microphone input. I don't need SPDIF or other advanced features. But as you see in the screen capture, the maximum microphone input level is 0DB! I can't record my voice. What is wrong? Do you have the same problem or my sound card is out of order? This sound sound card works fine under Windows XP.


You're not using the driver written by Dogbert, try installing the correct driver mentioned on the first page.

Also, you seem to have Realtek audio with your hardware, are you sure you're using the correct microphone jack? Maybe the Realtek hard and software works fine with the mic...? It is perfectly capable of meeting your requirements.

Homebrew CMI 8738 drivers

Reply #66
The WMP stream properties state that the samplerate of the 32kbit stream is 32khz, which is below the 8768 (and my DAC's) capabilities. Is it the chip automatically choosing the samplerate in this case?


The kernel mixer actually sets the sample rate. If the soundcard/driver doesn't support a specific sample rate, presumably a sample rate is chosen to which a conversion is easy with regard to calculating expense. For instance, 32 kHz can easily be upsampled to 96 kHz because the 'missing' two samples are simply filled by copying the original sample. So it's easy to upsample a given sample rate to a higher sample rate if they're divisible without remainder, e.g. (96kHz modulo 32 kHz)=0.

 

Homebrew CMI 8738 drivers

Reply #67
Dogbert,

I hooked up my oscilloscope to a CMI8738 SPDIF output, and studying the resulting waveforms I draw these conclusions:

1) original driver V 5.12.1.644 (identical results on 6.39)
SPDIF OUTPUT IS LIMITED TO ONLY 14 BIT RESOLUTION!!
sorry for the caps 
I tested this using both foobar2000 and windows media player on a clean XP install
Moreover I also tested the C-Media audio rack on 24 bits content, also ending up with only 14 audio bits.

(I created the 24 bit content in cooledit. first I converted a file to 32 bits sample depth. Then I reduced amplitude by 90 dB, to create LSB content. Then I tried all 6 modes cooledit could store this file to wav)
The 24 bit is claimed by cmedia is bogus!

2) Linux (Ubuntu edgy Alsa)
After counting bits in the waveform over and over, I still was confused about the missing 2 bits, so I tested in Linux.
Right away I saw the 2 extra bits, not only confirming my aritmetic skills  but also proving the device 16 bit capability.


3) your driver CMIDriver-0.9.8-bin-x86.  Date 2-1-2007
Also your driver gives correct 16 bits spdif resolution



btw: Is there a way with your driver to set spdif mode without the cmedia mixer?
I'd like to have these controls in control panel/ sound and audio devices / tab audio / playback device -advanced

Homebrew CMI 8738 drivers

Reply #68
I am wondering why I have to switch to 2 channel or earphone mode in driver configuration in order to activate the S/P-DIF with the original driver!? Are rear and center/subwoofer outputs and S/P-DIF using the same port within the microcontroller?

I will have a look at this driver too.

Hardware is a Terratec Aureon 5.1 and an external AC3/DTS decoder connected via TOS-Link.

Homebrew CMI 8738 drivers

Reply #69
DualIP, thanks a lot for your effort! The first result is suprising, to say at least. I would not have expected them to skip on the 16 bit spdif mode... You got one thing though: officially, the 24 bit modes are only supported by the 8768 chip.
Under XP, the spdif stuff can be turned on/off with sndvol32.exe - but I'm currently working on a small application (control panel applet) which allows you to set most of the stuff on the card and allow/disallow formats, e.g. for limiting the spdif out to a specific sample rate.

I am wondering why I have to switch to 2 channel or earphone mode in driver configuration in order to activate the S/P-DIF with the original driver!? Are rear and center/subwoofer outputs and S/P-DIF using the same port within the microcontroller?


From the driver's perspective, there's actually no way of telling whether the stream which enters the kernel mixer has 6 channels or 2 channels. Let's say, the 5.1 channel mode is enabled and you open a stereo mp3, 48kHz, 16bit. The kmixer receives the stream and queries the driver if it can currently play a 6 chan stream, 48kHz, 16bit.
If the driver denies that request here, the kmixer sends down another query whether a stream with different sample rate, channel count etc works, till it finds a working configuration.
If the driver acknowledges the 6ch/48kHz/16bit request, the kmixer opens a 6 channel stream and upsamples the 2 channel stream to 6 channel by simply zero-padding the other channels. S/PDIF is practically limited to 2 channels, so the S/PDIF port must be disabled.
If you try to play a 6 channel stream, the behaviour of the kmixer is exactly the same - the first thing it does is to ask for 6ch support.
This is actually one of the more annoying design limitations of Windows, because it's entirely braindamaged and should have been fixed eons ago.

Homebrew CMI 8738 drivers

Reply #70
officially, the 24 bit modes are only supported by the 8768 chip.

Two datasheets I have (CMI8738_4ch_spec.pdf v1.3 and cmi8738_6ch_datasheet.pdf V1.5) both claim 24 bit SPDIF in/out.


For instance, 32 kHz can easily be upsampled to 96 kHz because the 'missing' two samples are simply filled by copying the original sample.

Proper sample rate conversion isn't that easy!
The method you suggest would result in massive energy content for frequencys above 16kHz due to aliasing, which at higher volumes might even damage tweeters.
Lineair interpolation would already be better, but going from 11.025 to 44.1, I would still hear ill effects of it. Proper resampling requires lots of calculations using FIR filters.

Homebrew CMI 8738 drivers

Reply #71
Quote
Two datasheets I have (CMI8738_4ch_spec.pdf v1.3 and cmi8738_6ch_datasheet.pdf V1.5) both claim 24 bit SPDIF in/out.

That's not the only thing the specs are wrong about. For the 8738, C-Media doesn't claim 24 bit connectivity in their advertising though: http://www.cmedia.com.tw/?q=en/pci_audio
What bothers me is that most resellers of the 8768 card boldly advertise with "96kHz/24bit digital output", even though this claim is factually wrong.

Quote
Proper sample rate conversion isn't that easy!
The method you suggest would result in massive energy content for frequencys above 16kHz due to aliasing, which at higher volumes might even damage tweeters.
Lineair interpolation would already be better, but going from 11.025 to 44.1, I would still hear ill effects of it. Proper resampling requires lots of calculations using FIR filters.

OK, I made a gross oversimplification, but the point I was trying to make still holds true.

Homebrew CMI 8738 drivers

Reply #72
Thanx for the explanation.

I have now tried your driver v0.9.8 under WinXP SP2 and won't return to the original one.

The things I liked:
  • Passthrough worked with DirectSound (with the original driver it only worked with WaveOut for me and as I prefer DirectSound for non-passthrough formats I do not have to switch any longer).
  • I did not have to switch to 2-channel mode manually to be able to use the S/P-DIF.
  • When S/P-DIF passthrough is not used, 6-channel mode works perfectly too.
(I am using both, 6-channel direct analog connection and optical S/P-DIF connection for AC3/DTS passthrough)

Those 3 points are much of an improvement over the original driver for me! Of course, 6-channel mode also works perfectly with the original driver, but it is not that easy to switch to the S/P-DIF.
Hope you will keep this automated switching even when introducing your control panel...
Also bitperfectness sounds quite nice, however I can't spot any difference to the crippled 14-bit output  .

I am using AC3Filter and tested AC3 passthrough, DTS passthrough and 6-channel-direct, not recognized any flaws yet...

BIG THANX FOR YOUR EFFORT! GREAT PROJECT!

Homebrew CMI 8738 drivers

Reply #73
Ok, found a problem within 6-channel-mode (3/2+SW in AC3Filter).

With the original driver 3.5 mm stereo jacks from left to right are as follows:

Center/Subwoofer - Rear - Front

With your driver:

Rear - Center/Subwoofer - Front

Seems as if Rear and Center/Subwoofer are beeing swapped.

I have recognized it while watching a movie with Dolby 5.1. But it can more easily be tested with the following 6-channel audio file: click

Homebrew CMI 8738 drivers

Reply #74
Ok, found a problem within 6-channel-mode (3/2+SW in AC3Filter).

I've already reported the same problem to Dogbert. The issue will be resolved with a forthcoming control panel for the drivers.