torchaudio 2.9.1__cp310-cp310-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- torchaudio/.dylibs/libc++.1.0.dylib +0 -0
- torchaudio/__init__.py +204 -0
- torchaudio/_extension/__init__.py +61 -0
- torchaudio/_extension/utils.py +133 -0
- torchaudio/_internal/__init__.py +10 -0
- torchaudio/_internal/module_utils.py +171 -0
- torchaudio/_torchcodec.py +340 -0
- torchaudio/compliance/__init__.py +5 -0
- torchaudio/compliance/kaldi.py +813 -0
- torchaudio/datasets/__init__.py +47 -0
- torchaudio/datasets/cmuarctic.py +157 -0
- torchaudio/datasets/cmudict.py +186 -0
- torchaudio/datasets/commonvoice.py +86 -0
- torchaudio/datasets/dr_vctk.py +121 -0
- torchaudio/datasets/fluentcommands.py +108 -0
- torchaudio/datasets/gtzan.py +1118 -0
- torchaudio/datasets/iemocap.py +147 -0
- torchaudio/datasets/librilight_limited.py +111 -0
- torchaudio/datasets/librimix.py +133 -0
- torchaudio/datasets/librispeech.py +174 -0
- torchaudio/datasets/librispeech_biasing.py +189 -0
- torchaudio/datasets/libritts.py +168 -0
- torchaudio/datasets/ljspeech.py +107 -0
- torchaudio/datasets/musdb_hq.py +139 -0
- torchaudio/datasets/quesst14.py +136 -0
- torchaudio/datasets/snips.py +157 -0
- torchaudio/datasets/speechcommands.py +183 -0
- torchaudio/datasets/tedlium.py +218 -0
- torchaudio/datasets/utils.py +54 -0
- torchaudio/datasets/vctk.py +143 -0
- torchaudio/datasets/voxceleb1.py +309 -0
- torchaudio/datasets/yesno.py +89 -0
- torchaudio/functional/__init__.py +130 -0
- torchaudio/functional/_alignment.py +128 -0
- torchaudio/functional/filtering.py +1685 -0
- torchaudio/functional/functional.py +2505 -0
- torchaudio/lib/__init__.py +0 -0
- torchaudio/lib/_torchaudio.so +0 -0
- torchaudio/lib/libtorchaudio.so +0 -0
- torchaudio/models/__init__.py +85 -0
- torchaudio/models/_hdemucs.py +1008 -0
- torchaudio/models/conformer.py +293 -0
- torchaudio/models/conv_tasnet.py +330 -0
- torchaudio/models/decoder/__init__.py +64 -0
- torchaudio/models/decoder/_ctc_decoder.py +568 -0
- torchaudio/models/decoder/_cuda_ctc_decoder.py +187 -0
- torchaudio/models/deepspeech.py +84 -0
- torchaudio/models/emformer.py +884 -0
- torchaudio/models/rnnt.py +816 -0
- torchaudio/models/rnnt_decoder.py +339 -0
- torchaudio/models/squim/__init__.py +11 -0
- torchaudio/models/squim/objective.py +326 -0
- torchaudio/models/squim/subjective.py +150 -0
- torchaudio/models/tacotron2.py +1046 -0
- torchaudio/models/wav2letter.py +72 -0
- torchaudio/models/wav2vec2/__init__.py +45 -0
- torchaudio/models/wav2vec2/components.py +1167 -0
- torchaudio/models/wav2vec2/model.py +1579 -0
- torchaudio/models/wav2vec2/utils/__init__.py +7 -0
- torchaudio/models/wav2vec2/utils/import_fairseq.py +213 -0
- torchaudio/models/wav2vec2/utils/import_huggingface.py +134 -0
- torchaudio/models/wav2vec2/wavlm_attention.py +214 -0
- torchaudio/models/wavernn.py +409 -0
- torchaudio/pipelines/__init__.py +102 -0
- torchaudio/pipelines/_source_separation_pipeline.py +109 -0
- torchaudio/pipelines/_squim_pipeline.py +156 -0
- torchaudio/pipelines/_tts/__init__.py +16 -0
- torchaudio/pipelines/_tts/impl.py +385 -0
- torchaudio/pipelines/_tts/interface.py +255 -0
- torchaudio/pipelines/_tts/utils.py +230 -0
- torchaudio/pipelines/_wav2vec2/__init__.py +0 -0
- torchaudio/pipelines/_wav2vec2/aligner.py +87 -0
- torchaudio/pipelines/_wav2vec2/impl.py +1699 -0
- torchaudio/pipelines/_wav2vec2/utils.py +346 -0
- torchaudio/pipelines/rnnt_pipeline.py +380 -0
- torchaudio/transforms/__init__.py +78 -0
- torchaudio/transforms/_multi_channel.py +467 -0
- torchaudio/transforms/_transforms.py +2138 -0
- torchaudio/utils/__init__.py +4 -0
- torchaudio/utils/download.py +89 -0
- torchaudio/version.py +2 -0
- torchaudio-2.9.1.dist-info/METADATA +133 -0
- torchaudio-2.9.1.dist-info/RECORD +86 -0
- torchaudio-2.9.1.dist-info/WHEEL +5 -0
- torchaudio-2.9.1.dist-info/licenses/LICENSE +25 -0
- torchaudio-2.9.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
"""TorchCodec integration for TorchAudio."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
from typing import BinaryIO, Optional, Tuple, Union
|
|
5
|
+
|
|
6
|
+
import torch
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def load_with_torchcodec(
|
|
10
|
+
uri: Union[BinaryIO, str, os.PathLike],
|
|
11
|
+
frame_offset: int = 0,
|
|
12
|
+
num_frames: int = -1,
|
|
13
|
+
normalize: bool = True,
|
|
14
|
+
channels_first: bool = True,
|
|
15
|
+
format: Optional[str] = None,
|
|
16
|
+
buffer_size: int = 4096,
|
|
17
|
+
backend: Optional[str] = None,
|
|
18
|
+
) -> Tuple[torch.Tensor, int]:
|
|
19
|
+
"""Load audio data from source using TorchCodec's AudioDecoder.
|
|
20
|
+
|
|
21
|
+
.. note::
|
|
22
|
+
|
|
23
|
+
This function supports the same API as :func:`~torchaudio.load`, and
|
|
24
|
+
relies on TorchCodec's decoding capabilities under the hood. It is
|
|
25
|
+
provided for convenience, but we do recommend that you port your code to
|
|
26
|
+
natively use ``torchcodec``'s ``AudioDecoder`` class for better
|
|
27
|
+
performance:
|
|
28
|
+
https://docs.pytorch.org/torchcodec/stable/generated/torchcodec.decoders.AudioDecoder.
|
|
29
|
+
As of TorchAudio 2.9, :func:`~torchaudio.load` relies on
|
|
30
|
+
:func:`~torchaudio.load_with_torchcodec`. Note that some parameters of
|
|
31
|
+
:func:`~torchaudio.load`, like ``normalize``, ``buffer_size``, and
|
|
32
|
+
``backend``, are ignored by :func:`~torchaudio.load_with_torchcodec`.
|
|
33
|
+
To install torchcodec, follow the instructions at https://github.com/pytorch/torchcodec#installing-torchcodec.
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
uri (path-like object or file-like object):
|
|
38
|
+
Source of audio data. The following types are accepted:
|
|
39
|
+
|
|
40
|
+
* ``path-like``: File path or URL.
|
|
41
|
+
* ``file-like``: Object with ``read(size: int) -> bytes`` method.
|
|
42
|
+
|
|
43
|
+
frame_offset (int, optional):
|
|
44
|
+
Number of samples to skip before start reading data.
|
|
45
|
+
num_frames (int, optional):
|
|
46
|
+
Maximum number of samples to read. ``-1`` reads all the remaining samples,
|
|
47
|
+
starting from ``frame_offset``.
|
|
48
|
+
normalize (bool, optional):
|
|
49
|
+
TorchCodec always returns normalized float32 samples. This parameter
|
|
50
|
+
is ignored and a warning is issued if set to False.
|
|
51
|
+
Default: ``True``.
|
|
52
|
+
channels_first (bool, optional):
|
|
53
|
+
When True, the returned Tensor has dimension `[channel, time]`.
|
|
54
|
+
Otherwise, the returned Tensor's dimension is `[time, channel]`.
|
|
55
|
+
format (str or None, optional):
|
|
56
|
+
Format hint for the decoder. May not be supported by all TorchCodec
|
|
57
|
+
decoders. (Default: ``None``)
|
|
58
|
+
buffer_size (int, optional):
|
|
59
|
+
Not used by TorchCodec AudioDecoder. Provided for API compatibility.
|
|
60
|
+
backend (str or None, optional):
|
|
61
|
+
Not used by TorchCodec AudioDecoder. Provided for API compatibility.
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
(torch.Tensor, int): Resulting Tensor and sample rate.
|
|
65
|
+
Always returns float32 tensors. If ``channels_first=True``, shape is
|
|
66
|
+
`[channel, time]`, otherwise `[time, channel]`.
|
|
67
|
+
|
|
68
|
+
Raises:
|
|
69
|
+
ImportError: If torchcodec is not available.
|
|
70
|
+
ValueError: If unsupported parameters are used.
|
|
71
|
+
RuntimeError: If TorchCodec fails to decode the audio.
|
|
72
|
+
|
|
73
|
+
Note:
|
|
74
|
+
- TorchCodec always returns normalized float32 samples, so the ``normalize``
|
|
75
|
+
parameter has no effect.
|
|
76
|
+
- The ``buffer_size`` and ``backend`` parameters are ignored.
|
|
77
|
+
- Not all audio formats supported by torchaudio backends may be supported
|
|
78
|
+
by TorchCodec.
|
|
79
|
+
"""
|
|
80
|
+
# Import torchcodec here to provide clear error if not available
|
|
81
|
+
try:
|
|
82
|
+
from torchcodec.decoders import AudioDecoder
|
|
83
|
+
except ImportError as e:
|
|
84
|
+
raise ImportError(
|
|
85
|
+
"TorchCodec is required for load_with_torchcodec. " "Please install torchcodec to use this function."
|
|
86
|
+
) from e
|
|
87
|
+
|
|
88
|
+
# Parameter validation and warnings
|
|
89
|
+
if not normalize:
|
|
90
|
+
import warnings
|
|
91
|
+
|
|
92
|
+
warnings.warn(
|
|
93
|
+
"TorchCodec AudioDecoder always returns normalized float32 samples. "
|
|
94
|
+
"The 'normalize=False' parameter is ignored.",
|
|
95
|
+
UserWarning,
|
|
96
|
+
stacklevel=2,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
if buffer_size != 4096:
|
|
100
|
+
import warnings
|
|
101
|
+
|
|
102
|
+
warnings.warn("The 'buffer_size' parameter is not used by TorchCodec AudioDecoder.", UserWarning, stacklevel=2)
|
|
103
|
+
|
|
104
|
+
if backend is not None:
|
|
105
|
+
import warnings
|
|
106
|
+
|
|
107
|
+
warnings.warn("The 'backend' parameter is not used by TorchCodec AudioDecoder.", UserWarning, stacklevel=2)
|
|
108
|
+
|
|
109
|
+
if format is not None:
|
|
110
|
+
import warnings
|
|
111
|
+
|
|
112
|
+
warnings.warn("The 'format' parameter is not supported by TorchCodec AudioDecoder.", UserWarning, stacklevel=2)
|
|
113
|
+
|
|
114
|
+
# Create AudioDecoder
|
|
115
|
+
try:
|
|
116
|
+
decoder = AudioDecoder(uri)
|
|
117
|
+
except Exception as e:
|
|
118
|
+
raise RuntimeError(f"Failed to create AudioDecoder for {uri}: {e}") from e
|
|
119
|
+
|
|
120
|
+
# Get sample rate from metadata
|
|
121
|
+
sample_rate = decoder.metadata.sample_rate
|
|
122
|
+
if sample_rate is None:
|
|
123
|
+
raise RuntimeError("Unable to determine sample rate from audio metadata")
|
|
124
|
+
|
|
125
|
+
# Decode the entire file first, then subsample manually
|
|
126
|
+
# This is the simplest approach since torchcodec uses time-based indexing
|
|
127
|
+
try:
|
|
128
|
+
audio_samples = decoder.get_all_samples()
|
|
129
|
+
except Exception as e:
|
|
130
|
+
raise RuntimeError(f"Failed to decode audio samples: {e}") from e
|
|
131
|
+
|
|
132
|
+
data = audio_samples.data
|
|
133
|
+
|
|
134
|
+
# Apply frame_offset and num_frames (which are actually sample offsets)
|
|
135
|
+
if frame_offset > 0:
|
|
136
|
+
if frame_offset >= data.shape[1]:
|
|
137
|
+
# Return empty tensor if offset is beyond available data
|
|
138
|
+
empty_shape = (data.shape[0], 0) if channels_first else (0, data.shape[0])
|
|
139
|
+
return torch.zeros(empty_shape, dtype=torch.float32), sample_rate
|
|
140
|
+
data = data[:, frame_offset:]
|
|
141
|
+
|
|
142
|
+
if num_frames == 0:
|
|
143
|
+
# Return empty tensor if num_frames is 0
|
|
144
|
+
empty_shape = (data.shape[0], 0) if channels_first else (0, data.shape[0])
|
|
145
|
+
return torch.zeros(empty_shape, dtype=torch.float32), sample_rate
|
|
146
|
+
elif num_frames > 0:
|
|
147
|
+
data = data[:, :num_frames]
|
|
148
|
+
|
|
149
|
+
# TorchCodec returns data in [channel, time] format by default
|
|
150
|
+
# Handle channels_first parameter
|
|
151
|
+
if not channels_first:
|
|
152
|
+
data = data.transpose(0, 1) # [channel, time] -> [time, channel]
|
|
153
|
+
|
|
154
|
+
return data, sample_rate
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def save_with_torchcodec(
|
|
158
|
+
uri: Union[str, os.PathLike],
|
|
159
|
+
src: torch.Tensor,
|
|
160
|
+
sample_rate: int,
|
|
161
|
+
channels_first: bool = True,
|
|
162
|
+
format: Optional[str] = None,
|
|
163
|
+
encoding: Optional[str] = None,
|
|
164
|
+
bits_per_sample: Optional[int] = None,
|
|
165
|
+
buffer_size: int = 4096,
|
|
166
|
+
backend: Optional[str] = None,
|
|
167
|
+
compression: Optional[Union[float, int]] = None,
|
|
168
|
+
) -> None:
|
|
169
|
+
"""Save audio data to file using TorchCodec's AudioEncoder.
|
|
170
|
+
|
|
171
|
+
.. note::
|
|
172
|
+
|
|
173
|
+
This function supports the same API as :func:`~torchaudio.save`, and
|
|
174
|
+
relies on TorchCodec's encoding capabilities under the hood. It is
|
|
175
|
+
provided for convenience, but we do recommend that you port your code to
|
|
176
|
+
natively use ``torchcodec``'s ``AudioEncoder`` class for better
|
|
177
|
+
performance:
|
|
178
|
+
https://docs.pytorch.org/torchcodec/stable/generated/torchcodec.encoders.AudioEncoder.
|
|
179
|
+
As of TorchAudio 2.9, :func:`~torchaudio.save` relies on
|
|
180
|
+
:func:`~torchaudio.save_with_torchcodec`. Note that some parameters of
|
|
181
|
+
:func:`~torchaudio.save`, like ``format``, ``encoding``,
|
|
182
|
+
``bits_per_sample``, ``buffer_size``, and ``backend``, are ignored by
|
|
183
|
+
are ignored by :func:`~torchaudio.save_with_torchcodec`.
|
|
184
|
+
To install torchcodec, follow the instructions at https://github.com/pytorch/torchcodec#installing-torchcodec.
|
|
185
|
+
|
|
186
|
+
This function provides a TorchCodec-based alternative to torchaudio.save
|
|
187
|
+
with the same API. TorchCodec's AudioEncoder provides efficient encoding
|
|
188
|
+
with FFmpeg under the hood.
|
|
189
|
+
|
|
190
|
+
Args:
|
|
191
|
+
uri (path-like object):
|
|
192
|
+
Path to save the audio file. The file extension determines the format.
|
|
193
|
+
|
|
194
|
+
src (torch.Tensor):
|
|
195
|
+
Audio data to save. Must be a 1D or 2D tensor with float32 values
|
|
196
|
+
in the range [-1, 1]. If 2D, shape should be [channel, time] when
|
|
197
|
+
channels_first=True, or [time, channel] when channels_first=False.
|
|
198
|
+
|
|
199
|
+
sample_rate (int):
|
|
200
|
+
Sample rate of the audio data.
|
|
201
|
+
|
|
202
|
+
channels_first (bool, optional):
|
|
203
|
+
Indicates whether the input tensor has channels as the first dimension.
|
|
204
|
+
If True, expects [channel, time]. If False, expects [time, channel].
|
|
205
|
+
Default: True.
|
|
206
|
+
|
|
207
|
+
format (str or None, optional):
|
|
208
|
+
Audio format hint. Not used by TorchCodec (format is determined by
|
|
209
|
+
file extension). A warning is issued if provided.
|
|
210
|
+
Default: None.
|
|
211
|
+
|
|
212
|
+
encoding (str or None, optional):
|
|
213
|
+
Audio encoding. Not fully supported by TorchCodec AudioEncoder.
|
|
214
|
+
A warning is issued if provided. Default: None.
|
|
215
|
+
|
|
216
|
+
bits_per_sample (int or None, optional):
|
|
217
|
+
Bits per sample. Not directly supported by TorchCodec AudioEncoder.
|
|
218
|
+
A warning is issued if provided. Default: None.
|
|
219
|
+
|
|
220
|
+
buffer_size (int, optional):
|
|
221
|
+
Not used by TorchCodec AudioEncoder. Provided for API compatibility.
|
|
222
|
+
A warning is issued if not default value. Default: 4096.
|
|
223
|
+
|
|
224
|
+
backend (str or None, optional):
|
|
225
|
+
Not used by TorchCodec AudioEncoder. Provided for API compatibility.
|
|
226
|
+
A warning is issued if provided. Default: None.
|
|
227
|
+
|
|
228
|
+
compression (float, int or None, optional):
|
|
229
|
+
Compression level or bit rate. Maps to bit_rate parameter in
|
|
230
|
+
TorchCodec AudioEncoder. Default: None.
|
|
231
|
+
|
|
232
|
+
Raises:
|
|
233
|
+
ImportError: If torchcodec is not available.
|
|
234
|
+
ValueError: If input parameters are invalid.
|
|
235
|
+
RuntimeError: If TorchCodec fails to encode the audio.
|
|
236
|
+
|
|
237
|
+
Note:
|
|
238
|
+
- TorchCodec AudioEncoder expects float32 samples in [-1, 1] range.
|
|
239
|
+
- Some parameters (format, encoding, bits_per_sample, buffer_size, backend)
|
|
240
|
+
are not used by TorchCodec but are provided for API compatibility.
|
|
241
|
+
- The output format is determined by the file extension in the uri.
|
|
242
|
+
- TorchCodec uses FFmpeg under the hood for encoding.
|
|
243
|
+
"""
|
|
244
|
+
# Import torchcodec here to provide clear error if not available
|
|
245
|
+
try:
|
|
246
|
+
from torchcodec.encoders import AudioEncoder
|
|
247
|
+
except ImportError as e:
|
|
248
|
+
raise ImportError(
|
|
249
|
+
"TorchCodec is required for save_with_torchcodec. " "Please install torchcodec to use this function."
|
|
250
|
+
) from e
|
|
251
|
+
|
|
252
|
+
# Parameter validation and warnings
|
|
253
|
+
if format is not None:
|
|
254
|
+
import warnings
|
|
255
|
+
|
|
256
|
+
warnings.warn(
|
|
257
|
+
"The 'format' parameter is not used by TorchCodec AudioEncoder. "
|
|
258
|
+
"Format is determined by the file extension.",
|
|
259
|
+
UserWarning,
|
|
260
|
+
stacklevel=2,
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
if encoding is not None:
|
|
264
|
+
import warnings
|
|
265
|
+
|
|
266
|
+
warnings.warn(
|
|
267
|
+
"The 'encoding' parameter is not fully supported by TorchCodec AudioEncoder.", UserWarning, stacklevel=2
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
if bits_per_sample is not None:
|
|
271
|
+
import warnings
|
|
272
|
+
|
|
273
|
+
warnings.warn(
|
|
274
|
+
"The 'bits_per_sample' parameter is not directly supported by TorchCodec AudioEncoder.",
|
|
275
|
+
UserWarning,
|
|
276
|
+
stacklevel=2,
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
if buffer_size != 4096:
|
|
280
|
+
import warnings
|
|
281
|
+
|
|
282
|
+
warnings.warn("The 'buffer_size' parameter is not used by TorchCodec AudioEncoder.", UserWarning, stacklevel=2)
|
|
283
|
+
|
|
284
|
+
if backend is not None:
|
|
285
|
+
import warnings
|
|
286
|
+
|
|
287
|
+
warnings.warn("The 'backend' parameter is not used by TorchCodec AudioEncoder.", UserWarning, stacklevel=2)
|
|
288
|
+
|
|
289
|
+
# Input validation
|
|
290
|
+
if not isinstance(src, torch.Tensor):
|
|
291
|
+
raise ValueError(f"Expected src to be a torch.Tensor, got {type(src)}")
|
|
292
|
+
|
|
293
|
+
if src.dtype != torch.float32:
|
|
294
|
+
src = src.float()
|
|
295
|
+
|
|
296
|
+
if sample_rate <= 0:
|
|
297
|
+
raise ValueError(f"sample_rate must be positive, got {sample_rate}")
|
|
298
|
+
|
|
299
|
+
# Handle tensor shape and channels_first
|
|
300
|
+
if src.ndim == 1:
|
|
301
|
+
# Convert to 2D: [1, time] for channels_first=True
|
|
302
|
+
if channels_first:
|
|
303
|
+
data = src.unsqueeze(0) # [1, time]
|
|
304
|
+
else:
|
|
305
|
+
# For channels_first=False, input is [time] -> reshape to [time, 1] -> transpose to [1, time]
|
|
306
|
+
data = src.unsqueeze(1).transpose(0, 1) # [time, 1] -> [1, time]
|
|
307
|
+
elif src.ndim == 2:
|
|
308
|
+
if channels_first:
|
|
309
|
+
data = src # Already [channel, time]
|
|
310
|
+
else:
|
|
311
|
+
data = src.transpose(0, 1) # [time, channel] -> [channel, time]
|
|
312
|
+
else:
|
|
313
|
+
raise ValueError(f"Expected 1D or 2D tensor, got {src.ndim}D tensor")
|
|
314
|
+
|
|
315
|
+
# Create AudioEncoder
|
|
316
|
+
try:
|
|
317
|
+
encoder = AudioEncoder(data, sample_rate=sample_rate)
|
|
318
|
+
except Exception as e:
|
|
319
|
+
raise RuntimeError(f"Failed to create AudioEncoder: {e}") from e
|
|
320
|
+
|
|
321
|
+
# Determine bit_rate from compression parameter
|
|
322
|
+
bit_rate = None
|
|
323
|
+
if compression is not None:
|
|
324
|
+
if isinstance(compression, (int, float)):
|
|
325
|
+
bit_rate = int(compression)
|
|
326
|
+
else:
|
|
327
|
+
import warnings
|
|
328
|
+
|
|
329
|
+
warnings.warn(
|
|
330
|
+
f"Unsupported compression type {type(compression)}. "
|
|
331
|
+
"TorchCodec AudioEncoder expects int or float for bit_rate.",
|
|
332
|
+
UserWarning,
|
|
333
|
+
stacklevel=2,
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
# Save to file
|
|
337
|
+
try:
|
|
338
|
+
encoder.to_file(uri, bit_rate=bit_rate)
|
|
339
|
+
except Exception as e:
|
|
340
|
+
raise RuntimeError(f"Failed to save audio to {uri}: {e}") from e
|