Selecting audio card in jukebox mode?

Need help? Post your questions here.

Moderator: moderators

Selecting audio card in jukebox mode?

Postby afalout » Fri Jul 17, 2009 2:18 am

Hello,

I have 2 audio cards on my linux box, and I would like to use the USB one that has SPDIF connected to a high quality decoder to play my audio in jukebox mode.

With Alsa, this is usually done by specifying something like "hw:1,0" - somewhere - but I am unable to find this somewhere, well anywhere ;-)
So, the audio is played to the default output, together with all other system sounds - not too pleasant when an error dialog pops up at 110 db!

Is it possible? If not, could that become a feature request?

Much appreciated,
Andrej Falout
afalout
 
Posts: 7
Joined: Fri Jul 17, 2009 2:12 am

Postby sindre_mehus » Fri Jul 17, 2009 7:13 am

The easiest option is perhaps to set the USB device as the default audio device in Linux.

http://www.cahilig.org/select-default-a ... ubuntu-804

Alternatively, you can add the following system property when launching Subsonic from subsonic.sh (assuming you're using the standalone version of Subsonic):
Code: Select all
-Djavax.sound.sampled.SourceDataLine=#name_of_audiodevice


I haven't tried this on Linux, but it works on Windows. For instance, I have two devices called "SigmaTel Audio" and "SB Live! 24-bit External". To select the first I would do:
Code: Select all
"-Djavax.sound.sampled.SourceDataLine=#SigmaTel Audio"


Hope this helps!
Subsonic developer
User avatar
sindre_mehus
 
Posts: 1955
Joined: Tue Nov 29, 2005 6:19 pm
Location: Oslo, Norway

Postby afalout » Fri Jul 17, 2009 9:50 am

Thanks for the reply, Sindre!

Setting another card as default is not an option, since that would send all system sounds (like loud error pop-ups sounds) to the same output as music.

I tried "-Djavax.sound.sampled.SourceDataLine=#USB Audio [hw:1,0]"
and "-Djavax.sound.sampled.SourceDataLine=#USB Audio"
but no sound...

Reading http://www.jsresources.org/faq_audio.html did not help either.

I suppose the problem is in device name I'm using, but that seems to me to be correct:

andrej@polar:/var/subsonic> aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC885 Analog [ALC885 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: ALC885 Digital [ALC885 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Audio [USB Audio], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
andrej@polar:/var/subsonic> aplay -L
default:CARD=Intel
HDA Intel, ALC885 Analog
Default Audio Device
front:CARD=Intel,DEV=0
HDA Intel, ALC885 Analog
Front speakers
surround40:CARD=Intel,DEV=0
HDA Intel, ALC885 Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=Intel,DEV=0
HDA Intel, ALC885 Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Intel,DEV=0
HDA Intel, ALC885 Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Intel,DEV=0
HDA Intel, ALC885 Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Intel,DEV=0
HDA Intel, ALC885 Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Intel,DEV=0
HDA Intel, ALC885 Digital
IEC958 (S/PDIF) Digital Audio Output
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=U0x46d0x991
USB Device 0x46d:0x991, USB Audio
Default Audio Device
front:CARD=U0x46d0x991,DEV=0
USB Device 0x46d:0x991, USB Audio
Front speakers
surround40:CARD=U0x46d0x991,DEV=0
USB Device 0x46d:0x991, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=U0x46d0x991,DEV=0
USB Device 0x46d:0x991, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=U0x46d0x991,DEV=0
USB Device 0x46d:0x991, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=U0x46d0x991,DEV=0
USB Device 0x46d:0x991, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=U0x46d0x991,DEV=0
USB Device 0x46d:0x991, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=U0x46d0x991,DEV=0
USB Device 0x46d:0x991, USB Audio
IEC958 (S/PDIF) Digital Audio Output

Here is section of log file when I click on play:


1242539 [btpool0-4] INFO org.directwebremoting.impl.DefaultRemoter - Exec: nowPlayingService.getNowPlayingForCurrentPlayer()
1244605 [btpool0-4] INFO org.directwebremoting.impl.DefaultRemoter - Exec: playlistService.play()
1244608 [btpool0-4] INFO javazoom.jlgui.basicplayer.BasicPlayer - open(net.sourceforge.subsonic.io.PlaylistInputStream@2144c5bb)
1244639 [btpool0-4] INFO javazoom.jlgui.basicplayer.BasicPlayer - Create Line
1244639 [btpool0-4] INFO javazoom.jlgui.basicplayer.BasicPlayer - Create Line : Source format : MPEG1L3 44100.0 Hz, unknown bits per sample, stereo, unknown frame size, 38.28125 frames/second,
1244639 [btpool0-4] INFO javazoom.jlgui.basicplayer.BasicPlayer - Create Line : Target format: PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian
1244639 [btpool0-4] INFO javazoom.jlgui.basicplayer.BasicPlayer - Line : org.classpath.icedtea.pulseaudio.PulseAudioSourceDataLine@24c98b07
1244640 [btpool0-4] INFO javazoom.jlgui.basicplayer.BasicPlayer - startPlayback called
1244640 [btpool0-4] INFO javazoom.jlgui.basicplayer.BasicPlayer - initLine()
1244641 [btpool0-4] INFO javazoom.jlgui.basicplayer.BasicPlayer - Open Line : BufferSize=50000
1247076 [btpool0-4] INFO org.directwebremoting.impl.DefaultRemoter - Exec: nowPlayingService.getNowPlaying()

... etc ...

but no output....

Your help is very much appreciated.
afalout
 
Posts: 7
Joined: Fri Jul 17, 2009 2:12 am

Postby afalout » Fri Jul 17, 2009 9:57 am

Ah - I found the second log file: "Master Gain not supported"?

[2009-07-17 19:54:55,657] INFO DaoHelper - Checking database schema.
[2009-07-17 19:54:56,094] INFO DaoHelper - Done checking database schema.
[2009-07-17 19:54:56,252] INFO SearchService - Automatic index creation schedule
d to run every 1 day(s), starting at Sat Jul 18 03:00:00 EST 2009
[2009-07-17 19:54:56,279] INFO PodcastService - Automatic Podcast update schedul
ed to run every 24 hour(s), starting at Fri Jul 17 19:59:56 EST 2009
[2009-07-17 19:55:12,916] INFO JukeboxService - Starting jukebox player on behal
f of admin
[2009-07-17 19:55:12,933] DEBUG JukeboxService - stateUpdated : OPENING:-1:net.s
ourceforge.subsonic.io.PlaylistInputStream@244e5056
[2009-07-17 19:55:12,939] INFO PlaylistInputStream - Opening new song Deee-Lite
(The Very Best Of)/01 - Deee-Lite (Deee-Lite Theme).mp3
[2009-07-17 19:55:12,942] INFO MusicFileInfoDao - Created music file info for /d
ata/audio/Music/ARTISTS/D-E/Deee Lite/Deee-Lite (The Very Best Of)
[2009-07-17 19:55:13,337] DEBUG JukeboxService - opened : {vbr=false, mp3.crc=fa
lse, mp3.copyright=false, mp3.padding=true, mp3.channels=2, mp3.version.mpeg=1,
audio.framerate.fps=38.28125, audio.channels=2, mp3.framerate.fps=38.28125, mp3.
framesize.bytes=623, mp3.version.layer=3, mp3.frequency.hz=44100, mp3.header.pos
=0, mp3.bitrate.nominal.bps=192000, mp3.vbr.scale=0, mp3.version.encoding=MPEG1L
3, basicplayer.sourcedataline=org.classpath.icedtea.pulseaudio.PulseAudioSourceD
ataLine@342f7cfe, bitrate=192000, audio.type=MP3, mp3.mode=1, mp3.vbr=false, aud
io.samplerate.hz=44100.0, mp3.original=true}
[2009-07-17 19:55:13,337] DEBUG JukeboxService - stateUpdated : OPENED:-1
[2009-07-17 19:55:13,418] WARN JukeboxService - Error in BasicPlayer.play()
java.lang.IllegalArgumentException: Master Gain not supported
at org.classpath.icedtea.pulseaudio.PulseAudioLine.getControl(PulseAudio
Line.java:89)
at org.classpath.icedtea.pulseaudio.PulseAudioSourceDataLine.getControl(
PulseAudioSourceDataLine.java:51)
at javazoom.jlgui.basicplayer.BasicPlayer.openLine(Unknown Source)
at javazoom.jlgui.basicplayer.BasicPlayer.initLine(Unknown Source)
at javazoom.jlgui.basicplayer.BasicPlayer.startPlayback(Unknown Source)
at javazoom.jlgui.basicplayer.BasicPlayer.play(Unknown Source)
at net.sourceforge.subsonic.service.JukeboxService$JuxeboxPlayer.play(Ju
keboxService.java:140)
at net.sourceforge.subsonic.service.JukeboxService.play(JukeboxService.j
ava:72)
at net.sourceforge.subsonic.ajax.PlaylistService.convert(PlaylistService
.java:200)
at net.sourceforge.subsonic.ajax.PlaylistService.play(PlaylistService.ja
va:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.directwebremoting.impl.ExecuteAjaxFilter.doFilter(ExecuteAjaxFilt
er.java:34)
at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.j
ava:428)
at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java
:431)
at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java
:283)
at org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandle
r.java:52)
at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:1
01)
at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487
)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(Servlet
Handler.java:1093)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:265)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(Filt
erSecurityInterceptor.java:107)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(Fi
lterSecurityInterceptor.java:72)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:275)
at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTra
nslationFilter.java:166)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:275)
at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFil
ter(AnonymousProcessingFilter.java:125)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:275)
at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(R
ememberMeProcessingFilter.java:142)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:275)
at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doF
ilter(SecurityContextHolderAwareRequestFilter.java:81)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:275)
at org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicPr
ocessingFilter.java:173)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:275)
at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProces
singFilter.java:271)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:275)
at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:1
10)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:275)
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilte
r(HttpSessionContextIntegrationFilter.java:249)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:275)
at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.jav
a:149)
at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.j
ava:98)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(Servlet
Handler.java:1084)
at net.sourceforge.subsonic.filter.RequestEncodingFilter.doFilter(Reques
tEncodingFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(Servlet
Handler.java:1084)
at net.sourceforge.subsonic.filter.ParameterDecodingFilter.doFilter(Para
meterDecodingFilter.java:54)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(Servlet
Handler.java:1084)
at net.sourceforge.subsonic.filter.BootstrapVerificationFilter.doFilter(
BootstrapVerificationFilter.java:54)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(Servlet
Handler.java:1084)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:3
60)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.jav
a:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:1
81)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:7
12)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:1
39)
at org.mortbay.jetty.Server.handle(Server.java:313)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:50
6)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnectio
n.java:844)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.ja
va:396)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool
.java:442)
afalout
 
