marl / pysox

Python wrapper around sox.
BSD 3-Clause "New" or "Revised" License
517 stars 80 forks source link

Transformer().build() throws an error for default value of output_path #142

Closed subramen closed 3 years ago

subramen commented 3 years ago

Hi! I am using build() to read an input array and write it to a memory buffer. From the docs I understand that build(..., output_filepath=None) should return it in stdout instead of writing to a file?

Right now, I receive an error when passing output_filepath=None:

>>> tfm_out = tfm.build(input_array=a1.T, sample_rate_in=44100, output_filepath=None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/sox/transform.py", line 598, in build
    raise ValueError("output_filepath is not specified!")
ValueError: output_filepath is not specified!
rabitt commented 3 years ago

Hi @suraj813 -

build() (equivalent to build_file) is in the process of being deprecated, and only writes to a filepath, so this behavior is expected.

I think what you're looking for is build_array()

I'm closing this issue but feel free to reopen if anything comes up.