|
Audio Asylum Thread Printer Get a view of an entire thread on one page |
For Sale Ads |
121.209.219.128
In Reply to: RE: Update: PulseAudio currently does not support dynamically changing sample rate posted by John Swenson on November 30, 2010 at 20:11:42
Most players these days are based on gstreamer, which outputs to pulseaudio.
You can get a JACK output plugin for gstreamer, but JACK has the same problem (single master sample rate, changeable only by killing and restarting the daemon). Not practical for listening to multiple audio formats in one session.
Players not based on gstreamer are severely limited in their support of various audio formats.
And you want to stay away from ALSA. dmix is a poor quality mixing engine, considerably worse in quality compared to pulseaudio and JACK. Which is why Linux distributions are moving away from ALSA as an audio framework.
All in all, audio on Linux is a real nightmare. Gone are the good old days when Linux apps could just change the OSS sample rate on the fly. Now we have OSS emulation on top of ALSA, ALSA emulation on top of OSS, pulseaudio as a virtual audio device for ALSA, JACK on top of pulseaudio, and forget any romantic notion of bit-perfect for anything other than 16/44.1!
Follow Ups:
"All in all, audio on Linux is a real nightmare. Gone are the good old days when Linux apps could just change the OSS sample rate on the fly. Now we have OSS emulation on top of ALSA, ALSA emulation on top of OSS, pulseaudio as a virtual audio device for ALSA, JACK on top of pulseaudio, and forget any romantic notion of bit-perfect for anything other than 16/44.1!"
No, it really isn't. People do insist on complicating it, though, and for no good reason. Most Linux audio players have the option of talking to the sound card directly by specifying hw;0,0. You can even do it, as I did years ago, with something as ancient as XMMS (http://www.xmms.org/index.html) You get bit-perfect output with on the fly sample rate switching.
I currently get bit-perfect output and on-the-fly sample rate switching from from 44.1 all the way to 192 with nary a hiccup on USB Audio Class 2 hardware. It was that easy even three years ago.
Nick
*** People do insist on complicating it, though, and for no good reason. ***
There is a good reason for that complication, at least for me. There is only one audio device on my system, and it needs to be shared across all apps, not just the audio player.
This is not a dedicated system for playing back music - this is a system for doing other things, music playback needs to be mixed in with system notification sounds, web browsing, video playback etc.
I understand that sharing the audio device across multiple apps may not be a requirement for you. However, we all have different requirements.
"There is a good reason for that complication, at least for me. There is only one audio device on my system, and it needs to be shared across all apps, not just the audio player.
This is not a dedicated system for playing back music - this is a system for doing other things, music playback needs to be mixed in with system notification sounds, web browsing, video playback etc.
I understand that sharing the audio device across multiple apps may not be a requirement for you. However, we all have different requirements. "
Christine, let me see if I understand this: Your setup has nothing to do with an audiophile grade sound card? This is just an Ubuntu desktop that you're using as a personal computer?
Laptop. Motherboard HD Audio. Cheap Sennheiser earbuds.
I used to have a dedicated external USB audio device, headphone amp, expensive phones (Etymotics, Audio Technica) blah blah blah
I looked like an audiophool in the plane and on the train. It took minutes to set up everything for a listen.
Then one day I realised that the sound straight out of the motherboard actually sounded pretty decent.
I haven't used the exotic stuff now for a year (apart from my Sleek Audio - will still use that on a plane), and if anything I enjoy music more because it's less cumbersome to set up. I can stop it and start it anytime.
Of course, I still have the dedicated player in the main system for serious listening. And my studio setup with the DAW etc.
Oops. Typo, I meant "No, it really *is* that easy..."
If you are using gstreamer its easy, just change the output plugin to alsasink instead of pulsesink and any gstreamer app will go direct to alsa. The easiest way to do this is with the program gstreamer-properties, run it and it pops up a little tool, change the default output sink to ALSA and set the properties to the name of the device you want to send the audio to. Thats it, from then on any gstreamer app will go there unless it has its own UI for setting the output.
On the dmix issue, yep dmix is garbage, why use it? Dmix is an alsa plugin it doesn't HAVE to be there. If you set the alsa device to be the actual hardware device you are guaranteed to bypass dmix.
If you have an app that ONLY outputs to the default device you can always change the asoundrc file so the default device points directly to a specific hardware device rather than going through dmix.
So the setup to make things work nicely for good audio in linux is to disable pulseaudio so it doesn't grab your good sound device. Set gstreamer default sink to the specific alsa device, and change the asoundrc file so the default alsa device is pointing to your specific hardware device.
With that then anything should just work. Nothing gets resampled, the card automatically plays the samples at what ever rate is in the file.
You give up some things by doing this, without a mixer only one program can output to the output device at a time. This means you can't have GUI beeps and stuff come out over the good speakers.
There is one wrinkle here, you might need to setup a "plug" interface on your output device. For example a M-audio audiophile 24/96 ONLY takes 32bit samples. Very few applications actually output 32 bit samples. For this you need to setup a plug layer in front of the hardware driver. This will stuff zeros onto the back of the samples to keep the 24/96 happy. It will also automatically resample IF the hardware does not support the sample rate in the file. If you don't use a plug layer it will NEVER resample in the alsa layer, so if the hardware doesn't support the sample rate you get no sound at all. Many soundcards will automatically take either 16 or 24 bit data so you don't need a plug layer with them. Setting up a plug layer is just a couple lines in the asoundrc file.
It really isn't that hard.
John S.
*** You give up some things by doing this, without a mixer only one program can output to the output device at a time. This means you can't have GUI beeps and stuff come out over the good speakers. ***
This is not acceptable for a general purpose system, not for me anyway. For a dedicated music player, perhaps. Some of us do use Ubuntu for other things besides listening to music.
He is suggesting that you buy two sets of speakers. Set a little dinky pair of $5 speakers as the default output, and then configure your music player (and only your music player) to output to your real speakers.
That is actually more convenient on a general-use computer because it is highly unlikely you want your music and your general computer sounds (IM/e-mail notices, etc) to be played at the same volume anyway.
Post a Followup:
FAQ |
Post a Message! |
Forgot Password? |
|
||||||||||||||
|
This post is made possible by the generous support of people like you and our sponsors: