LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Sound quality in linux (https://www.linuxquestions.org/questions/linux-newbie-8/sound-quality-in-linux-610168/)

medeirosdez 11-05-2010 10:54 AM

Res to Tommcd
 
Hello there Tommcd! I just wanted to thank you for your kindly welcome!

I totally agree with you on what you've said. There is no difference.

To make clear once and for all, people should keep in mind we're talking about **digital signals** here, processed in a lossless (PCM) manner. If there are no resamplings or any other effects applied to the PCM stream, any OS is pretty much the same!

It works just like this:

*You open the application that will play your songs.

*The application uses the appropriate demuxer (to deal with .mp3, .wma, .ogg, .m4a... extensions) to get the encoded stream (wma, mp3, aac, flac, ogg...).

*Then there is a decoder that will convert back the encoded stream into a PCM stream [the application could, then, make use of some DSPs to resample or up / downmix by itself].

*The PCM stream, most likely to be untouched by the application, is sent to your sound system.

Now, when it comes to the PCM stream and the sound system, things are just like this:

*If you have a sound server, like Pulse Audio, the PCM stream is sent to the Pulse server. Pulse up / downsamples the PCM stream if it is different of its own settings (you can change Pulse default sampling rate by editing the "/etc/pulse/daemon.conf" file, it also up / downmixes the PCM file if its told to,

*and, at last, the processed (or maybe untouched) PCM stream is sent to ALSA system.

I'm not going to get into deeper details on how things work under Windows or OS X, for example, because things are almost the same with all of them. The point is: the **true** maximum audio quality is achieved but getting the PCM stream untouched to the sound card. That ANY operating system can do, including Linux.

ALSA is able to do the resampling stuff on its own, but it's not as configurable as Pulse Audio. I myself like to set Pulse to 44,1 KHz sampling and S32_LE resolution all the time, except when I have to deal with 48 KHz audio samplings. I know for sure my sound card works only at 48, 96 or 192 KHz on Linux, but its audio processor (X-Fi) has an excellent resampler using advanced techniques. So, I prefer to always let the sound card to the processing.

If you don't have such hardware capabilities, I guess you'd really want to consider taking a look at this website.

Up and downmixing on Linux, anyway, is flat and 2 dimensional as I've said. I've already tried ALSA "vdownmix" plugin, it works but it's not yet as well implemented as Creative's own HRTF technology.

Amarok has a built in equalizer that does its job, specially when set to "Rock" if I'm not wrong. aTunes also has its own equalizer but it sounds horrible and is not worth a try.

So, quality is the same on every OS if you know how to set them up. Here I've left the tips of mine to help anyone who would occasionally be interested.

> Preferably, don't do any resamplings.
> Tell Pulse and / or ALSA to always use the highest definition for your sound card (mine is 24 bit, so I use the S32_LE instruction both under Pulse and ALSA).
> Avoid multichannel if all you have is a pair of speakers or headphones, or try the not so well implemented "vdownmix" plugin for ALSA.
> Try Amarok equalizer (probabily set to "Rock") to help improve a bit the perceived sound quality.

Any questions, I'm fully available at "medeirosdez@yahoo.com.br".

Best wishes to everyone here and to Linux in the hope that it continues to improve and to be a more and more appealing alternative to MS Windows or Apple OS X.

vyver 11-05-2010 12:55 PM

To medeirosdez,
Hi there! Here's my prob. The songs(.mp3) and the music videos (mpeg4) have similar (good) audibility and quality when played on both Linux(Ubuntu 10.10) and Win XP,but when i compare the sound in DVD movies( DivX) in the two OSes, there is a distinct difference,louder in Win. and low in Linux! For the movies( tested 4-5 movies) i have MPlayer and GnomeM player and the sound output is low in both. In Win. i have used the Win.Media Player and VLC. I have Realtek HD Audio Drivers installed. :confused:

Can you kindly explain and show a solution to this odd difference in sound
volume between Music Videos and Movies? Consider me a semi-newbie to linux! :scratch:

warm regards,
vyver.

medeirosdez 11-05-2010 01:42 PM

Hey vyver!

That's nice you're counting on me to help you. I'm pretty sure I have the right answer to you!

The "problem" you talk about exists on Windows too. We're actually talking about a Dolby Digital issue. It's not exactly a problem though, nothing that has got to be fixed. Dolby Digital has a lower audio range, output, volume, whatever they call it, meaning it sounds lower than other formats, like DTS (which happens to be better concerning audio quality).

Windows 7, for example, has a built-in Dolby Digital decoder. If you right-click the video screen (on Media Player) and go to "Enhancements" (I'm not sure that's what it's like on the English version of the software since I use the Br-Portuguese version) you can click "Dolby Digital settings" and it will give you three options for you to choose: "Normal", "Night" and "Cinema". If you choose "Normal" you're going to have a boost on low volumes and a decrease on the excessively high ones. If you choose "Night", you'll have the same softened output but a slight increase on the dialogs (I guess this one sounds better for onboard sound solutions). Now, if you choose "Cinema" mode, then you'll have the same exact output that the DVD was intended to have, called full dynamic. At times the sound will be low, and at times high, it'll vary dynamically. Most people won't like it if they don't have a good sound card, capable of high dynamics in audio, and a good speaker system or headphones too.

I don't know which Dolby Digital decoder you've chosen under Windows XP, since it doesn't have a built-in one, I'd recommend, by the way, AC3Filter, it's one of the bests out there. Anyway, it seems your decoder under Windows is set to something like the "Night" mode, giving you pretty much the same (high enough) volume experience throughout the whole video.

Linux, on the other hand, doesn't have the same configurability of Windows 7 and other decoders like AC3Filter, and instead of choosing the "Night" mode equivalent as does your Windows XP decoder, it chooses the "Cinema" mode for quality purposes. As I've said, preferably, the encoded, compressed sound should be decoded and sent to your audio system **untouched**. If you have your system sound output set to stereo there is surely some processing done with the decoded DVD audio in order to fit it to 2CH outputs. Anyway, the Linux decoder tries to convert the compressed audio stream to PCM **as it is**, with the same output volume as is in the DVD. As said, too, Dolby Digital has lower volume if compared to other compression formats, like DTS, MP3, etc.. Thus, you have the impression that Linux sounds worse, which isn't true. Actually, it sounds better since it doesn't play with audio volume.

I don't know any solution to this but trying to increase both the PCM and Master volumes under ALSA Mixer (type on terminal "alsamix").

I myself can't stand watching DVD's or any multichannel audio under Linux. Firstly because it has no advanced audio downmixing with well implemented HRTF techniques, as Creative's CMSS-3D. Secondly, it has no hardware accelerated MPEG-2 decoding. There are good [paid] choices for Windows out there, but for Linux the best you're gonna have is VLC which has plenty of choices for deinterlacing. Anyway, none of them have come even near to the quality of my hardware dedicated decoding under Windows. My ATI Radeon HD 3850 deinterlaces using vector adaptive algorithm with "pulldown" detection, that makes my DVD's look gorgeous! Let alone if I had a better card, like the 4000 series, with upscaling techniques!!! I like most Linux Mint and Ubuntu. I have made extensive tests with Mint 10 RC and Ubuntu 10.10. I can say that Totem DVD player, or Gnome Mplayer look just like Apple's DVD player on Mac OS X. Sound for me is not an issue on DVD's because of my better sound card.

I hope to have helped make things clearer to you! Feel free to ask anything else if you need, I'll be keeping up with this.. thread here.

Best wishes!

Paulo Henrique, from Brazil!!

mlangdn 11-05-2010 01:43 PM

I have Realtek HD drivers as well. I also have a decent set of speakers (Creative) to blast out whatever I am doing with sound. My son-in-law is an avid gamer and he lusts after my speakers. The point is, there is more to sound than just a driver.

medeirosdez 11-05-2010 01:49 PM

Surely mlangdn, there's more to sound than just a driver. But what if all you have are headphones? See what the problem is? You've got to have good technology to help you make the best out of the thing you have. That's the point of my concern with HRTF techniques.

mlangdn 11-05-2010 02:04 PM

Yes - but that decent set of speakers cost less than $30 US. Cheap doesn't mean bad. That said, it may not be concert-hall like either. It really depends upon your own needs. It impresses the heck out of my grandkids when they play their games.

medeirosdez 11-05-2010 02:58 PM

I think I get what you mean! Totally agreed!

Anyway, speakers normally don't support high frequency range. I've been looking at the specs of a few systems and they rarely go beyond 20KHz maximum. CD audio exceeds that limit going up to 22,050KHz.

For instance, I have a Tool (band) HDCD (44,1KHz sampling / 20 bit) and I was taking a look at the frequency spectrum. There are parts of some songs that reach something like 21,5 KHz. That is surely lost on speaker systems.

I know there's a whole discussion on whether there's any difference on supporting frequencies beyond human threshold, and I'm not putting that into question. Thing is: the highest the frequency range, the better.

It's impracticable to me to have speakers where I live. The house is not mine and people here would put me out if I started listening to anything out loud. That restricts me to headphones, which is not an issue to me, at all! I have a Phillips one with a frequency range of 15 to 28KHz, and a 106dB sensitivity. My sound card has a 109dB SNR, which makes it almost pair with my headphone's sensitivity. CD's, at 16 bit, can go up to 96dB, so, I'm doing even better here towards 24 bit (the best cards out there can barely make it to 20 bit anyway).

What I mean is, headphones are a very attracting alternative to speakers! Especially if you're dealing with high quality audio, like DVD / BlueRay ones! The point is: how to get the best surround sound experience with 2 channel headphones? Technology comes in here!

Let me a bit out of my own scenario here and take a look at mlangdn's: they've got speakers out there which seem to give them a very good experience with sound. If their set of speakers are two channel only, they'd certainly need the same technology that a headphones user needs. Now, what if they have multichannel speakers, like 5.1? What if all they had at times was a two channel sound to play on that setting? Technology comes in too! A card capable of actively, intelligently, dynamically distributing sounds through the available speakers would be awesome! It'd be an amazing virtual surround sound from a stereo source, quite different of just copying the left channel to all left side speakers and right channel to all right side speakers.

The subject of this thread is "sound sounds bad on Linux". In fact, good sound card paired with good speakers is quite enough for majority of people, but even those who confidently defend they don't need any improvement would be astonished if they were introduced to what technology can make to take the PC user experience to a whole new level of perceived quality and entertainment.

mlangdn, would you mind telling me what platform is used when you talk about gaming? Is it Windows or is it Linux. If Linux, I'm anxious to know what games specifically your grandkids play, that's very interesting! :-)

I hope you now understand better my point on defending technology in parallel with a good sound card and good speakers or headphones. It's pretty clear to me none of them live well without one another.

Best wishes!

tommcd 11-05-2010 05:57 PM

Medeirosdez,
Do you know why pulse-audio in Ubuntu uses so much more CPU resources than alsa? And if so, do you know how to make pulse-audio use less CPU resources? There are a great many people complaining about this on the ubuntuforums.org.
I have always removed pusle-audio because of this. I don't notice any difference in sound with or without pulse-audio, but I have never tried to tweak pulse-audio either.

tiredofbilkyyaforallican 11-05-2010 07:04 PM

As far as I'm concerned this squabbling over sound cards is no more than another "Linux vs Windoze"thread and we all know where this ends up!but however earlier someone stated to try the music on THE SAME HARDWARE in a blind test and I doubt very much if you could EVER tell the difference!!!
QUOTE:
For those who swear that sound is "better" in Windows, perhaps try a blind comparison. Install Windows and linux on the same computer. Have a friend boot either Windows or linux randomly and play some music. See if you can consistently tell whether Windows or linux is playing the music. You may be surprised at what you find. Even the (supposedly golden eared) high end audio reviewers at Stereophile magazine dare not do blind comparisons of audio hardware.END QUOTE!

medeirosdez 11-05-2010 07:14 PM

tommcd,

I guess I know a way to help you, but I'm not sure this is going to solve your problem.

At this link you can find an easy way to customize Pulse settings. An specific line on the daemon.conf file may dramatically increase your CPU usage in certain scenarios.

Ubuntu and other distributions based on it set Pulse to work at the CD default 44,1 KHz. Any audio at a different sampling rate will be resampled to 44,1 KHz. That's not exactly what you'd want unless your hardware is stuck at 48KHz sampling and is incapable of decent high quality resampling on its own.

The line I was talking about on daemon.conf file is "resample-method=". My advice is to set it to "speex-float-X", where "X" is a number varying from 1 to 10, default being 3. The highest the number, the better the resampling at the cost of more processing power needed. I had it set to 10 just because I want the highest quality possible, but that would usually eat up 25% of my CPU when resampling stuff from 48KHz to 44,1 or vice-versa. For reference, I have a Core 2 Extreme X6800 @ 2,93GHz. You can have it to its default 3 and it'll probabily be same if not a bit better than Windows 7 resampling algorithm. It's a real important thing to understand that the best you can do both for performance and quality is accordingly change the default sampling rate on that file everytime you deal with stuff sampled at a different rate. That makes Pulse use about 1 to 2% CPU when I'm listening to my songs.

There is an issue, anyway, that is **not** related to how much CPU power Pulse needs. If I have a fairly heavy page loaded on my browser and start scrolling it up and down while listening anything through Pulse, or if I make any heavy use of my CPU, I have a lot of pops and distortions on the sound. That things disappoints me quite a lot and I could find no solution for it anywhere.

Instead of uninstalling Pulse, I'd recommend configuring ALSA and making your applications access it rather then Pulse. That was simple and as soon as I configured ALSA, Flash audio was automatically direct to it rather than Pulse. A great deal which fixes the pops and distortions issue with Pulse. And the best of it: I can keep Pulse since without it Ubuntu is just loses its system related audio functions.

Create a file called asound.conf at /etc/ and put this on it:

pcm.!default {
type hw
card 0
format S16_LE
rate 44100
}
ctl.!default {
type hw
card 0
}

Change S16_LE to the highest your sound card can deal with. Mine is 24 bit capable, S24_LE is not available (I forgot the command to list the available formats), but S32_LE is, then I use S32_LE rather than S16_LE. The "rate" I choose varies according to the sound I'm dealing with. It's important to tell ALSA what rate to use because it will **always** default to 48KHz whenever DSP is needed.

After saving the file, restart ALSA:

sudo /sbin/alsa-utils stop

It will automatically restart (it has with me). If not do:

sudo /sbin/alsa-utils start

After changing /etc/pulse/daemon.conf you also have to restart Pulse:

sudo killall pulse

$ pulse

If I remember correctly, the command pulse as normal user, starts up Pulse after it's been killed.

I hope to have helped once more.

medeirosdez 11-05-2010 07:24 PM

tiredofbilkyyaforallican,

I'd recommend that you don't say this again. I'm *sooo* excited I'm being able to talk to someone about what I have experienced with Linux and Windows! This is **not really** a which is better. I'm afraid people start saying that whenever someone says Linux does not an specific thing that Windows does just fine.

I like Linux and I think it's a *great* OS, especially if you come to think it costs you nothing and has comparable speeds to Windows, which costs *so much*. One would expect Windows to be way better because of its price, but Linux has managed to be compared to Windows and be found almost if not the same. Let's please don't take this subject any longer. It's going to be a way to keep peace in here, ok?

Anyway, I've said plenty of times: there is *no* difference between *any* OS, except when you start talking about latency, resampling, up and downmixing, etc.. Those are features that could be perfectly implemented on Linux *if* there was any sort of interest from the industry. There isn't, anyway. There is no interest not even from Linux developers around the globe as I have seen. They'd do a great job, buuuut...

ALSA has got the thing in their hands with their plugins, like dmix and vdownmix. There has got to be development, just that.

And, one thing has got to be said: people are not worried about audio on computers. Anything is going to be OK for them if it can hardly be differentiated from one thing or the other. Our people and our modern industry is mostly concerned on **graphics**, that's it.

vyver 11-05-2010 09:15 PM

Quote:

Originally Posted by tiredofbilkyyaforallican (Post 4150677)
As far as I'm concerned this squabbling over sound cards is no more than another "Linux vs Windoze"thread and we all know where this ends up!but however earlier someone stated to try the music on THE SAME HARDWARE in a blind test and I doubt very much if you could EVER tell the difference!!!

This is definetely not a squabble, but "the very experience of sound" by a pair of ears(if luckily healthy)! The "prob."i had was,while using Linux------>quality"excellent",but volume----->"LOW". In Win.XP Pro----->Volume"Good". it's as simple as that. The sound quality in Linux is not "worse" but the inverse!medeirosdez is a "class act" in his chosen genre of "sound systems".Kudos to him! I'll have to re-read his reply to me to grasp the very essense! I am absolutely impressed with his knowledge of "SOUND". Hats off to you m...!:hattip:

vyver 11-05-2010 09:29 PM

Dear Paulo Henrique,
I have installed the alsamixer gui and just upped the volumes to the max. there(window of it) and voila, the movies sound is an absolute blast with no compromise in quality! Thanks and thanks again! Planning to compete with BOSE?

warm regards,
vyver.

tommcd 11-05-2010 11:25 PM

Medeirosdez,
Thanks a lot for all the helpful info. I managed to learn a few things from following this thread.

medeirosdez 11-05-2010 11:38 PM

Thank you vyver, thank you tommcd for your kind support. I'm glad my small knowledge helped you guys out there!

Sound is not really a concern for people but I think it should be.

Anything you need, I'm available at "medeirosdez@yahoo.com.br".

May G-d's peace be with you who seek for it! Best wishes!


All times are GMT -5. The time now is 06:07 AM.