Open Sound System (OSS4) superior to ALSA

0 Members and 1 Guest are viewing this topic. Read 15579 times.

wilbert-vanbakel

  • Jr. Member
  • Posts: 83
  • Photoshopped Smile
    • On Facebook
Open Sound System (OSS4) superior to ALSA
« on: 21 Jun 2011, 06:38 pm »
Hello there,

I'm a bit reluctant with responding in this forum after learning most from reading. I also don't pretend to be an audiophile expert.

I had this idea that OSS was outdated and replaced my the modern ALSA, but from researching I learned that ALSA is a reaction to the licensing changes of OSS years ago. OSS is up to date to modern hardware and available for several operating systems. ALSA is only available for linux.

Anyway, I tried to get OSS4 working on my linux system, and it recognized the USB DAC, but couldn't write data to it.So I installed FreeBSD 8.2 on a test system and connected my USB DAC. That worked right away, without any issues.

So, I decided to reinstall my Atom based music server with FreeBSD 8.2-RELEASE. The new installation recognized my Music Streamer II right away and I had sound.

I found the setting to enable bitperfect sound:Add this lines to /etc/sysctl.conf:
dev.pcm.1.bitperfect=1
and ofcourse disable auto_resample for  musicpd (mpd on FreeBSD) in mpd.conf.

I noticed right away a significant difference with internet streaming, I listen to a classic NPR station and somehow I was misguided about bitrate/samplerate. I had to enable 44100:16:2 resampling in order to listen to this station.With FreeBSD/OSS4 I had nothing special to configure to listen to the same station. And the Music Streamer II shows the LED 96K lit up.The sound quality of this internet stream is so much better, unbelievable!

The local stored flac tracks sound so much better too.Yesterday's linux/ALSA sounded dense and stuffed, today's FreeBSD/OS4 sound open and light. I hear the space around the performers, I hear the distance to the cough in the audience. I could not stop listening to my familiar CD's and just sit and enjoy. This is some serious upgrade in audio joy!

For me: farewell ALSA, welcome OSS.

nyc_paramedic

  • Full Member
  • Posts: 456
Re: Open Sound System (OSS4) superior to ALSA
« Reply #1 on: 23 Jun 2011, 03:26 pm »


I noticed right away a significant difference with internet streaming, I listen to a classic NPR station and somehow I was misguided about bitrate/samplerate. I had to enable 44100:16:2 resampling in order to listen to this station.With FreeBSD/OSS4 I had nothing special to configure to listen to the same station. And the Music Streamer II shows the LED 96K lit up.The sound quality of this internet stream is so much better, unbelievable!

Can you clarify the above paragraph? With which configuration did you have to enable re sampling, the Linux one? I never have to reconfigure bitrates with my Voyag Linux/MPD setup.

Perhaps you were hearing a drastic difference because something was misconfigured with your Linux setup?

Also, your 96Khz light should not be lit when playing 16/44.1 material unless your machine is upsampling. Maybe that's why you hear a difference?

Eudyptes

  • Jr. Member
  • Posts: 29
Re: Open Sound System (OSS4) superior to ALSA
« Reply #2 on: 24 Jun 2011, 11:48 am »
I have read comments that ALSA is a dog's breakfast and that all is not well Linux audio land ( too many layers like phono, pulseaudio etc and other things ... ) and for some OSS produces better SQ. But I think it's fair to ask the OP if they were using an optimal ALSA configuration.

As this is very much in the ears of the listener, I thought I'd give OSS a try.  I can connect to my DAC via it's  USB input (adaptive mode  at 16/32,16/44 or 16/48)  or via my sound card's optical out to the DAC's optical input (max 24/96).  The s/card is a cheap Envy24HT based model – actually a Chaintech AV710 clone, but it is bit-perfect.  I thought if the USB input isn't supported in OSS4, the s/card should be.

A debian based distro seemed the best bet to get OSS4 working and I had a 64bit edition of aptosid XFCE4 on CD which I installed on a spare partition.  It's lightweight and runs the desktop using just 150MB of memory and with audio playback the system CPU usage is around 10% on a dual athlon PC.

