Bit Perfect Audio from Linux
Apr 12, 2012 at 4:11 AM Post #31 of 543
Momentary freq = 48000 Hz


What's your DAC? Post the entire output of "cat /proc/asound/card*/stream0" while playing some music. Pay attention to the "Rates:" line, it lists the supported sampling rates of your DAC.

so I understand deadbeef with alsa output is not bitperfect, right?


You can have bitperfect output with deadbeef, deadbeef just isn't responsible for it. It depends on your system setup.
 
Apr 12, 2012 at 4:31 AM Post #32 of 543
Actually, you have to configure Deadbeef to output directly to the DAC without resampling.
 
In deadbeef, go to Edit > Preferences. Under the Sound tab, select Alsa output plugin. Then select the right output, either Digital for SPDIF or "front speaker" of the correct DAC if USB. Then go to the DSP tab. Select the Resampler, then hit Remove. Restart Deadbeef and retest
 
Note that if you're using SPDIF, you might not have the stream file. You can check using
 
cat /proc/asound/card*/pcm*p/sub0/hw_params
 
Apr 12, 2012 at 6:51 AM Post #33 of 543
my dac is hegel hd11 and supports 32, 44.1,48,96 khz (shown in rates line)
 
"You can have bitperfect output with deadbeef, deadbeef just isn't responsible for it. It depends on your system setup."
 
how is it possible?
 
Apr 12, 2012 at 6:58 AM Post #34 of 543


Quote:
Actually, you have to configure Deadbeef to output directly to the DAC without resampling.
 
In deadbeef, go to Edit > Preferences. Under the Sound tab, select Alsa output plugin. Then select the right output, either Digital for SPDIF or "front speaker" of the correct DAC if USB. Then go to the DSP tab. Select the Resampler, then hit Remove. Restart Deadbeef and retest
 
Note that if you're using SPDIF, you might not have the stream file. You can check using
 
cat /proc/asound/card*/pcm*p/sub0/hw_params

thanks for the reply,
 
I am using the usb connection and select default usb audio. so I need to change it to usb front speakers, right? doesnt matter if I set the resampler to 96 or dac default I still get Momentary freq = 48000 Hz. next time I' ll remove it and retest.
 
 
 
Apr 12, 2012 at 7:00 AM Post #35 of 543
You're probably using a software mixer that resamples everything to 48 kHz, like ALSA's default "dmixer", or PulseAudio, or jackd or whatever. You have to set deadbeef to use the sound device directly. Try KimLaroux's suggestion.

Before software mixers, people were complaining they couldn't have two different applications playing sound at the same time. Now people complain that they can't get bit-perfect output!

I use a barebones setup without any software mixer, and control everything through /etc/asound.conf, so I'm afraid I won't be of much help.

See also Bit Perfect Audio from Linux.
 
Apr 12, 2012 at 8:25 AM Post #36 of 543
When you select "default" devices, the audio is routed trough Dmix. Dmix resamples everything to 48kHz. This is needed to mix different sound sources together. As Skamp said, Dmix was created so that all sounds are mixed together and sent to your audio device. Without it, only one application can send a stream to your DAC. So in order to by-pass Dmix, you have to find the right hardware output that sends the audio directly to your dac. Trial and error rarely fails me.
 
This is Linux, you need to have a sense of adventure to really enjoy it. Gotta try things out, if not just to see what they do. 
wink.gif

 
Apr 16, 2012 at 1:26 PM Post #39 of 543
when gmusicbrowser playing (alsa output)
 
I type "cat /proc/asound/card*/stream1" instead of "cat /proc/asound/card*/stream0" and I get Momentary freq = 48000 Hz so my guess is dmixer still works. So how can I disable the mixer?
 
Apr 16, 2012 at 3:29 PM Post #40 of 543
If you want "everything" to work bit-perfect with Linux ALSA you can re-define the default device in ".asoundrc" (note this is a hidden ALSA control file in your home directory).
 
For Via Envy24 and other cards that require S32_LE data:
 
pcm.!default {
    type plug
    slave.pcm "hw:0,0"    # or whatever is needed, SPDIF is sometimes "hw:0,1"
}
 
For some other cards that support S24_LE (24-bit packed) data:
 
pcm.!default {
    type hw
    card 0    # built-in device is usually "card0", add-in or USB may be "card1"
    device 0
}
 
ALSA control is complicated and may require some research on the part of the user.
 
Aug 1, 2012 at 7:40 AM Post #41 of 543
Hi again guys!
 
