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.

Incorrect conversion of Float to Int  #14

Description

@dh1tw

Hi,

I tried to convert a Float32Buffer to an IntBuffer, resulting in silence. Problem is, that the current implementation has a flaw:

newB.Data[i] = int(buf.Data[i])

newB.Data[i] = int(buf.Data[i])

Float audio samples use the value range of -1....0....1 casting them just to int won't do the job. For a proper conversion, the bit depth of the integer (8/16/32/64) must be known. Here is a good stack overflow article how to do it right.

Problem is, that within a Float32Buffer, the bit depth is not available :-(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions