MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance.
Nightingale Forums - Selectable audio device

Nightingale Forums

Full Version: Selectable audio device
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I just stumbled upon Nightingale. I like everything about it but I do have one feature request (this pertains to linux): have the audio device selectable by the user. Nightingale appears currently to use the default audio device which on most installations now is PulseAudio. Enabling the audio to be sent directly to one of the alsa hardware devices would enable bit-perfect playback rather than the resampled playback that Pulse requires.

Of course, this might already be possible but I haven't been able to find out how.
We rely on the default gstreamer way here. I have no idea if we could modify that on our side. We use your systems native gstreamer though.
(11-25-2013, 05:11 AM)freaktechnik Wrote: [ -> ]We rely on the default gstreamer way here. I have no idea if we could modify that on our side. We use your systems native gstreamer though.

I just figured out how to change gstreamer's default music device. Works great now. I'm a convert.
Great! Could you maybe post a link to an explanation how to do that or give a short explanation for future reference?
(11-26-2013, 08:04 PM)freaktechnik Wrote: [ -> ]Great! Could you maybe post a link to an explanation how to do that or give a short explanation for future reference?
OK...

On most modern linux distributions the default sound system is Pulseaudio, and by default gstreamer sends all its output through pulse. This subjects the output to resampling, which is necessary to mix audio streams from different sources. If one wants bit-perfect audio, one must bypass pulse and send the output directly to alsa. There are (at least) two ways to do this.

The first way is to launch gconf-editor. Once this is up, open up the tree on the left to /-->system-->gstreamer-->0.10-->default. This should reveal a number of keys in the right pane. Find the one labeled "musicaudiosink". By default it should have a value of "autoaudiosink". You will want to change this key to point to the hardware device that alsa outputs to. On my system, for example, I have hdaudio going through HDMI to a receiver, and the hardware device is "hw:0,7". Thus, on my system, I would change this entry to "alsasink device=hw:0,7" (without the quotes). Nightingale will then play unresampled audio through this device. Once you quit Nightingale, you can either leave this value unchanged or change it back to the default value of "autoaudiosink".

Another way to do this is on the command line as follows:
Code:
gconftool-2 --type string --set /system/gstreamer/0.10/default/musicaudiosink "alsasink device=hw:0,7"

On my system, I made a launcher for Nightingale which executes the following line:
Code:
gconftool-2 --type string --set /system/gstreamer/0.10/default/musicaudiosink "alsasink device=hw:0,7" && /home/steve/.mozilla/Nightingale/nightingale && gconftool-2 --type string --set /system/gstreamer/0.10/default/musicaudiosink "autoaudiosink"

This changes "musicaudiosink" to use the alsa output, then launches Nightingale. When Nightingale is closed, it the changes "musicaudiosink" back to its default value.
This is very interesting information. Is there no resampling whatsoever going on this way? Until now I've only managed to obtain bit-perfect output at 41kHz and 48kHz, all other rates get converted to one of those (which may not be audible under normal listening conditions).
Any idea how to tune it for a KDE desktop, which already provides a selective choice of output device for music, video, notifications, etc? I'm pretty sure that when I last used Nightingale in a KDE desktop under Linux Mint Debian, output went to my HDMI-connected AV amp without having to use pavucontrol to switch the stream, but on my current Kubuntu 14.04 set-up output goes to the internal speakers which are configured to be used only for (soundtracks of) video and notification sounds. It's possible of course that my LMDE system got configured correctly when I still used the Cinnamon GTk-based desktop rather than KDE.

NB: gconf-editor shows that my Kubuntu system has no 'musicaudiosink' key in the default gstreamer properties, only audiosink (set to esdsink) and audiosrc. Creating the key seems to have no effect - but then maybe I haven't understood how to determine the correct hw device specification, how does one do that?

Of course, someone might also write an add-in that lets you pick the desired output device from the list of available options. Possibly even with a fallback device, as when you want to listen to music when that receiver is not connected to HDMI out (but you rather have a pair of headphones plugged in) ...