On this distro dkms is used to build and install the OSS sound modules.  This failed at first attempt due to a system directory not being found.  A symlink fixed that and I got OSS4 loaded and working after a bit of fiddling.  Both the s/card and USB device were detected but running osstest at the CLI  resulted in only the s/card working.  It looks like USB audio support for DACs in patchy at best.

To avoid mixers and sample rate conversion I used these commands.

ossmix vmix0-src OFF
ossmix vmix0-enable OFF

Software volume control was not used.

Like ALSA's aplay, the CLI application ossplay only plays wav files.  I also configured vlc and mplayer and qmmp to use OSS and played both FLAC and ape files, as well as the 320kbps AAC (mpa4) classical music stream from BBC Radio 3 at http://www.bbc.co.uk/radio/listen/live/r3_aaclca.pls, which like Carlsberg is probably the best in the world.

Is there a night and day difference between ALSA and OSS on my kit?

Doing a level matched A/B comparison switching back and forth isn't possible.  But if there are any differences, they must be subtle as my old ears couldn't really pick it out.  May be, just may be there were times when I thought there was a little greater clarity in OSS4 but this seemed only to be when playing wav files with ossplay. But I'm not sure if that was just wishful thinking.

For the record, my DAC has a variable output which is connected  directly to a Quad 306 power amp using AVI Neutron 3 mini-monitors.   Not high-end, but not too shabby either and I think good enough to enable any obvious SQ difference to be heard. 

I won't be changing to OSS4.  My USB DAC is not supported and unlike with ALSA my sound card is limited to 48Khz max when it is capable of 24bit/96Khz over S/PDIF.


wilbert-vanbakel

  • Jr. Member
  • Posts: 83
  • Photoshopped Smile
    • On Facebook
Re: Open Sound System (OSS4) superior to ALSA
« Reply #3 on: 24 Jun 2011, 01:10 pm »
Thank you, gentlemen,

The output section in my mpd.conf on Debian looked like this:

Code: [Select]
audio_output {
   type      "alsa"
   name      "Music Streamer II (no resampling)"
   device      "hw:1,0"
   mixer_type   "none"
   enabled      "yes"
}

audio_output {
   type      "alsa"
   name      "Music Streamer II (internet radio)"
   device      "hw:1,0"
   format      "44100:16:2"
   mixer_type   "none"
   enabled      "no"
}

I don't have a /etc/asound.conf setup

Here is the internet stream that I needed to resample when using ALSA, and what plays right away with OSS4:
http://www.publicbroadcasting.net/kwgs/ppr/kwgs.m3u

Do you listen to this stream without resampling???

From the squeezebox forums I gathered that many customers do experience 'chip monks' with internet radio. So, I didn't think I had incorrect configuration of ALSA.

I also was not able to get OSS4 working on Debian, I got write errors to the USB hardware.
FreeBSD on the other hand works out of the box, I load the driver snd_uaudio and I set dev.pcm.1.bitperfect=1.

I realize now that possibly I listen to upsampled sound, there are perhaps more settings to research. Being able to hear the difference between ALSA and OSS4 got me excited. It's not that the sound before was that bad. I had to find a way to express the difference that I experience.

Eudyptes

  • Jr. Member
  • Posts: 29
Re: Open Sound System (OSS4) superior to ALSA
« Reply #4 on: 24 Jun 2011, 03:38 pm »
Well, apart from anything else OSS on FreeBDS is not the same thing as OSS4 on Linux.  So my comparisons were not done under the same conditions as yours, but were rather in the way of an experiment to see if I could hear any obvious/big difference between OSS4 and ALSA under Linux. 

