Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(doc): remove mention of unsupported numpy.ndarray waveform #1691

Merged
merged 6 commits into from
May 17, 2024
Merged
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
- fix(task): fix estimation of training set size (with [@FrenchKrab](https://github.com/FrenchKrab))
- fix(hook): fix `torch.Tensor` support in `ArtifactHook`
- fix(doc): fix typo in `Powerset` docstring (with [@lukasstorck](https://github.com/lukasstorck))
- fix(doc): remove mention of unsupported `numpy.ndarray` waveform (with [@Purfview](https://github.com/Purfview))

### Improvements

Expand Down
6 changes: 3 additions & 3 deletions pyannote/audio/core/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
- a "IOBase" instance with "read" and "seek" support: open("audio.wav", "rb")
- a "Mapping" with any of the above as "audio" key: {"audio": ...}
- a "Mapping" with both "waveform" and "sample_rate" key:
{"waveform": (channel, time) numpy.ndarray or torch.Tensor, "sample_rate": 44100}
{"waveform": (channel, time) torch.Tensor, "sample_rate": 44100}

For last two options, an additional "channel" key can be provided as a zero-indexed
integer to load a specific channel: {"audio": "stereo.wav", "channel": 0}
Expand Down Expand Up @@ -149,7 +149,7 @@ def validate_file(file: AudioFile) -> Mapping:
-------
validated_file : Mapping
{"audio": str, "uri": str, ...}
{"waveform": array or tensor, "sample_rate": int, "uri": str, ...}
{"waveform": tensor, "sample_rate": int, "uri": str, ...}
{"audio": file, "uri": "stream"} if `file` is an IOBase instance

Raises
Expand All @@ -171,7 +171,7 @@ def validate_file(file: AudioFile) -> Mapping:
raise ValueError(AudioFileDocString)

if "waveform" in file:
waveform: Union[np.ndarray, Tensor] = file["waveform"]
waveform: Tensor = file["waveform"]
if len(waveform.shape) != 2 or waveform.shape[0] > waveform.shape[1]:
raise ValueError(
"'waveform' must be provided as a (channel, time) torch Tensor."
Expand Down
Loading