Skip to content

Convert an ulaw byte array to a wav array #141

Open
@r4nc0r

Description

@r4nc0r

Hi,

i'm trying to convert a raw 8k,8bit,mono ulaw byte array to a 16k,16bit,mono wav array.
It works if i write the byte array to a .raw file and use pysox like this:

tfm = sox.Transformer()
tfm.set_input_format(rate=8000, channels=1, encoding="u-law",bits=8)
tfm.set_output_format(channels=1, rate=16000,bits=16)

def convert(data):
        f = open("randomfilename.raw", "wb")
        f.write(data)
        f.close()
        return (tfm.build_array(input_filepath="randomfilename.raw"))

But pysox has the capabilities to use build_array with an input_array parameter, but I dont know how to convert my byte array, so that it works.

Could you please help me?

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