FreeBDS may be a different story.  It requires a primary partition for installation and the only partitions I have spare are logical.  Nor do I think there are any LiveCDs in the Free BDS world I could try.  :(

wilbert-vanbakel

  • Jr. Member
  • Posts: 83
  • Photoshopped Smile
    • On Facebook
Re: Open Sound System (OSS4) superior to ALSA
« Reply #5 on: 24 Jun 2011, 03:44 pm »
PC-BSD is 100% compatible with FreeBSD, it has a few additions to support the desktop user.It runs from live CD and also from live usb:
http://www.pcbsd.org/

You may need to set the default device for sound:
#sysctl hw.snd.default_unit=<device number>

http://www.freebsd.org/doc/handbook/sound-setup.html

Eudyptes

  • Jr. Member
  • Posts: 29
Re: Open Sound System (OSS4) superior to ALSA
« Reply #6 on: 24 Jun 2011, 03:56 pm »
OK, I'll take a look. But one thing did stirke me, you mentioned a FreeBSD module snd_uaudio. That looks suspiciously like an ALSA module name and I believe the recent stable FreeBSD includes  alsa-lib 1.0.23.  Is module snd_uaudio really part of the OSS system?  Perhaps it doesn't really matter as we are just talking about the FreeBDS sound architecture as opposed to the Linux way of doing things.

wilbert-vanbakel

  • Jr. Member
  • Posts: 83
  • Photoshopped Smile
    • On Facebook
Re: Open Sound System (OSS4) superior to ALSA
« Reply #7 on: 24 Jun 2011, 04:34 pm »
snd_uaudio is a module of the FreeBSD kernel, and yes FreeBSD offers since a long time the linux API, so that users are able to run linux binaries. It also offers the Solaris API and I guess that lets you run Solaris binaries.
It's not installed and enabled by default, though.

And none of that is activated on my server. It's plain FreeBSD, basic installation with ssh, rsync and mpd.
It's easiest to install musicpd with #sysinstall and go to packages, then look under audio.

nyc_paramedic

  • Full Member
  • Posts: 456
Re: Open Sound System (OSS4) superior to ALSA
« Reply #8 on: 24 Jun 2011, 09:38 pm »
Thank you, gentlemen,

The output section in my mpd.conf on Debian looked like this:

Code: [Select]
audio_output {
   type      "alsa"
   name      "Music Streamer II (no resampling)"
   device      "hw:1,0"
   mixer_type   "none"
   enabled      "yes"
}

audio_output {
   type      "alsa"
   name      "Music Streamer II (internet radio)"
   device      "hw:1,0"
   format      "44100:16:2"
   mixer_type   "none"
   enabled      "no"
}

I don't have a /etc/asound.conf setup

Here is the internet stream that I needed to resample when using ALSA, and what plays right away with OSS4:
http://www.publicbroadcasting.net/kwgs/ppr/kwgs.m3u

Do you listen to this stream without resampling???

From the squeezebox forums I gathered that many customers do experience 'chip monks' with internet radio. So, I didn't think I had incorrect configuration of ALSA.

I also was not able to get OSS4 working on Debian, I got write errors to the USB hardware.
FreeBSD on the other hand works out of the box, I load the driver snd_uaudio and I set dev.pcm.1.bitperfect=1.

I realize now that possibly I listen to upsampled sound, there are perhaps more settings to research. Being able to hear the difference between ALSA and OSS4 got me excited. It's not that the sound before was that bad. I had to find a way to express the difference that I experience.

First, my mpd output section:

#
audio_output {
        type            "alsa"
        name            "Ayre QB-9"
        device          "hw:0,0"        # optional
}

You should get rid of mixer_type   "none" and enabled      "yes" in you section.

Second, I can play that radio station without any hiccups. But here's the deal: my mpd.conf *is* resampling that stream. It has to because it's a 16 bit 22.1Khz sampling rate. I think my Ayre can handle 32Khz sampling. Your HRT (http://www.highresolutiontechnologies.com/pdf/HRT-Music-Streamer-II.pdf) supports 32Khz to 96Khz sampling.

Now, I'm using the latest daily build of Voyage MPD. You said you were using Debian. Depending on how it was configured, your Debian box mighta been configured using a higher quality up-samapling algorithm on Debian than on FreeBSD. Plus, your Atom might have been wokring really hard to up-sample a 16 bit stream 22.1Khz sampling to 24 bits and 96Khz sampling. Did you check top to see your CPU load? Did you check the outputs of /proc/asound to see what was happening in real time? When I only had a 16/44.1 USB DAC (Wavelength Brick) my lowly Alix could not down-sample 24/96 material to 16/44.1 fast enough, thus audio hiccups.

On my Alix (500Mhz Geode CPU), re-smapling that internet radio stream from 16bit 22.1 to 16bit 44.1Khz makes my CPU work at 30% load, compared to 8-11% for native files.

 As far as FreeBSD/OSS vs Linux/ALSA, you should only be comparing 16/44.1 and 24/96 native files between the two. And at least for a couple of weeks to really claim that one is better than the other.

wilbert-vanbakel

  • Jr. Member
  • Posts: 83
  • Photoshopped Smile
    • On Facebook
Re: Open Sound System (OSS4) superior to ALSA
« Reply #9 on: 24 Jun 2011, 10:19 pm »
As far as FreeBSD/OSS vs Linux/ALSA, you should only be comparing 16/44.1 and 24/96 native files between the two. And at least for a couple of weeks to really claim that one is better than the other.
My excitement is based on comparing 16/44.1 tracks, perhaps I can configure the Atom system to boot from flash and access the tracks over nfs, but that is not my current setup. I mean, I'm not prepared to A/B comparison.

I launched #top -P, which then shows workload for 4 CPU's.
While listening to streaming radio, none of the CPU's is less than 98% idle.The workload is 1-2%.


 

Eudyptes

  • Jr. Member
  • Posts: 29
Re: Open Sound System (OSS4) superior to ALSA
« Reply #10 on: 25 Jun 2011, 09:40 am »
A little more feedback on OSS, this time using PC-BSD. 

I downloaded, burnt and ran the most recent PC-BSD live DVD iso.  The boot messages showed both my generic Envy24HT s/card and USB DAC were detected . The later showing as a burr-brown TI USB audio codec.

Once the desktop/sytem was fully loaded ossinfo and osstest indicated no driver had loaded for USB audio and the envy24ht card's SPDIF ouptut was not working with the loaded driver. 

I loaded the snd_uaudio module with kldload snd_audio and confirmed that the USB audio device was active:

Code: [Select]
cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 32bit 2009061500/i386)
Installed devices:
pcm0: <Envy24HT audio (Generic)> (play/rec) default
pcm1: <USB audio> (play/rec

I used osstest to find the correct device name for the USB DAC, it was

Code: [Select]
pcm1:play:dsp1.vp0                 /dev/dsp1.vp0  (device index 7)
So I now knew how to use mplayer at the CLI for playback, e.g.
Code: [Select]
mplayer -ao oss:/dev/dsp1.vp0  xxxx.xxx
I have played my two favourite internet radio streams: BBC Radio 3 and Avro Baroque.

Code: [Select]
pcbsd# mplayer -ao oss:/dev/dsp1.vp0 http://shoutcast.omroep.nl:8068/           MPlayer SVN-r32577-snapshot-4.2.1 (C) 2000-2010 MPlayer Team

Playing http://shoutcast.omroep.nl:8068/.
Resolving shoutcast.omroep.nl for AF_INET6...

Couldn't resolve name for AF_INET6: shoutcast.omroep.nl
Resolving shoutcast.omroep.nl for AF_INET...
Connecting to server shoutcast.omroep.nl[145.58.33.95]: 8068...

Name   : AVRO Baroque Around The Clock
Genre  : classical
Website: http://klassiek.avro.nl
Public : no
Bitrate: 256kbit/s
Cache size set to 320 KBytes
Cache fill:  0.00% (0 bytes)   
ICY Info: StreamTitle='Antonio Vivaldi - Susan Gritton, Catrin Wyn-Davi - Beatus vir RV597 (Hyperion CDS44171/81)';StreamUrl='http://klassiek.avro.nl';
Cache fill: 12.50% (40960 bytes)   

Audio only file format detected.
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 44100 Hz, 2 ch, s16le, 256.0 kbit/18.14% (ratio: 32000->176400)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
AO: [oss] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
  =====  PAUSE  =====
A: 532.1 (08:52.1) of -0.0 (unknown)  0.5% 46%


And I used mplayer to listen to various audio files ( ape, FLAC and wav)  all at 16bit/44.1Khz resolution.

Code: [Select]
pcbsd# mplayer -ao oss:/dev/dsp1.vp0 CDImage.ape
MPlayer SVN-r32577-snapshot-4.2.1 (C) 2000-2010 MPlayer Team

Playing CDImage.ape.
libavformat file format detected.
[lavf] stream 0: audio (ape), -aid 0
Clip info:
 Year: 1996
 Genre: Classical
 Title: D:\RIP\CDImage
 Comment: Exact Audio Copy
 Album: Le�ons De T�n�bres - Christie, Les Arts Florissants
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, s16le, 0.0 kbit/0.00% (ratio: 0->176400)
Selected audio codec: [ffape] afm: ffmpeg (FFmpeg Monkey's Audio)
==========================================================================
AO: [oss] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
  =====  PAUSE  =====
A:1767.1 (29:27.0) of 2849.1 (47:29.1)  1.7%

As you can see, Classical music is my thing.

On the basis of a morning's listening my impression is that FreeBSD/OSS as at least the equal of Linux/ ALSA in terms of SQ.  It sounds very good to me, but to say it is superior would need further comparison.

Certainly the idea of a music server type install based on FreeBSD/OSS using a low powered system like an ATOM combined with FreeNAS with a unified ZFS for storage is an interesting one.

I might just dig out an old HD to install PC-BSD to investigate further.  The one stumbling block is not knowing if it's possible to get my Envy24HT s/card fully working in PC-BSD.  I use this for the few higher resolution audio files I have.





« Last Edit: 25 Jun 2011, 11:09 am by Eudyptes »

wilbert-vanbakel

  • Jr. Member
  • Posts: 83
  • Photoshopped Smile
    • On Facebook
Re: Open Sound System (OSS4) superior to ALSA
« Reply #11 on: 25 Jun 2011, 04:09 pm »
Thank you very much for taking the time, Eudyptes

It seems to me that your Envy24HT s/card is supported with a driver: SND_ENVY24HT according to the documentation:
http://www.freebsd.org/cgi/man.cgi?query=snd_envy24ht&manpath=FreeBSD+8-current

Were you able to set the output to bitperfect?
(sysctl dev.pcm.0.bitperfect=1)

Also: FreeBSD seems to support Alix boards:
 http://bsdmag.org/magazine/1691-embedded-bsd-freebsd-alix
 http://www.freebsdonline.com/content/view/589/506/
 http://www.roe.ch/FreeBSD_on_the_PC_Engines_ALIX_3d2
« Last Edit: 25 Jun 2011, 05:50 pm by wilbert-vanbakel »

Eudyptes

  • Jr. Member
  • Posts: 29
Re: Open Sound System (OSS4) superior to ALSA
« Reply #12 on: 29 Jun 2011, 02:51 pm »
As the PC-BSD LiveDVD does not allow for package installation like some Linux LiveCD's, I couldn't listen to mpd without installing it. 

I only had an old 15GB PATA drive to use for a BSD, so elected to install a minimal FreeBSD using the PC-BSD LiveDVD.  At least I didn't have to get my head around setting up BSD partition/slices  as the installer handled that. Configuring a network connection and loading the sound modules was easy enough, but I was left to negotiate  the rather clunky ports system to install mpd, the ncmpcpp client, and associated packages. But I ran into problems. I could only get mpeg files/stream to playback even though I had flac, faad, and ffmpeg packages installed.  I couldn't figure what I had got wrong. Stuff other than mpeg couldn't be played with mplayer either, so it was a system wide problem.

If you can , could you do a “pgk_info > packages.txt” of your system and post the list on pastebin. together with your /etc/rc.conf.  It might help me spot if something obvious was missing.

Having failed with that, I started again and installed the full PC-BSD desktop, a very sloooow process. This time mpd behaved as expected, but I hadn't realised BSD does not have the run level concept of Linux and so there's no simple/quick way to kill the desktop and go to a console as you can using init3.  It took me a while to find out to how to switch between single and multi user mode in BSD.  Even then I couldn't seem to connect to a running mpd using single user mode and so my comparison between FreeBSD/OSS and Linux/ALSA  could only be done with X etc running.

wilbert-vanbakel

  • Jr. Member
  • Posts: 83
  • Photoshopped Smile
    • On Facebook
Re: Open Sound System (OSS4) superior to ALSA
« Reply #13 on: 29 Jun 2011, 04:30 pm »
Eudyptes,

I'm still learning the details about FreeBSD myself and have made a few mistakes on the way. :)

From the handbook I gather that you need to set the PACKAGESITE env variable to "ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/Latest/" in order to get the recent build of the packages.

After installing a basis system without x11, all I had to do was pkg_add -r musicpd and configure the system.

Because I did a #portupgrade -aP, I got more packages installed than required. Although I didn't want it that way, it just takes some more disk space.

You are able to fetch the significant conf files as a gzipped tar (permissions set to: nobody:nogroup):
http://db.tt/KkYRFuJ

Your questions are welcome.

Edit: I plan to reinstall the system and provide you with the minimum packages list.

wilbert-vanbakel

  • Jr. Member
  • Posts: 83
  • Photoshopped Smile
    • On Facebook
Re: Open Sound System (OSS4) superior to ALSA
« Reply #14 on: 29 Jun 2011, 06:01 pm »
Eudyptes,  I reinstalled FreeBSD-8.2-RELEASE and selected the minimal distribution ("the smallest configuration possible")

Then I setenv PACKAGESITE to ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/Latest/

 After that I did pkg_add -r musicpd and finished with musicpd_enable in /etc/rc.conf

The total amount of required packages is 49.
I verified that flac tracks play well.
Here is the minimum package list: http://db.tt/y3uhwXn

I did without installing /usr/ports: /usr contains 358 MB data.

Code: [Select]
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ad4s1a    496M    172M    284M    38%    /
devfs          1.0K    1.0K      0B   100%    /dev
/dev/ad4s1e    496M     12K    456M     0%    /tmp
/dev/ad4s1f    3.9G    358M    3.2G    10%    /usr
/dev/ad4s1d    1.9G    4.4M    1.8G     0%    /var
/dev/ad4s1g    894G    399G    424G    49%    /var/pub

Eudyptes

  • Jr. Member
  • Posts: 29
Re: Open Sound System (OSS4) superior to ALSA
« Reply #15 on: 29 Jun 2011, 08:13 pm »
Many thanks for all that information, that's very helpful. I'll shall give this another go ASAP. 

I must admit my install was a bit of a quick hack. One mistake I seem to have made was to install the oss4 package when I don't think it was needed.

wilbert-vanbakel

  • Jr. Member
  • Posts: 83
  • Photoshopped Smile
    • On Facebook
Re: Open Sound System (OSS4) superior to ALSA
« Reply #16 on: 29 Jun 2011, 08:38 pm »
I recall making that same mistake, because I experimented with OSS4 on linux.

FreeBSD-8.2 supports my HRT Music Streamer II out of the box, I notice that I need to reboot in order to get all the sound cards available (after editing /boot/loader.conf)

FreeBSD is a production beast, I had to refresh my memory and now I manage the system different compared to 10 years ago.

I do notice that the system is more responsive than linux and I really like the concept of system administration with /etc/rc.conf and userland in /usr/local.
Anyway, I also like the sound!

wilbert-vanbakel

  • Jr. Member
  • Posts: 83
  • Photoshopped Smile
    • On Facebook
Re: Open Sound System (OSS4) superior to ALSA
« Reply #17 on: 29 Jun 2011, 09:43 pm »
I realize now that in my minimal installation I didn't include sqlite3 (for the sticker.sql database), but I have to find a client yet that utilizes this database.