torchaudio.utils¶
torchaudio.utils.sox_utils¶
Utility module to configure libsox. This affects functionalities in Sox IO backend and Sox Effects.
-
torchaudio.utils.sox_utils.set_seed(seed: int)[source]¶ 设置 libsox 的 PRNG
- Parameters
seed (int) – 种子值。有效范围为 int32。
-
torchaudio.utils.sox_utils.set_verbosity(verbosity: int)[source]¶ 设置 libsox 的冗长输出级别
- Parameters
verbosity (int) –
设置 libsox 的冗长级别。
1失败消息2警告3处理详情4-6个递增级别的调试消息
-
torchaudio.utils.sox_utils.set_buffer_size(buffer_size: int)[source]¶ 设置 sox 效果链的缓冲区大小
- Parameters
buffer_size (int) – 设置用于处理音频的缓冲区大小(以字节为单位)。
-
torchaudio.utils.sox_utils.set_use_threads(use_threads: bool)[source]¶ 为 sox 效果链设置多线程选项
- Parameters
use_threads (bool) – 当
True时,启用libsox的并行效果通道处理。 要使用多线程,底层的libsox必须编译为支持 OpenMP。
-
torchaudio.utils.sox_utils.list_read_formats() → List[str][source]¶ 列出读取时支持的音频格式
- Returns
支持的音频格式列表
- Return type
列表[字符串]
torchaudio.utils.ffmpeg_utils¶
用于配置 FFmpeg 库的实用模块。
-
torchaudio.utils.ffmpeg_utils.get_log_level() → int[source]¶ 获取 FFmpeg 的日志级别。
详见
set_log_level()。
-
torchaudio.utils.ffmpeg_utils.set_log_level(level: int)[source]¶ 设置 FFmpeg(libavformat 等)的日志级别
- Parameters
level (int) –
日志级别。数值越大,输出越详细。
以下值为常用值,对应的
ffmpeg’s-loglevel选项值和描述。-8(quiet): Print no output.0(panic): Something went really wrong and we will crash now.8(fatal): Something went wrong and recovery is not possible. For example, no header was found for a format which depends on headers or an illegal combination of parameters is used.16(error): Something went wrong and cannot losslessly be recovered. However, not all future data is affected.24(warning): Something somehow does not look correct. This may or may not lead to problems.32(info): Standard information.40(verbose): Detailed information.48(debug): Stuff which is only useful for libav* developers.56(trace): Extremely verbose debugging, useful for libav* development.