@Override
    public int readSampledBytes(int nBytes, byte[] samplesBuff) {

        Header header = null;


        try {
            header = stream.readFrame();

        } catch (IOException e) {
            e.printStackTrace();
        }
        if (header == null) {
            return 0;
        }
                if (decoder.channels == 0) {
                    int channels = (header.mode() == Header.MODE_SINGLE_CHANNEL) ? 1 : 2;
                    float sampleRate = header.frequency();
                    int sampleSize = 16;
                    audioFormat = new AudioFormat(
                            AudioFormat.Encoding.PCM_SIGNED, sampleRate,
                            sampleSize, channels, channels * (sampleSize / 8),
                            sampleRate, true);
                    // big endian
                    SourceDataLine.Info info = new DataLine.Info(
                            SourceDataLine.class, audioFormat);

                        //decoder.initOutputBuffer(line, channels);
                }
//                while (line.available() < 100) {
//                    Thread.yield();
//                    Thread.sleep(200);
//                }
        try {
            decoder.decodeFrame(header, stream);
            samplesBuff = decoder.getBuffer();

            return decoder.getBufferSize();

        } catch (IOException e) {
            e.printStackTrace();
        }

        return 0;
    }