2008-02-19

Better Audio Under Linux with TerraTec DMX6Fire (ICE1712 based)

Some background

I've been using Linux as main OS for more than two years, here is my experience of the audio on linux so far.
At the early stage of my linux usage, I spent some time to figure out how to use sound on linux, setup alsa, and use optical output (s/pdif) for better quality(the poor built-in sound card in the Desktop can produce pretty clean sound with this, but you need some device can accept optical in, I used an old minidisc player for that).
After switch to a Thinkpad t60 as my main development machine, I don't have optical output anymore, then I noticed that the sound quality was pretty poor with the default sound output, I didn't dig into that, just use my cell phone for music listening in work.
I have a windows PC at home for a long time, the biggest reason is I have a good sound card on it (TerraTec DMX6Fire, cost me quite some money years before), and I have some musical software on windows. After not doing anything with the software for a few years, and feeling more and more comfortable with Linux, I decide to reinstall it with Ubuntu too, then leads to this article.

The sound quality is ... POOL

Ubuntu install pretty smooth on this machine, find all the hardware including the sound card, reboot correctly, and sound works, with a pretty bad poor quality, and the digital output(Both optical and coaxial) on the card stop working anymore, the sound quality from the analog out is terrible, very not clear, it's impossible to enjoy any music on this pretty cool sound card with the default configuration at all!
Since this is Linux and the hardware is already been recognized, I think it's just something related to the configuration, so I started to google around and try to fix this, cost me about two days so far, here is what I've learned from this.
* http://alsa.opensrc.org/index.php/Ice1712

How to make it better

The biggest reason to cause the messy sound is the configuration of the card, since it's a sort of professional class card, it's not as simple as most consumer card, need some setup to make it working in the right way, there is a graphics tool for ICE1712 based cards. it's name is envy24control in package alsa-tools-gui , for my card, I am using "envy24control -p 8 -w 15" to start it, "-p 8" means use 8 pcm outputs, "-w 15" to make the window wider enough to show everything without a scrollbar.
The most important here is to make the pcm channels as stereo, the cards has 10 mono channels, by default players will play sound to the first two channels as a stereo one, but if you didn't adjust the digital mixer correctly, you will hear mix-down mono sound which is pretty bad. so you should mute the right part of pcm output 1 and mute the left part of pcm output 2.
If you have experience of using a hardware mixer, then this is much easier to understand, by allowing left/right control over each channel, you can adjust the pan value(left/right position) for it, but for stereo channels, you must set the mixer as stereo by pairing two mono channels.
Then I can have rather clean stereo again, but the sound quality is still not very nice, it's much worse than using foobar2000 on windows with ASIO output with the same card. and the digital output is not working correctly yet. so I still have a lots works to do.

How to get digital and make the sound quality even better

Using envy24control to direct digital output from s/pdif out (on Patchbay/Router tab), can use iec958 as alsa output, but you need to make sure the internal clock is same with the sound you're playing, otherwise it will be too fast or too slow. you can use envy24control's Hardware Settings to change it.

Note: Be careful about the combinations with Professional/Consumer and different clock rate, I found out that Professional+44100 and Consumer+48000 works best, other combinations will cause problems. (Noise on coaxial, or wrong clock display on my amplifier). My amplifier doesn't support higher clock rate, so I don't know how that works.

There is a good post about ALSA's sample rate converter in dmix, and how to improve it, I followed it, feels that the sound is a bit better, but not very sure about the actual effect


* http://www.hydrogenaudio.org/forums/index.php?showtopic=47591

Then I decide to give JACK a try, according to it's website at http://jackaudio.org/

JACK is a low-latency audio server, written for POSIX conformant operating systems such as GNU/Linux and Apple's OS X. It can connect a number of different applications to an audio device, as well as allowing them to share audio between themselves. Its clients can run in their own processes (ie. as normal applications), or can they can run within the JACK server (ie. as a "plugin").
JACK was designed from the ground up for professional audio work, and its design focuses on two key areas: synchronous execution of all clients, and low latency operation.
Sounds pretty good to me, and I found some guy saying that it's sound quality is pretty good on the web, after several hours of using it, I will say, it's a very cool and very good stuff, I will stick using it for a quite long time I think. The sound quality over JACK is noticeable better, make me very satisfied, and seems with JACK, can do low latency audio/midi/synth stuffs under Linux too (you can install some good musical software with package ubuntustudio-audio and ubuntustudio-audio-plugins), I haven't tried them yet, but some of them seems pretty nice.

I will leave the JACK related stuffs in another post, includes some experiments about JACK, how to use ALSA over JACK.

1 comment:

Anonymous said...

Thank you very much for this post, helped me a lot!