Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This is relevant for machine learning models that today often process raw (time
| [torchaudio](https://github.com/pytorch/audio) (soundfile) | 0.9.0 | `torchaudio` | PyTorch Tensor | all codecs supported by Soundfile | ✅ |
| [soxbindings](https://github.com/pseeth/soxbindings) | 0.9.0 | `soxbindings` | Numpy Tensor | all codecs supported by Soundfile | ✅ |
| [stempeg](https://github.com/faroit/stempeg) | 0.2.3 | `stempeg` | Numpy Tensor | all codecs supported by FFMPEG | ✅ |
| [pedalboard.io.AudioFile](https://github.com/spotify/pedalboard) | 0.5.1 | `pedalboard` | Numpy Array | WAV, AIFF, MP3, OGG, FLAC | ✅ |

### Not included

Expand Down
1 change: 1 addition & 0 deletions benchmark_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def __len__(self):
'soundfile',
'sox',
'audioread',
'pedalboard',
]

for lib in libs:
Expand Down
3 changes: 2 additions & 1 deletion benchmark_np.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def test_np_loading(fp, lib):
'pydub',
'soundfile',
'librosa',
'scipy_mmap'
'scipy_mmap',
'pedalboard',
]

for lib in libs:
Expand Down
1 change: 1 addition & 0 deletions benchmark_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def __len__(self):
'librosa',
'scipy',
'scipy_mmap',
'pedalboard',
]

if args.ext != "mp4":
Expand Down
1 change: 1 addition & 0 deletions benchmark_tf.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def _py_loader_function(fp):
'scipy',
'scipy_mmap',
'tf_decode_wav',
'pedalboard',
]

for lib in libs:
Expand Down
19 changes: 18 additions & 1 deletion loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import soxbindings
import sox
import stempeg
import pedalboard


"""
Expand Down Expand Up @@ -121,6 +122,12 @@ def load_librosa(fp):
return sig


def load_pedalboard(fp):
with pedalboard.io.AudioFile(fp) as f:
# Pedalboard output is (num_channels, num_samples)
return f.read(f.frames)[0]


def _convert_buffer_to_float(buf, n_bytes=2, dtype=np.float32):
# taken from librosa.util.utils
# Invert the scale of the data
Expand Down Expand Up @@ -206,4 +213,14 @@ def info_stempeg(fp):
info["samples"] = si.samples(0)
info["channels"] = si.channels(0)
info["duration"] = si.duration(0)
return info
return info


def info_pedalboard(fp):
info = {}
with pedalboard.io.AudioFile(fp) as af:
info["sampling_rate"] = af.samplerate
info["samples"] = af.frames
info["channels"] = af.num_channels
info["duration"] = af.duration
return info
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ seaborn
pandas
ipython
cffi
pedalboard==0.5.1