marl / marl/pysox

sox.file_info.bitrate() Value error

Open Beginner friendly
#159 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
540
Forks
83
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in file_info.py at the bitrate() entry point and reproduce the issue using the soxi output shown in the report, including its trailing carriage return. Done means the reported 256k bitrate is parsed successfully instead of raising ValueError, while existing bitrate behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
audio-video-rtc
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.