Package net.avadeaux.klipspringer.decoder


package net.avadeaux.klipspringer.decoder

Classes for decoding audio data, which supports FLAC by integrating integrating libFLAC via the Java Native Interface. Also provides interfaces for handling the formats that Java supports natively (WAV, AIFF and Au). Provides two alternative APIs:

Here is a minimal example that plays a FLAC file using FlacAudioInputStream:

    AudioInputStream stream = FlacAudioInputStream.getInstance("file_to_play.flac");
    SourceDataLine line = AudioSystem.getSourceDataLine(stream.getFormat());
    line.open(stream.getFormat());
    line.start();
    byte[] b = new byte[2048 * 3];
    while (true) {
        int n = stream.read(b);
        if (n < 0) { break; }
        line.write(b, 0, n);
    }
    line.drain();

Other examples are can be found in the examples directory available with the distribution of this package.

This is part of the Klipspringer music playing software
© 2014–2024 Jesper Larsson, released as free software under GPL version 3 or later.
See klipspringer.avadeaux.net for more information.