Closed mthaak closed 6 years ago
It's a sox problem. I changed on line 96 of sox/core.py:
VALID_FORMATS = _get_valid_formats()
to
VALID_FORMATS = ["wav"]
And now I can use Scaper again (with .wav files).
@mthaak thanks for posting the issue and for figuring out what the problem is. Have you posted the issue on the pysox repo?
A more general solution would be to check for the OS and use the appropriate command:
import platform
def _get_valid_formats():
''' Calls SoX help for a lists of audio formats available with the current
install of SoX.
Returns:
--------
formats : list
List of audio file extensions that SoX can process.
'''
if NO_SOX:
return []
pfm = platform.system()
if pfm == 'Windows':
shell_output = subprocess.check_output(
'sox -h | findstr "AUDIO FILE FORMATS"',
shell=True)
else:
shell_output = subprocess.check_output(
'sox -h | grep "AUDIO FILE FORMATS"',
shell=True)
formats = str(shell_output).strip('\n').split(' ')[3:]
return formats
VALID_FORMATS = _get_valid_formats()
I don't have access to a windows machine right now so I can't verify that this actually works - @mthaak any chance you can give this a spin? I'm sure @rabitt would be happy to receive a PR :)
@justinsalamon I have just created an issue on the pysox repo (https://github.com/rabitt/pysox/issues/66) with a solution based on yours.
@mthaak great, let's continue the discussion over there.
When, after installing the latest version using pip on Windows 10, I import Scaper I get the following error:
with traceback
`