marl/pysox

build_array() not available or not working.

Bug-Reaper opened this issue · 2 comments

Hey there, I come from a non-python background so excuse me if I'm missing something incredibly obvious but I believe build_array is broken.

import sox
# create transformer
tfm = sox.Transformer()
tfm.set_output_format(rate=16000,channels=1)
#print(help(tfm))
array =tfm.build(input_filepath="new.wav")

Returns the error:

TypeError: build() missing 1 required positional argument: 'output_filepath'

Conversely:

import sox
# create transformer
tfm = sox.Transformer()
tfm.set_output_format(rate=16000,channels=1)
#print(help(tfm))
array =tfm.build_array(input_filepath="new.wav")

Returns the error:

AttributeError: 'Transformer' object has no attribute 'build_array'

Is there no way to import an audio file into an array?

The readme has this function as an example:

# transform an in-memory array and return an array
y_out = tfm.build_array(input_array=y, sample_rate_in=sample_rate)

But I couldn't find that func in the current docs.

@Bug-Reaper the version for the examples in the current readme in this repo is v1.4.0b0, (you can install it through pypi with pip install --upgrade sox --pre) and the landing page on readthedocs docs is pinned to 1.3.7, the most recent official pypi build.

The docs for the 1.4.0 prerelease can be found here

In the meantime, I'll add a note to the readme to make all of this more clear. Thanks for bringing this up.

Omg you're a lifesaver. Might be worth adding that install snippet to the Readme docs but I'll leave that to the discretion of maintainers + contributors. I think it might be redundant to the one that gives info on how to install the master version anyways?

Thanks a million @rabitt. Unrelated note, I love the picture at the top of the readme. It really made my day :)