Minim icon indicating copy to clipboard operation
Minim copied to clipboard

Running inside jetty: getLineIn() does not monitor

Open JamesHagerman opened this issue 9 years ago • 3 comments

Hi there,

We're trying to run Minim inside of jetty so our line in audio can be manipulated using a web interface.

While we can get the data from the line in (FFT bands bounce as expected), when we set in.enableMonitoring(); we don't get any audio out as expected.

Is there a trick to running Minim inside of jetty?

Thanks, James

JamesHagerman avatar Aug 17 '16 05:08 JamesHagerman

Ah! I found a fix!

Apparently, at some point, Java started coming with "pulse audio support". But it doesn't exactly work as expected.

Following the directions I found on http://keithp.com/blogs/Java-Sound-on-Linux/ I realized that I could swap the comments around at the bottom of the sound.properties file and then Minim works just fine from inside jetty!

The path for me, on Ubuntu 16.04.1 was: /usr/lib/jvm/default-java/jre/lib/sound.properties

This is kind of misleading though as default-java is a symbolic link:

/usr/lib/jvm$ ls -al
total 16
drwxr-xr-x   3 root root 4096 Aug 12 22:16 .
drwxr-xr-x 155 root root 4096 Aug 16 22:40 ..
lrwxrwxrwx   1 root root   24 Feb 25 12:41 default-java -> java-1.8.0-openjdk-amd64
lrwxrwxrwx   1 root root   20 Jul 20 22:49 java-1.8.0-openjdk-amd64 -> java-8-openjdk-amd64
-rw-r--r--   1 root root 2600 Jul 20 22:49 .java-1.8.0-openjdk-amd64.jinfo
drwxr-xr-x   7 root root 4096 Aug 12 22:16 java-8-openjdk-amd64

So, the real path to this file is: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/sound.properties

And the final version I used to get this working with the native PulseAudio install that comes on Ubuntu out of the box is:

#javax.sound.sampled.Clip=org.classpath.icedtea.pulseaudio.PulseAudioMixerProvider
#javax.sound.sampled.Port=org.classpath.icedtea.pulseaudio.PulseAudioMixerProvider
#javax.sound.sampled.SourceDataLine=org.classpath.icedtea.pulseaudio.PulseAudioMixerProvider
#javax.sound.sampled.TargetDataLine=org.classpath.icedtea.pulseaudio.PulseAudioMixerProvider

javax.sound.sampled.Clip=com.sun.media.sound.DirectAudioDeviceProvider
javax.sound.sampled.Port=com.sun.media.sound.PortMixerProvider
javax.sound.sampled.SourceDataLine=com.sun.media.sound.DirectAudioDeviceProvider
javax.sound.sampled.TargetDataLine=com.sun.media.sound.DirectAudioDeviceProvider

It'd be nice to add this to the docs somewhere...

JamesHagerman avatar Aug 17 '16 06:08 JamesHagerman

Glad you could work it out. I've been on quiet a long hiatus from active development, so I don't expect to be able to update docs or anything soon. But I will leave this here for future reference!

ddf avatar Aug 17 '16 14:08 ddf

@JamesHagerman Finally getting a chance to deal with some things ... where in the documentation would you expect to find this information? I can add your comment to the documentation of the enableMonitoring method, but maybe it'd make more sense at a higher level?

ddf avatar May 30 '17 21:05 ddf