After nearly a year playing around with a different setups, it came out that the best sounding setup is one of the easiest ones. The only con is that it requires USB DAC accepting SPDIF signal (aka SPDIF over USB) works with most players (XBMC, Deadbeef).
All You need is to remove any replaygain in those apps, plus select SPDIF output with software postprocesing off. (Select "SPDIF hw:{number of device}" as an output device)
NOTE: use OSS4 or ALSA only. Remove pulse audio if You got it on Your system.
 
I'll make a more detailed tutorial describing setup for XBMC and Deadbeef,
 
This setup actually sounds so good that it made me certain that ASIO output in Foobar isn't bitperfect!
 
EDIT: This thing has little harder about a year ago sine device decriptions appeared just recently, and not all distributions have it now, so if You dont have description with "direct hardware device without any software mixing" You need to choose it by device name, in order to do so open Terminal and type alsamixer, then hit F2 enter devices there, it will list available devices and there numbers. In order to select proper device choose correct number of device from the list with prefix iec958:CARD={device name},DEV={device number here}, also if u got mixer selection choose hw:{device number here}
 
IEC958 is anlternative name of SPDIF more common in linux.
 
Additionaly most ppl claim that playing audio files buffored entirely into RAM without cashing to hard disk improves sound quality, It's hard to say for me becouse I dont use swap partition in linux at all (for real theres no purpose for using swap if You got more then 2 GB of ram on nix platforms, my ram usage is like 5% all the time and cashing to disk is horrible for performance in general)
 
Another aspect in using PC as an audio source is the problem of power supply unit and mother board, now before someone will throw a stone in my direction --- none of those have an actual impact on bit steam send over to sound device, it impacts the jitter level produced in DAC! Best way to avoid this is to use separate power source for DAC, I use battery powered PSU myself, but if I had to choose betwen cheap PSU and power over USB I would go for USB power (I tried all those options and even though im audiophile mythos sceptic in most cases [biggest BS -- quality of digital cabels having impact on audio quality XD] I cant argue, that PSU thing works).
 
Aug 1, 2012 at 2:28 PM Post #42 of 543
Yeah I've been using SPDIF direct hardware device without any software mixing for a few months now. It's the most practical setup, if anything else.
 
Though both Amarok and VLC are killing me these days. The gstreamer phonon backend I'm using with Amarok has a few major problems. First is, the random option is broken. It used to randomly play all tracks in a playlist, never repeating one, and stopping when they all have been played once. Now it forgets which were played, and repeats them. Even worse, in about one track in five, it get stuck in a "replay track" loop. Then there's the last.fm scrobbling. Many tracks are scrobbled twice, and there seems to be nothing that explains why some are scrobbled once and others twice. They even broke the notification service. Both system notifications and OSDs have the same problem: The current playing song is displayed twice, at the beginning and at the end of each track. This results in a flood of notifications, and just confuses the user... How did they manage to break such basic functions that worked flawlessly before?
 
My guess is all of these problems are related, and are a side effect of their implementation of gapless playback. I'm really happy they finally brought gapless playback to Amarok, but in doing so they ruined the perfect random function, the scrobbler and the notifications. Switching to the VLC backend fixes all these issues, but you lose gapless playback.
 
Aug 2, 2012 at 2:23 PM Post #43 of 543
I wonder what do You mean by gapless playback? If it's a crossfade effect, thats something that most of us diehards here try to avoid :p after all its an additonal postprocessing :)
 
Anyway I would like to recommend You few alternatives to Your current media players (for real dont use VLC :)), my pesonal favorites are in order: Deadbeef, Audacious (a perfect winamp clone) and XBMC.
 
Btw do You also hear diffrence between SPDIF direct hardware device without any software mixing   and direct hardware device without any software mixing without SPDIF? 
Is it just me or SPDIF has more spacious sound plus better hights?
 
Aug 2, 2012 at 5:42 PM Post #44 of 543
I can't tell the difference between the filters and oversampling settings of my NFB-12, so no I can't see any difference between USB and SPDIF.
 
I also have Aqualung installed, and have been using it for a while before gapless playback was brought to Amarok. I also tried Deadbeef and loved it, but there is no repositories for Ubuntu that feature the latest Deadbeef. I tried to compile it from source but gave up after fooling with dependencies for a few hours. I never tried Audacious, but I hate winamp, so I won't even try it.
 
