Skip to content
This repository was archived by the owner on Feb 21, 2026. It is now read-only.
This repository was archived by the owner on Feb 21, 2026. It is now read-only.

Wrong duration from wavDuration() #1

Description

@exargon

When calculating the duration with the wavDuration() method, the size used is Parser.Size. In Parser.Parse() this is set to be the RIFF chunkSize, i.e. the file size - 8 bytes. This means that the header chunks are included in the calculation, giving a duration that is too long. The size that should be used is the size from the data chunk.

In most cases the added duration will be small enough that you won't notice, but if you need to know the exact number of samples in the file, or you have a file with large amounts of meta data in the headers (which you could typically get with BWF and derivatives), it becomes a problem.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions