Opened 10 years ago

Last modified 10 years ago

#12229 closed enhancement

Unit test for audio playback on Linux — at Version 1

Reported by: Don-vip Owned by: team
Priority: normal Milestone: 15.12
Component: Core audio Version:
Keywords: unit test audio linux debian ubuntu alsa java sound jenkins pulseaudio wav Cc: stoecker, bastiK, simon04, naoliv, malenki, skyper, mdk

Description (last modified by Don-vip)

I have added a unit test for Audio (wav) playback in r9144:9146.

It works fine on Windows, but I can't get it working on our Jenkins/Linux server. The test results in:

Java 7:

javax.sound.sampled.LineUnavailableException
	at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openImpl(PulseAudioMixer.java:714)
	at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openLocal(PulseAudioMixer.java:588)
	at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openLocal(PulseAudioMixer.java:584)
	at org.classpath.icedtea.pulseaudio.PulseAudioMixer.open(PulseAudioMixer.java:579)
	at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.open(PulseAudioDataLine.java:94)
	at org.classpath.icedtea.pulseaudio.PulseAudioSourceDataLine.open(PulseAudioSourceDataLine.java:75)
	at org.classpath.icedtea.pulseaudio.PulseAudioSourceDataLine.open(PulseAudioSourceDataLine.java:90)
	at org.openstreetmap.josm.tools.AudioPlayer.run(AudioPlayer.java:348)

Java 8:

java.lang.IllegalArgumentException: No line matching interface SourceDataLine supporting format PCM_UNSIGNED 22050.0 Hz, 8 bit, mono, 1 bytes/frame,  is supported.
java.lang.IllegalArgumentException: No line matching interface SourceDataLine supporting format PCM_UNSIGNED 22050.0 Hz, 8 bit, mono, 1 bytes/frame,  is supported.
	at javax.sound.sampled.AudioSystem.getLine(AudioSystem.java:479)
	at org.openstreetmap.josm.tools.AudioPlayer.run(AudioPlayer.java:347)

Maybe because we don't have any sound card on the server.

I assume it is possible to use a virtual sound device as a workaround but I can't find how to do it.

I have installed pulseaudio server (apt-get install pulseaudio) and started it (service pulseaudio start).

When I try to play wav file manually with jenkins user I get:

jenkins@josm:~$ aplay /var/lib/jenkins/jobs/JOSM/workspace/test/data/regress/6851/20111003_121226.wav
Failed to create secure directory (/run/user/0/pulse): Permission denied
Failed to create secure directory (/run/user/0/pulse): Permission denied
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Access denied

aplay: main:722: audio open error: Connection refused

I have added jenkins user to audio and pulse groups, does not change anything.

When trying as root I get:

root@josm:~# aplay /var/lib/jenkins/jobs/JOSM/workspace/test/data/regress/6851/20111003_121226.wav
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Access denied

aplay: main:722: audio open error: Connection refused

Using null it seems to work, but I don't know if we can use it as default, or tell Java to use it:

root@josm:~# aplay -D null /var/lib/jenkins/jobs/JOSM/workspace/test/data/regress/6851/20111003_121226.wav
Playing WAVE '/var/lib/jenkins/jobs/JOSM/workspace/test/data/regress/6851/20111003_121226.wav' : Unsigned 8 bit, Rate 22050 Hz, Mono

I'm kind of lost here, can anyone with good knowledge of Audio on Linux please help me?

Change History (1)

comment:1 by Don-vip, 10 years ago

Cc: stoecker bastiK simon04 naoliv malenki skyper mdk added
Description: modified (diff)
Milestone: 15.12

A little help from a Linux guru? :)

Note: See TracTickets for help on using tickets.