Skip to content

WavReader_Java: toInt conversion bug #1

@schurli

Description

@schurli

WavReader.toInt(int start, boolean endian) yields the wrong sample rate. I would suggest following fix:

    private int toInt(int start, boolean endian) {
        int k = (endian) ? 1 : -1;
        if (!endian) {
            start += 3;
        }

        return ((buf[start] & 0xFF) << 24) |
                ((buf[start + k] & 0xFF) << 16) |
                ((buf[start + k * 2] & 0xFF) << 8) |
                (buf[start + k * 3] & 0xFF);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions