endru
Posts: 10
Joined: Wed Jul 19, 2017 7:34 am

piZeroAudio, JLayer, Sound Problem

Wed Jul 19, 2017 7:45 am

Hi guys!

I own an Raspberry PI 3 Model B extended by an piZeroAudio Sound Card. My PI is running Ubuntu Mate. The card is recognized by the system, I checked the sound via "Tone settings" -> "Speaker test". The card is recognized as "snd_rpi_hifiberry_dac".

I developed an application which plays music via stream. It runs without problems on Windows an OS X, but not on that PI. Actually it runs, but it does not create sound output - even no exception occurs!

The sound-card is configured as default card (shown in tone settings).

Oracles JDK 8 is installed!

The Java code which I a use to get the line:

Code: Select all


protected AudioFormat getAudioFormat() {
        fmt = new AudioFormat(44100, 16, 2, true, false);

        return fmt;
    }

    protected DataLine.Info getSourceLineInfo() {
        AudioFormat fmt = getAudioFormat();


        DataLine.Info info = new DataLine.Info(SourceDataLine.class, fmt);
        return info;
    }

 public void createSource() throws JavaLayerException {
        Throwable t = null;
        try {

            Line line = AudioSystem.getLine(getSourceLineInfo());

            if (line instanceof SourceDataLine) {
                source = (SourceDataLine) line;
                source.open(fmt);
                source.start();
            }
        } catch (RuntimeException ex) {
            t = ex;
        } catch (LinkageError ex) {
            t = ex;
        } catch (LineUnavailableException ex) {
            t = ex;
        }

        if (source == null) {
            throw new JavaLayerException("cannot obtain source aduio line", t);
        }
    }
I already looked through other forum posts according to sound problems. But I did not find any which seems to describe a similar problem.

I'd appreciate your help!

Thanks,

Return to “Java”

Who is online

Users browsing this forum: No registered users and 4 guests