Posts: 7
Joined: Fri Jul 17, 2009 2:12 am

Postby afalout » Thu Jul 23, 2009 12:48 am

Help? Anyone? Nobody using non-default audio card to play music?
afalout
 
Posts: 7
Joined: Fri Jul 17, 2009 2:12 am

Solution - sort of

Postby afalout » Mon Aug 03, 2009 6:04 am

To find out names of audio devices as Java see them, compile and run this program:


import java.io.*;
import javax.sound.sampled.*;

public class audioDevList{
public static void main(String args[]){

//Get and display a list of
// available mixers.

Mixer.Info[] mixerInfo =
AudioSystem.getMixerInfo();
System.out.println("Available mixers:");
for(int cnt = 0; cnt < mixerInfo.length;
cnt++){
System.out.println(mixerInfo[cnt].
getName());
}//end for loop
}
}

On my system, this shows:

polar:/var/subsonic # java audioDevList
Available mixers:
Intel [plughw:0,0]
Intel [plughw:0,1]
Intel [plughw:0,2]
Audio [plughw:1,0]
U0x46d0x991 [plughw:2,0]
Java Sound Audio Engine
Port Intel [hw:0]
Port Audio [hw:1]
Port U0x46d0x991 [hw:2]

Now edit sound.properties in Java installation used to run SubSonic and add:

javax.sound.sampled.Clip=#Audio [plughw:1,0]
javax.sound.sampled.Port=#Port Audio [hw:1]
javax.sound.sampled.SourceDataLine=#Audio [plughw:1,0]
javax.sound.sampled.TargetDataLine=#Audio [plughw:1,0]

In my case, file was: /usr/lib64/jvm/java-1.6.0-sun-1.6.0/jre/lib/sound.properties

That works, but now ALL Java apps on my system output audio to that device - which defeats the purpose of having ONLY music played on that device, avoiding system sounds like incoming mail notifications blowing your ears out at 110 decibels....

Adding -Djavax.sound.sampled.SourceDataLine="#Audio [plughw:1,0]" to java command line does not work in any combination I could think of, with or without other lines I added to sound.properties file.

Does anyone know how to achieve this for SubSonic only, without using system-wide configuration file?

Thanks,
Andrej Falout
afalout
 
Posts: 7
Joined: Fri Jul 17, 2009 2:12 am

Postby maxslug » Sun Mar 06, 2011 9:11 pm

Finally, thanks afalout!

For all you non java people (like me) here's the compile steps:

  • Copy the above code into a file called 'audioDevList.java'
  • javac audioDevList.java
  • java audioDevList


I get this output:
Code: Select all
Available mixers:
NVidia [plughw:0,3]
NVidia [plughw:0,7]
NVidia [plughw:0,8]
NVidia [plughw:0,9]
Intel [plughw:1,0]
CX8801 [plughw:2,0]
Port NVidia [hw:0]
Port Intel [hw:1]
Port CX8801 [hw:2]



Now I modify /usr/bin/subsonic (on Ubuntu 10.x), might be subsonic_sh for you. I added the following line. Note the single quotes around the whole line. The # and space require it.

Code: Select all
  '-Djavax.sound.sampled.SourceDataLine=#NVidia [plughw:0,7]' \


'service subsonic restart' et viola!
-m[/code]
maxslug
 
Posts: 44
Joined: Tue Oct 26, 2010 11:23 pm

Postby maxslug » Sun Mar 06, 2011 9:27 pm

Added to wiki :
https://sourceforge.net/apps/mediawiki/ ... rs#Jukebox

Future readers : please add solutions there as they are found
maxslug
 
Posts: 44
Joined: Tue Oct 26, 2010 11:23 pm

Postby johngc » Sat Jul 09, 2011 4:59 pm

I have tried the above as I am in a similar situation but when I do:

Code: Select all
sudo javac audioDevLisat.java


I get

Code: Select all
audioDevLisat.java:4: class audioDevList is public, should be declared in a file named audioDevList.java
public class audioDevList{
       ^
1 error


I know nothing about java really so have no idea what to do next!

Thanks
johngc
 
Posts: 4
Joined: Sat Jul 09, 2011 4:57 pm

Postby maxslug » Sat Jul 09, 2011 6:40 pm

johngc wrote:I have tried the above as I am in a similar situation but when I do:

Code: Select all
sudo javac [b]audioDevLisat[/b].java




Spelling counts... the file name has to match the class name.

-m
maxslug
 
Posts: 44
Joined: Tue Oct 26, 2010 11:23 pm

Postby johngc » Sat Jul 09, 2011 8:15 pm

:oops:

And that's why you shouldn't try to do everything on your iPad!!

Thank you.
johngc
 
Posts: 4
Joined: Sat Jul 09, 2011 4:57 pm

Postby johngc » Sun Jul 10, 2011 6:46 am

Well the script worked after I *ahem* changed the spelling...

and I get this output:

Code: Select all
Available mixers:
PulseAudio Mixer
NVidia [default]
NVidia [plughw:0,0]
NVidia [plughw:0,1]
NVidia [plughw:0,3]
Port NVidia [hw:0]


I then added the line as directed in my /usr/bin/subsonic file (does it matter where is should be in it?)

but when I restart subsonic, I get:

Code: Select all
* Restarting Subsonic Daemon subsonic
/usr/bin/subsonic: 124: -Djavax.sound.sampled.SourceDataLine=#NVidia [default]: not found
Started Subsonic [PID 16890, /var/subsonic/subsonic_sh.log]
   ...done.


It claims not to find it with every setting , 0,0 0,1 0,3 etc.

Code: Select all
* Restarting Subsonic Daemon subsonic
/usr/bin/subsonic: 124: -Djavax.sound.sampled.SourceDataLine=#NVidia [plughw:0,0]: not found
Started Subsonic [PID 16655, /var/subsonic/subsonic_sh.log]
   ...done.
johngc
 
Posts: 4
Joined: Sat Jul 09, 2011 4:57 pm

Postby maxslug » Mon Jul 11, 2011 12:01 am

johngc wrote:
I then added the line as directed in my /usr/bin/subsonic file (does it matter where is should be in it?)


Hi John, yes position counts too :) It's got to be on the extended line that starts the process. the backslash (\) wraps a long line to make it more readable. This line will start with 'java'or '$JAVA' or '${JAVA}'.

Here's a snip of my file for reference :

Code: Select all
${JAVA} -Xmx${SUBSONIC_MAX_MEMORY}m \
  -Dsubsonic.home=${SUBSONIC_HOME} \
  -Dsubsonic.host=${SUBSONIC_HOST} \
  -Dsubsonic.port=${SUBSONIC_PORT} \
  -Dsubsonic.httpsPort=${SUBSONIC_HTTPS_PORT} \
  -Dsubsonic.contextPath=${SUBSONIC_CONTEXT_PATH} \
  -Dsubsonic.defaultMusicFolder=${SUBSONIC_DEFAULT_MUSIC_FOLDER} \
  -Dsubsonic.defaultPodcastFolder=${SUBSONIC_DEFAULT_PODCAST_FOLDER} \
  -Dsubsonic.defaultPlaylistFolder=${SUBSONIC_DEFAULT_PLAYLIST_FOLDER} \
  -Djava.awt.headless=true \
  '-Djavax.sound.sampled.SourceDataLine=#NVidia [plughw:0,7]' \
  -jar subsonic-booter-jar-with-dependencies.jar > ${LOG} 2>&1 &


Make sure there are no spaces after any of the backslashes.

-m
maxslug
 
Posts: 44
Joined: Tue Oct 26, 2010 11:23 pm

Postby johngc » Tue Jul 12, 2011 4:41 pm

Thank you - all working now :D
johngc
 
Posts: 4
Joined: Sat Jul 09, 2011 4:57 pm

Postby maxslug » Tue Jul 12, 2011 4:44 pm

johngc wrote:Thank you - all working now :D


You're welcome. Hopefully Soundcard selection becomes a gui feature for the Jukebox mode.

-m
maxslug
 
Posts: 44
Joined: Tue Oct 26, 2010 11:23 pm

Next

Return to Help

Who is online

Users browsing this forum: No registered users and 24 guests