Skip to content

Commit

Permalink
Added check for samplerate being provided when working with raw audio…
Browse files Browse the repository at this point in the history
… data
  • Loading branch information
Mews committed Jun 8, 2024
1 parent d248f98 commit 0281157
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/simplestretch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def stretch_audio(

if factor <= 0:
raise ValueError("'factor' must be greater than 0")

if isinstance(audio, ndarray) and not isinstance(samplerate, int):
raise TypeError(f"You must provide a valid sample rate when working with raw audio data (Not {type(samplerate)})")


# If a file path is provided, load it as a ndarray using soundfile
if isinstance(audio, str):
Expand Down

0 comments on commit 0281157

Please sign in to comment.