Replace resampy with pysox for audio resampling
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 604
- Forks
- 66
- PR merge metrics
- No merged PRs in 30d
Description
Turns out resampy is SLOW. We could speed openl3 quite a bit by swapping it out with pysox, resample the audio into a tempfile and load the templfile for further processing.
```python
with tempfile.TemporaryDirectory() as tempdir:
filename48 = os.path.join(tempdir, os.path.basename(os.path.splitext(file_path)[0]) + "_48.wav")
# resample to 48000 Hz
tfm = sox.Transformer()
tfm.convert(samplerate= 48000, n_channels=1)
tfm.build(file_path, filename48)
# load the audio file
sr = 48000
audio, srload = librosa.load(filename48, sr=None)
assert srload == sr
```
NOTE: this example assumes wav input, and would have to be adapted to support various formats (in particular mp3)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating where resampy is used in the audio-loading and resampling path, then review the existing dependency and input-format handling. Replace the resampling path with pysox while preserving support beyond WAV, especially MP3, and verify that the resulting audio is loaded at 48000 Hz with one channel.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- audio-video-rtc
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100