Skip to content

Commit 3712cf6

Browse files
authored
Allow AudioEncoder.to_file to accept Path (#852)
1 parent c0ddf78 commit 3712cf6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/torchcodec/encoders/_audio_encoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def to_file(
6969
_core.encode_audio_to_file(
7070
samples=self._samples,
7171
sample_rate=self._sample_rate,
72-
filename=dest,
72+
filename=str(dest),
7373
bit_rate=bit_rate,
7474
num_channels=num_channels,
7575
desired_sample_rate=sample_rate,

test/test_encoders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def test_against_to_file(
325325

326326
params = dict(bit_rate=bit_rate, num_channels=num_channels)
327327
encoded_file = tmp_path / f"output.{format}"
328-
encoder.to_file(dest=str(encoded_file), **params)
328+
encoder.to_file(dest=encoded_file, **params)
329329

330330
if method == "to_tensor":
331331
encoded_output = encoder.to_tensor(

0 commit comments

Comments
 (0)