Head-Fi.org › Forums › Equipment Forums › Computer Audio › Bit Perfect Audio from Linux
New Posts  All Forums:Forum Nav:

Bit Perfect Audio from Linux

post #1 of 311
Thread Starter 

I've never got a very clear answer or understanding if it's posible to configure ALSA to output a bit perfect copy of a playing music file (as the only sound playing), no resampling or mixing for supported output sample rates and bit rates.  I wouldn't mind it to work like WASAPI in shared mode on Windows Vista and 7 (bit perfect until another application needs to play audio).  Would JACK help configure ALSA to do what I'm looking for?  What settings do I need to play with to get it do what I want?  How well does it resample (downsampling for sample rates and bit rates not supported by hardware) and/or how well does it mix down surround sound to stereo; and how well is the quality of the mixer compared to Windows, Mac, and other Linux (OSS,....) audio sub-systems mixers'?  I don't think a computer forum would understand bit perfect output or the point in bothering to set it up and configure it.  I think this is the best place for this question, I just hope there is some linux audiophiles in the house. (Even if what I want is shared/mixed mode depending if audio needs to be mixed together [Bit perfect the majority of the time]).  Thanks in the advance.

 

 

P.S.  I'm not worried about audio delay/lag, long as the audio memory buffer doesn't have issues (aka keeping 0.25s-1s sound clips and playing back at random intervals randomly.  I've had that happened time to time on some slower linux machines when using audactiy. [only when the is no audio being outputed]).

post #2 of 311

 

Quote:

I wouldn't mind it to work like WASAPI in shared mode on Windows Vista and 7 (bit perfect until another application needs to play audio).

Sorry but this not bit perfect by design.

In shared mode all audio is routed to the Win mixer and dithered.

post #3 of 311
Quote:
Originally Posted by TheKisho View Post

I've never got a very clear answer or understanding if it's posible to configure ALSA to output a bit perfect copy of a playing music file (as the only sound playing), no resampling or mixing for supported output sample rates and bit rates.  I wouldn't mind it to work like WASAPI in shared mode on Windows Vista and 7 (bit perfect until another application needs to play audio).  Would JACK help configure ALSA to do what I'm looking for?  What settings do I need to play with to get it do what I want?  How well does it resample (downsampling for sample rates and bit rates not supported by hardware) and/or how well does it mix down surround sound to stereo; and how well is the quality of the mixer compared to Windows, Mac, and other Linux (OSS,....) audio sub-systems mixers'?  I don't think a computer forum would understand bit perfect output or the point in bothering to set it up and configure it.  I think this is the best place for this question, I just hope there is some linux audiophiles in the house. (Even if what I want is shared/mixed mode depending if audio needs to be mixed together [Bit perfect the majority of the time]).  Thanks in the advance.

 

 

P.S.  I'm not worried about audio delay/lag, long as the audio memory buffer doesn't have issues (aka keeping 0.25s-1s sound clips and playing back at random intervals randomly.  I've had that happened time to time on some slower linux machines when using audactiy. [only when the is no audio being outputed]).


You can get bit-perfect audio from Linux without too much difficulty using ALSA. Most popular distributions of Linux (Ubuntu, Mint, Fedora, OpenSuse) to name but a few, use the Pulse Audio Sound Server which, by default, will mix all audio down to 16/44.1 or 48 for movies. Not good for 24/96 or higher. Those who want bit perfect audio in Linux need to bypass this "feature" mad.gif.

 

While I am no Linux guru, here are a few ways to do it using Ubuntu Linux, without removing Pulse Audio or hopefully resorting to the terminal/command line. All will yield excellent results:

 

1. You need to install a music player that allows you to select certain ALSA settings. Each of my recommendations has pluses and minuses. IMO, the closest to perfection is "gmusicbrowser".  My 4 recommendations for top notch music players are:

 

     DeaDBeef            http://deadbeef.sourceforge.net/

     Gmusicbrowser  https://launchpad.net/~shimmerproject/+archive/ppa

     Guayadeque        http://sourceforge.net/projects/guayadeque/

     Quod Libet          https://code.google.com/p/quodlibet/

   

2.  To get bit-perfect output from each of the above:

 

    DeaDBeef:  (a) Click on the Edit menu, then Preferences.

                       (b) In the Preferences window under "Sound" tab > "Output plugin" = "ALSA"

                                                                                                          "Output device" = "HDA Intel ALC889,

                                                                                                                                      IEC958, S/PDIF

 

                            NOTE: the "Output device" choice will depend on the type of sound card in your computer. It may be labeled differently from the one I have.                           

 

                       (c) In the same Preferences window select > Plugins

                            In the left column select "Alsa Output Plugin" and then click the "Configure" button

                            In the configuration window make sure that ALSA resampling is unchecked and that you place a check in box to "Release device when stopped".

 

You are now done setting up DeaDBeeF for bit perfect playback.

 

    Quod Libet:  (a) click on the Music menu > Preferences > Player tab

                          (b) for the "Output pipeline" type "alsasink device=hw:0,1"  (omit quotes)

 

    Gmusicbrowser: see post 5 in this thread: http://www.head-fi.org/t/561961/bit-perfect-audio-from-linux#post_7596563

 

 

    Guayadeque:  (a) click on Library menu > Preferences and select "Playback" from left column

                            (b) for Output device = ALSA and in the white box to the right type "hw:0,1"  or "plughw:0,1" (omit quotes) Edit 08/15/12: It seems that Guayadeque 0.3.5 now has issues with using ALSA output via either of the 2 above suggested entries. You can read further, if interested in this player, at this link: http://guayadeque.org/forums/index.php?p=/discussion/576/correct-switching-between-16bit-and-24bit-usb-audio-playback

 

Now, in each case you will note that hardware device for your sound card is "hw:0,1". This is usually the case if you have one and only one sound card in your system. If you have more than one sound card, you should remove or disable all sound cards but one. Onboard (motherboard) sound cards are usually disabled in the BIOS. If the above "hw:0,1" doesn't work for you, sorry, but you will have to open a terminal and type:

 

Code:
aplay -l

 

this command will yield a result like:

 

Code:
louis@Gort:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC889 Analog [ALC889 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: ALC889 Digital [ALC889 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

 

 

This shows that my primary audio card is "hw:0,1" for digital S/PDIF output.

 

When using exclusive ALSA mode, Gmusicbrowser, Guayadeque and DeaDBeeF has one significant advantage over other players. When you stop playback, you immediately have access to sound for other programs, like answering a Skype call. With other players (like Quod Libet), they take exclusive control of the audio (like Windows WASAP mode) and no other applications can use audio.

 

This can also be done using the Linux MPD (Media Player Daemon) but it requires more work and file editing.

 


Edited by Rizlaw - 8/15/12 at 4:12pm
post #4 of 311
Thread Starter 
Quote:
Originally Posted by Roseval View Post

 

Sorry but this not bit perfect by design.

In shared mode all audio is routed to the Win mixer and dithered.

 
Only when there is more than one program using the audio.  When one program like WinAmp (with plugins) or other program is using WASAPI in shared mode it's bit perfect until knocked into mixing another programs audio into the output (like a browser or VLC or something else), but will return to bit perfect once it's the only program using it.  In exclusive mode it disables all other audio steams but program which took exclusive control.  There has been verification.  That's why I use it in shared mode, but make sure there is no interruptions from other applications.  Well maybe I'm talking about non-exclusive mode of WASAPI and Shared mode is the name of when more than one audio stream is trying to access the audio output.  So I was lead to believe.  The person also use a DTS or AC/3 audio stream to prove that when it has to share with another applications active audio stream the decoder drops out during the two mixed audio streams.

 

 

And thanks Rizlaw.  I'll check that out when I have time.  Is there anymore applications that you know of that can be configured in one way or another to do the above?  I probably should of mention that my favorite distro is Fedora (Gnome, .rpm), but that shouldn't change anything you discribed.  (Just application support at most).


Edited by TheKisho - 7/9/11 at 4:50pm
post #5 of 311

Yes. Gmusicbrowser (also excellent). http://gmusicbrowser.org/

Currently, my preferred music player in Linux.

 

Once downloaded and installed, to set up Gmusicbrowser for bit perfect playback:

 

Click the Main menu > Settings > Audio tab

 

In the Audio tab box make sure you have ALSA selected

 

Click on the topmost Advanced Settings tab to the right, this will pop up a small window. In this window, if you like gapless playback you can check it off. Most importantly, in the Alsa device box make certain to add hw:0,1

 

Do not enable enable any other features in this window. Close window.

 

NOTE: as I mentioned in post #3 above, if this setting is to work properly for you, you must check to see that your sound card actually is at hw:0,1 . If you are not sure, use the command aplay -l in a terminal window to determine the correct setting for your sound card.

 

Recently Gmusicbrowser added a nice "nowplaying" widget that you can place on your desktop which will show: transport control buttons, track title, artist, Album and Album art of the currently playing song. It's one of the nicest I've seen in Linux. It is enabled by doing the following:

 

Main Menu > Settings > Plugins tab >

Put a check in the "Desktop Widgets" selection, then in the Layout window select "Buttons, Song & Cover" and click the Add button. This will pop up a control panel that will allow you to move the widget around on your desktop for placement.

 

NOTE: if you are using Ubuntu 11.10 or higher, you will need to have the latest version of gmusicbrowser (1.1.9 deb) obtained here http://gmusicbrowser.org/devel.html

and read this post: http://forum.gmusicbrowser.org/index.php?topic=469.msg2191 and https://github.com/squentin/gmusicbrowser/commit/3d75f91e33

 

 

Recently, I started a thread on the Gmusicbrowser forum about enhancing this widget which you can read here: http://forum.gmusicbrowser.org/index.php?topic=536.0

 

If you read and follow the post, you will obtain a "nowplaying" desktop widget that looks like the one below. It will only show the transport buttons (back, stop, play/pause, forward)  below the cover art, when you mouse over the cover art):

Screenshot at 2012-01-19 11:10:06.png


Edited by Rizlaw - 8/1/12 at 4:01pm
post #6 of 311


 

Quote:
Originally Posted by Rizlaw View Post


You can get bit-perfect audio from Linux without too much difficulty using ALSA. Most popular distributions of Linux (Ubuntu, Mint, Fedora, OpenSuse) to name but a few, use the Pulse Audio Sound Server which, by default, will mix all audio down to 16/44.1 or 48 for movies. Not good for 24/96 or higher. Those who want bit perfect audio in Linux need to bypass this "feature" mad.gif.

 

While I am no Linux guru, here are a few ways to do it using Ubuntu Linux, without removing Pulse Audio or hopefully resorting to the terminal/command line. All will yield excellent results:

 

1. You need to install a music player that allows you to select certain ALSA settings. My 3 recommendations for top notch music players are:

 

     DeaDBeef          http://deadbeef.sourceforge.net/

     Quod Libet        https://code.google.com/p/quodlibet/

    Guayadeque      http://sourceforge.net/projects/guayadeque/

 

2.  To get bit-perfect output from each of the above:

 

    DeaDBeef: (a) Click on the Edit menu, then Preferences.

                       (b) In the Preferences window under "Sound" tab > "Output plugin" = "ALSA"

                                                                                                          "Output device" = "HDA Intel ALC889,

                                                                                                                                      IEC958, S/PDIF

 

                            NOTE: the "Output device" choice will depend on the type of sound card in your computer. It may be labeled differently from the one I have.                                               

 

                       (c) In the same Preferences window select > Plugins

                            In the left column select "Alsa Output Plugin" and then click the "Configure" button

                            In the configuration window make sure that ALSA resampling is unchecked and that you

                            place a check in box to "Release device when stopped".

 

You are now down setting up DeaDBeeF for bit perfect playback.



I love you dude.

 

post #7 of 311

Linux audio is a mess, I mean there are many options to get perfect audio, but theres no out-of-the box setup :)

Another thing that increases confusion in this matter are people who fight in the sound system wars :) the entire whats best pulse audio or alsa or even OSS4 subject - but most of those ppl are not even close to beeing an audiophile and hq - good sound definition to them includes good looking mixers and adding post-processing effects to audio like 3d sound so dont even bother reading those topics on ubuntu/debian/arch forums.

 

I've fought with pulse audio, alsa and even OSS4 to get best sound possible. 

Each of those sound systems has its pros and cons, but quality wise the best one out of the box is OSS4. 

That said, OSS4 will make some applications freak out when set to default in system...

 

But hopefully theres an option to achive even higher sound quality with alsa and jack. Jack in general is the linux alternative to ASIO (fto achive low latency it bypasses kernel mixing just like ASIO on windows) and its has nice server app. After installing JACK You just need to start sound server, set it like this:

 

JACK settings

 

(I've highlighted with red important ones)

 

This setup should output bit-perfect SD audio. (I cant do a null-test with my setup to check if it's 100% bit perfect but my ears feel fine with the reproduction quality :))

 

I recomend Audacious with JACK output plugin or using system wide sound capture to jack and then You can use whatever You like.

 

You can use JACK with ALSA system wide by creating .asoundrc in Your home directory containing:

 

 

# use this as default
pcm.!default {
type plug
slave { pcm "jack" }
}
 
ctl.mixer0 {
type hw
card 1
}
 
# pcm type jack
pcm.jack {
type jack
playback_ports {
0 system:playback_1
1 system:playback_2
}
capture_ports {
0 system:capture_1
1 system:capture_2
}
}
post #8 of 311

Another option is Voyage MPD.

 

It is Debrin based MPD.

The sound is very detailed and clear.

Voyage MPD dosen't require machine power nor more strage size.

 

cheeerso2smile.gif

 

post #9 of 311

OSS4 w/ vmix disabled is as close as you will get to BP audio out of a Linux box. Don't even consider ALSA/PulseAudio. 

post #10 of 311
Quote:
Originally Posted by adamlau View PostDon't even consider ALSA/PulseAudio. 


Do.  ALSA's fine.  Pulse, with the settings you choose, is fine.  Just because you only know how to do it one way, that doesn't mean no-one should do it other ways.

post #11 of 311
Quote:
Originally Posted by adamlau View Post

OSS4 w/ vmix disabled is as close as you will get to BP audio out of a Linux box. Don't even consider ALSA/PulseAudio. 



Can you provide some sort of substantiation to this claim? I find comments like this misleading and destructive.

post #12 of 311
Quote:
Originally Posted by Henry Flower View Post



Do.  ALSA's fine.  Pulse, with the settings you choose, is fine.  Just because you only know how to do it one way, that doesn't mean no-one should do it other ways.



I agree.

post #13 of 311

Since this post has preety high position @ google maybe You guys could describe Your ways just as I did this could be an intresting lecture for other people.

post #14 of 311

The major reason I've not written how I set up MPD is because the documentation is actually quite good. Secondarily if you can learn how to use IRC, their channel usually has a couple people in it that know what they're talking about. 

 

Instead of replicate that knowledge out here, we should push the knowledge back into their documentation.

 

I would emplore people to try out MPD as their player of choice, more and more hifi manufactures are bundling this capability within their playback devices.

post #15 of 311

I know how to do it both ways as any Linux user who is interested in improving/comparing means of audio fidelity should.   


 

Quote:
Originally Posted by Henry Flower View Post



Do.  ALSA's fine.  Pulse, with the settings you choose, is fine.  Just because you only know how to do it one way, that doesn't mean no-one should do it other ways.



Nothing outside of what I have tested and heard on my own systems. This is with and without mixer compiled out of alsa-lib. Compare the two audio subsystems for yourself and report back with your own results. If need be, you could also compare OSS4 vs. ALSA sonograms off the same audio file(s). Though perhaps I was a bit brash with my statement as the feature set of ALSA is quite complete thanks to active development ( @cladisch: Thanks for the Xonar contributions :) )



Quote:
Originally Posted by storrgie View Post



Can you provide some sort of substantiation to this claim? I find comments like this misleading and destructive.



 

Edited by adamlau - 1/6/12 at 5:27pm
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Computer Audio
Head-Fi.org › Forums › Equipment Forums › Computer Audio › Bit Perfect Audio from Linux