By gapless playback, I mean that there is no muted gap in between songs. Many albums have tracks that flow from one to the other, without silences in between tracks. Take for example Pink Floyd's "The Wall" album, which is basically just a single song that never ends. If you play the CD in a CD player, or the vinyl on a record player, you would have one continuous music experience that never stops. You can't even tell when you passed from one track to the other. Prior to 2.5.0, Amarok was unable to play the next track exactly when the current one ended. When a track ended, there was a pause with no music while Amarok fetched the next track from the hard drive and loaded it. This is a serious problem that ruins the experience of albums like The Wall.
 
In 2.5.0, they finally brought gapless playback to Amarok. To do this, the player has to fetch the next track and load it before the current track ends. You can see this happening in the logs:
 
Code:
 About to finish Got next source. Waiting for end of current. New source: QUrl( "file:///home/kim/Music/FLAC/Pink Floyd/1979. The Wall/Disc 1/05 - Pink Floyd - Another Brick In The Wall (Part II).flac" ) Finally got a source Duration message Stream changed to file:///home/kim/Music/FLAC/Pink%20Floyd/1979.%20The%20Wall/Disc%201/05%20-%20Pink%20Floyd%20-%20Another%20Brick%20In%20The%20Wall%20%28Part%20II%29.flac HTTP POST: QUrl( "http://post2.audioscrobbler.com:80/protocol_1.2" ) "[...]" HTTP POST: QUrl( "http://post.audioscrobbler.com:80/np_1.2" ) "[...]" "OK" Stream changed to file:///home/kim/Music/FLAC/Pink%20Floyd/1979.%20The%20Wall/Disc%201/05%20-%20Pink%20Floyd%20-%20Another%20Brick%20In%20The%20Wall%20%28Part%20II%29.flac "OK" About to finish Got next source. Waiting for end of current. New source: QUrl( "file:///home/kim/Music/FLAC/Pink Floyd/1979. The Wall/Disc 1/06 - Pink Floyd - Mother.flac" ) Finally got a source Duration message Stream changed to file:///home/kim/Music/FLAC/Pink%20Floyd/1979.%20The%20Wall/Disc%201/06%20-%20Pink%20Floyd%20-%20Mother.flac HTTP POST: QUrl( "http://post2.audioscrobbler.com:80/protocol_1.2" ) "[...]" HTTP POST: QUrl( "http://post.audioscrobbler.com:80/np_1.2" ) "[...]" Stream changed to file:///home/kim/Music/FLAC/Pink%20Floyd/1979.%20The%20Wall/Disc%201/06%20-%20Pink%20Floyd%20-%20Mother.flac "OK" "OK"
 
This is just one way to do it. One problem is lossy formats like MP3 usually introduce "padding" at the beginning and end of each track, which are samples of silence. This is why iTunes has to scan the library to read each tracks, building a database of the padding to know how many samples to cut in order to have gapless playbak. I don't know if Amarok has a way to handle padding, but so far I have heard no gap even on MP3s. Most of my library is FLAC, which has no padding problem. MP3s encoded with LAME, which is the encoder I use, have information in their headers telling exactly where the music starts. If Amarok reads this information, it could explain why I have no issues with my MP3s. I'll have to try it to make sure and report back.
 
So no, real gapless playback is not crossfade. I was not talking about "Fade on Stop".
 
Aug 3, 2012 at 8:17 AM Post #45 of 543
Heh, I guess You made it clear enough now :) I had no such problem with deadbeef, nor with xbmc.
 
About Deadbeef, the major con for me right now is the lack of support for plugins in 64 bit version, I mean we can compile them on our own but I've runed into the same problems You did.
PPA builds arnt bad though.
 
https://launchpad.net/~alexey-smirnov/+archive/deadbeef
 
If You really want the latest ones install deb packages from their repository :)
 
http://sourceforge.net/projects/deadbeef/files/debian/0.5.5/
 
Don't worry about the fact that this package was made for debian, Ubuntu is just a fork of debian after all, Ubuntu made debs will most likely not run on debian system but it works other way around nicely :)
 
Additionaly I've found an extremely detailed tutorial about bitperfect audio, even though it was made for windows and describes configuration for a lot of media players it also describes most common problems related to PC audio and propeses few sollutions, such as loading files to RAm for playback, droping buffer to lowest possible value etc.
 
Unfrortunatly for most of ppl here its written in Polish.
 
http://audiomagic.pl/pdf/PC_ART1.pdf
 
Another tutorial this time in English was made by cambride audio, focuses on windows but gives some insight into DAC's in general:
 
http://www.cambridgeaudio.com/assets/documents/Audiophiles_guide_to_bit_perfect_USB_Audio_October_2011.pdf
 

Users who are viewing this thread

Back
Top