目录

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_effects()Dict[str, str][source]

列出可用的 sox 效果名称

Returns

effect nameusage 的映射

Return type

Dict[str, str]

torchaudio.utils.sox_utils.list_read_formats()List[str][source]

列出读取时支持的音频格式

Returns

支持的音频格式列表

Return type

列表[字符串]

torchaudio.utils.sox_utils.list_write_formats()List[str][source]

列出写入时支持的音频格式

Returns

支持的音频格式列表

Return type

列表[字符串]

torchaudio.utils.sox_utils.get_buffer_size()int[source]

获取 sox 效果链的缓冲区大小

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.

文档

访问 PyTorch 的全面开发人员文档

查看文档

教程

获取面向初学者和高级开发人员的深入教程

查看教程

资源

查找开发资源并解答您的问题

查看资源