marl/pysox

sox.file_info.bitrate() Value error

madt2709 opened this issue · 0 comments

When I call sox.file_info.bitrate() on a file I get the following error:

File "c:\Users\Theo\OneDrive\Documents\github\tinygrad\.venv\lib\site-packages\sox\file_info.py", line 64, in bitrate
    return float(output[:-1])
ValueError: could not convert string to float: '256k'

Whilst when running sox --i on the same file in terminal I get the following:

Input File     : 'dev-clean-wav/2277/149896/2277-149896-0000.wav'
Channels       : 1
Sample Rate    : 16000
Precision      : 16-bit
Duration       : 00:00:06.59 = 105440 samples ~ 494.25 CDDA sectors
File Size      : 211k
Bit Rate       : 256k
Sample Encoding: 16-bit Signed Integer PCM

After a bit of digging, it seems that the output of soxi is 256k\r and the \r doesn't get stripped.