Skip to content

Square wave with int32 dtype not working as expected #153

Open
@ANickerson

Description

@ANickerson

If you create a numpy array with only intmax (2147483647) and play this file, the result is static.

If you convert to float (by dividing by intmax) then a square wave is produced

import sounddevice as sd
import numpy as np
square = np.ones(44100, dtype="int32") * 2147483647
sd.play(square) # Results in static

square_floats = np.ones(44100, dtype="float32")
sd.play(square_floats) # results in "on" state

I would expect these to act the same, is there any reason why they don't? Is there some sort of overflow?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions