Selecting audio card in jukebox mode?

Need help? Post your questions here.

Moderator: moderators

Re: Selecting audio card in jukebox mode?

Postby ekid » Sat Nov 19, 2011 1:22 am

It would be superb to be able to set the soundcard in the configuration file and see available card options (as the above java program produces). At the moment the helpful edit to subsonic.sh that Sindre proposed gets overwritten with every Subsonic upgrade.
ekid
 
Posts: 5
Joined: Fri Nov 18, 2011 11:12 pm

Re: Selecting audio card in jukebox mode?

Postby jammer » Tue Dec 20, 2011 1:23 am

+1 for this thread. I am a ubuntu 10.04 user that had to install the proprietary java package from Sun to get the jukebox to work. Using SPDIF output from my htpc. After the Sun java installation, the jukebox worked fine (except for a thump sound between songs) for a week then mysteriously stopped working over SPDIF (but gave analog output fine). Using the java snippet and modifying my subsonic script, I got sound working over the SPDIF again tonight. I use a software mixer in ALSA to make the card resample everthing sent to it to 48000 kHz so that the SPDIF interface can accept it. For me, it looks like "SB [plughw:0,1]" in the java tool. As a bonus, after editing subsonic, there is no longer a "thump" sound when switching tunes. This is truly a great Christmas present for me. Thank you Sindre!
jammer
 
Posts: 9
Joined: Mon Jul 25, 2011 12:26 am

Re: Selecting audio card in jukebox mode?

Postby spookybathtub » Sun Dec 09, 2012 9:41 pm

How can one do this with a Tomcat installation of Subsonic?
spookybathtub
 
Posts: 110
Joined: Thu Oct 07, 2010 7:13 am

Re: Selecting audio card in jukebox mode?

Postby spookybathtub » Mon Mar 03, 2014 9:46 pm

I finally found the correct answer. Create executable /var/lib/tomcat7/bin/setenv.sh with a line like this:
Code: Select all
export JAVA_OPTS="$JAVA_OPTS '-Djavax.sound.sampled.SourceDataLine=#NVidia [plughw:0,0]'"

Note the single quotes inside of double quotes. If your CATALINA_BASE is somewhere else, you'll have to adjust the path.
There are other possible places to set this variable, but setenv.sh is preferred because it will not be overwritten by Tomcat upgrades, according to the Tomcat documentation. This is working for me on Tomcat7 on two machines running Raspbian and Ubuntu.
spookybathtub
 
Posts: 110
Joined: Thu Oct 07, 2010 7:13 am

Re: Selecting audio card in jukebox mode?

Postby zycker » Thu Jun 19, 2014 10:27 am

Hi guys,
I've got the same problem as you here, I'm actually running subsonic 4.9 on Debian Wheezy on my Cubieboard 2, everything works fine exept the audio output is the jack audio and I want hdmi audio output (that I did achieved with my Raspberry Pi).
Here are the details :

Code: Select all
:~$ java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) Client VM (build 25.0-b70, mixed mode)

:~$ javac -version
javac 1.8.0

:~$ java audioDevList
Available mixers:
sunxicodec [default]
sunxicodec [plughw:0,0]
[size=150]sunxisndhdmi [plughw:1,0][/size]
Port sunxicodec [hw:0]
Port sunxisndhdmi [hw:1]



My /usr/bin/subsonic :
Code: Select all
  -Djava.awt.headless=true \
  '-Djavax.sound.sampled.SourceDataLine=#sunxisndhdmi [plughw:1,0]' \
  -verbose:gc \


I've got an error in Subsonic's log, just :
Code: Select all
ERROR   JukeboxService   Error in jukebox: java.lang.IllegalArgumentException: No line matching interface SourceDataLine supporting format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, big-endian is supported.


I can run this and hear the sound through my hdmi amplifier :
Code: Select all
:~$ speaker-test -twav -c2

speaker-test 1.0.25

Playback device is hw:1,0
Stream parameters are 48000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 4096 to 32768
Period size range from 1024 to 8192
Using max buffer size 32768
Periods = 4
was set period_size = 8192
was set buffer_size = 32768
0 - Front Left
1 - Front Right


Any idea how I can get it works ?
zycker
 
Posts: 9
Joined: Wed Aug 28, 2013 4:43 pm

Re: Selecting audio card in jukebox mode?

Postby spookybathtub » Thu Jun 19, 2014 5:07 pm

That error says the audio hardware can't support that particular format of audio. Try speaker-test at 44100Hz to see if that works. Just add -r 44100 to the command line. Maybe there's a list somewhere of Cubieboard's supported audio formats.
spookybathtub
 
Posts: 110
Joined: Thu Oct 07, 2010 7:13 am

Re: Selecting audio card in jukebox mode?

Postby zycker » Fri Jun 20, 2014 3:13 pm

It does work :
Code: Select all
n:~$ speaker-test -c2 -r 44100

speaker-test 1.0.25

Playback device is default
Stream parameters are 44100Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
Rate set to 44100Hz (requested 44100Hz)
Buffer size range from 4096 to 32768
Period size range from 1024 to 8192
Using max buffer size 32768
Periods = 4
was set period_size = 8192
was set buffer_size = 32768
0 - Front Left
1 - Front Right

But still no music out of HDMI. The thing I don't understand, if I modify my /usr/bin/subsonic to this:
Code: Select all
  -Djavax.sound.sampled.SourceDataLine=#ALSA \
  -verbose:gc \

It should use the audio output set in alsa but it still play through audio jack, alsamixer show me that sunxi-sndhdmi is well set.
The worst part is that one time I did get music through hdmi for 2 songs, after messing up with alsamixer but it stops after that and nothing ever since.
zycker
 
Posts: 9
Joined: Wed Aug 28, 2013 4:43 pm

Re: Selecting audio card in jukebox mode?

Postby spookybathtub » Fri Jun 20, 2014 3:15 pm

There might be something unique about those two songs. Try playing them again.
spookybathtub
 
Posts: 110
Joined: Thu Oct 07, 2010 7:13 am

Re: Selecting audio card in jukebox mode?

Postby zycker » Sat Jun 21, 2014 7:43 am

In fact I've tried few different songs in different formats, bitrate but still have audio through the jack, witch has btw a very low level :(
I'll try with another distro to see it it goes any better.
zycker
 
Posts: 9
Joined: Wed Aug 28, 2013 4:43 pm

Re: Selecting audio card in jukebox mode?

Postby zycker » Sun Jun 22, 2014 2:49 pm

Ok, I know it won't help anyone but I manage to get audio through HDMI output from jukebox by switch from Cubian to Lubuntu on my Cubieboard2 after installing Java 1.8 otherwise I did get various Java errors.
zycker
 
Posts: 9
Joined: Wed Aug 28, 2013 4:43 pm

Re: Selecting audio card in jukebox mode?

Postby djkarn105 » Mon Oct 27, 2014 9:51 pm

Sorry to ressurect an old thread but I recently updated to the latest version of subsonic and was looking for the subsonic.sh file to apply this change and it appears that it's no longer in /var/subsonic
did it move? I'm on xubuntu 14.04 what is the procedure for making this happen if subsonic.sh is gone?
djkarn105
 
Posts: 4
Joined: Sat Oct 25, 2014 7:02 am

Re: Selecting audio card in jukebox mode?

Postby wintrmute » Tue Feb 10, 2015 1:11 am

I thought I'd post a shorter, one-line program to print out Java's list of sound output options that doesn't need compiling.
You need to have "scala" installed (ie. apt-get install scala) but then you can just run scala at the command line by typing "scala" and then entering the following two lines at the "scala>" prompt:
Code: Select all
import javax.sound.sampled._
AudioSystem.getMixerInfo.toList.map(_.getName).foreach(println)


Here's another version, which is a tiny bit longer, but which prints out both the ID to use, and *also* a description of what it is, which is helpful when you have a lot of similar outputs.
Code: Select all
import javax.sound.sampled._
val mixerList = AudioSystem.getMixerInfo.toList
mixerList.foreach( (i => println(s"${i.getName} = ${i.getDescription}") )


Scala uses Java under the hood, so you get the same results as if you'd used a compiled Java app.
Last edited by wintrmute on Tue Feb 10, 2015 1:22 am, edited 2 times in total.
wintrmute
 
Posts: 12
Joined: Tue Feb 10, 2015 12:46 am

Re: Selecting audio card in jukebox mode?

Postby wintrmute » Tue Feb 10, 2015 1:13 am

djkarn105 wrote:Sorry to ressurect an old thread but I recently updated to the latest version of subsonic and was looking for the subsonic.sh file to apply this change and it appears that it's no longer in /var/subsonic
did it move? I'm on xubuntu 14.04 what is the procedure for making this happen if subsonic.sh is gone?


On Ubuntu 14.04 (and probably later versions too for a while) you should edit /etc/default/subsonic as that file specifically exists for you to put options in.
I think you'll need to add something like:
Code: Select all
JAVA_OPTS="-Djavax.sound.sampled.SourceDataLine=#Port PCH [hw:1]"
wintrmute
 
Posts: 12
Joined: Tue Feb 10, 2015 12:46 am

Re: Selecting audio card in jukebox mode?

Postby wintrmute » Tue Feb 10, 2015 1:51 am

Hmm. Is the information here still valid on Subsonic 5.1?
I've tried setting the javax.sound.sampled.SourceDataLine property in several places now, including just editting /usr/bin/subsonic to pass it directly to java, but it never seems to take effect.

subsonic.log mentions:
Code: Select all
[2015-02-10 12:48:26,304] DEBUG JukeboxService - Opened line org.classpath.icedtea.pulseaudio.PulseAudioSourceDataLine@2203ef52


On Ubuntu (and I think Debian?) java is configured in /etc/java-7-openjdk/sound.properties to use PulseAudio; I thought we'd be overridding that with the stuff above, but maybe not.. But while I don't mind using pulseaudio, the problem now changes to how to configure THAT to use different sound interfaces, from the command line. argh!
wintrmute
 
Posts: 12
Joined: Tue Feb 10, 2015 12:46 am

Re: Selecting audio card in jukebox mode?

Postby mr-mac » Tue Apr 28, 2015 9:23 am

Got latest subsonic on fedora (via latest vortexbox) and got same issue.

Anyone know how to check devices and set audio device to output via in fedora20?

Thanks ;)
mr-mac
 
Posts: 2
Joined: Fri Apr 24, 2015 8:02 am

PreviousNext

Return to Help

Who is online

Users browsing this forum: No registered users and 13 guests