yeaudio


Nameyeaudio JSON
Version 0.0.7 PyPI version JSON
download
home_pagehttps://github.com/yeyupiaoling/YeAudio
SummaryAudio ToolKit for Python
upload_time2024-11-14 02:46:12
maintainerNone
docs_urlNone
authoryeyupiaoling
requires_pythonNone
licenseApache License 2.0
keywords audio speech
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 夜雨飘零音频工具

这款Python音频处理工具功能强大,支持读取多种格式的音频文件。它不仅能够对音频进行裁剪、添加混响、添加噪声等多种处理操作,还广泛应用于语音识别、语音合成、声音分类以及声纹识别等多个项目领域。

# 安装

使用pip安装。

```shell
pip install yeaudio -U -i https://pypi.tuna.tsinghua.edu.cn/simple
```

**(推荐)** 使用源码安装。

```shell
git clone https://github.com/yeyupiaoling/YeAudio.git
cd YeAudio
pip install . -i https://pypi.tuna.tsinghua.edu.cn/simple
```

# 快速使用

读取普通音频:
```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file('data/test.wav')
print(f'音频长度:{audio_segment.duration}')
print(f'音频采样率:{audio_segment.sample_rate}')
print(f'音频数据:{audio_segment.samples}')
```

读取视频中的音频:
```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file('data/test.mp4')
print(f'音频长度:{audio_segment.duration}')
print(f'音频采样率:{audio_segment.sample_rate}')
print(f'音频数据:{audio_segment.samples}')
```

# API文档

 - [AudioSegment](#AudioSegment)
 - [VadModel](#VadModel)
 - [VadOnlineModel](#VadOnlineModel)
 - [SpeedPerturbAugmentor](#SpeedPerturbAugmentor)
 - [VolumePerturbAugmentor](#VolumePerturbAugmentor)
 - [ShiftPerturbAugmentor](#ShiftPerturbAugmentor)
 - [ResampleAugmentor](#ResampleAugmentor)
 - [NoisePerturbAugmentor](#NoisePerturbAugmentor)
 - [ReverbPerturbAugmentor](#ReverbPerturbAugmentor)
 - [SpecAugmentor](#SpecAugmentor)
 - [SpecSubAugmentor](#SpecSubAugmentor)

## AudioSegment

基础音频工具,支持读取多种格式的音频文件,已经各种基础操作,如裁剪、添加混响、添加噪声等。

<br/>

> **def `__init__`(self, samples, sample_rate):**

创建单通道音频片段实例

**参数:**

 - **samples(ndarray.float32):** 频数据,维度为[num_samples x num_channels]
 - **sample_rate(int):** 音频的采样率

**示例代码:**

```python
import soundfile
from yeaudio.audio import AudioSegment

samples, sample_rate = soundfile.read("data/test.wav")
audio_segment = AudioSegment(samples, sample_rate)
print(audio_segment.samples)
```
<br/>

---

> **def `__eq__`(self, other):**

返回两个对象是否相等

**参数:**

 - **other(AudioSegment):** 比较的另一个音频片段实例

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment1 = AudioSegment.from_file("data/test.wav")
audio_segment2 = AudioSegment.from_file("data/test.wav")
print(audio_segment1 == audio_segment2)
```
<br/>

---

> **def `__ne__`(self, other):**

返回两个实例是否不相等

**参数:**

 - **other(AudioSegment):** 比较的另一个音频片段实例

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment1 = AudioSegment.from_file("data/test.wav")
audio_segment2 = AudioSegment.from_file("data/test.wav")
print(audio_segment1 != audio_segment2)
```
<br/>

---

> **def `__str__`(self):**

返回该音频的信息

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
print(str(audio_segment))
```
<br/>

---

> **@classmethod**<br/>
> **def from_file(cls, file):**

从音频文件创建音频段,支持wav、mp3、mp4等多种音频格式

**参数:**

 - **file(str|BufferedReader):** 件路径,或者文件对象

**返回:**

 - `AudioSegment`:音频片段实例

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file('data/test.wav')
print(audio_segment.samples)
```
<br/>

---

> **@classmethod**<br/>
> **def slice_from_file(cls, file, start=None, end=None):**

只加载一小段音频,而不需要将整个文件加载到内存中,这是非常浪费的。

**参数:**

 - **file(str|file):** 输入音频文件路径或文件对象
 - **start(float):** 开始时间,单位为秒。如果start是负的,则它从末尾开始计算。如果没有提供,这个函数将从最开始读取。
 - **end(float):** 结束时间,单位为秒。如果end是负的,则它从末尾开始计算。如果没有提供,默认的行为是读取到文件的末尾。

**返回:**

 - `AudioSegment`:AudioSegment输入音频文件的指定片的实例

**异常:**

 - `ValueError`:如果开始或结束的设定不正确,则会抛出ValueError异常

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.slice_from_file('data/test.wav', start=1, end=2)
print(audio_segment.samples)
```
<br/>

---

> **@classmethod**<br/>
> **def from_bytes(cls, data):**

从wav格式的音频字节创建音频段

**参数:**

 - **data(bytes):** 包含音频样本的字节

**返回:**

 - `AudioSegment`:音频片段实例

**示例代码:**

```python
from yeaudio.audio import AudioSegment

with open('data/test.wav', 'rb') as f:
    data = f.read()
    audio_segment = AudioSegment.from_bytes(data)
    print(audio_segment.samples)
```
<br/>

---

> **@classmethod**<br/>
> **def from_pcm_bytes(cls, data, channels=1, samp_width=2, sample_rate=16000):**

从包含无格式PCM音频的字节创建音频

**参数:**

 - **data(bytes):** 包含音频样本的字节
 - **channels(int):** 音频的通道数
 - **samp_width(int):** 频采样的宽度,如np.int16为2
 - **sample_rate(int):** 音频样本采样率

**返回:**

 - `AudioSegment`:音频片段实例

**示例代码:**

```python
from yeaudio.audio import AudioSegment

with open('data/test.wav', 'rb') as f:
    data = f.read()
    audio_segment = AudioSegment.from_pcm_bytes(data[44:], channels=1, samp_width=2, sample_rate=16000)
    print(audio_segment.samples)
```
<br/>

---

> **@classmethod**<br/>
> **def from_ndarray(cls, data, sample_rate=16000):**

从numpy.ndarray创建音频段

**参数:**

 - **data(bytes):** numpy.ndarray类型的音频数据
 - **sample_rate(int):** 音频样本采样率

**返回:**

 - `AudioSegment`:音频片段实例

**示例代码:**

```python
import soundfile

from yeaudio.audio import AudioSegment

samples, sample_rate = soundfile.read('data/test.wav')
audio_segment = AudioSegment.from_ndarray(samples, sample_rate=16000)
print(audio_segment.samples)
```
<br/>

---

> **@classmethod**<br/>
> **def concatenate(cls, \*segments):**

将任意数量的音频片段连接在一起

**参数:**

 - **segments(AudioSegment):** 输入音频片段被连接

**返回:**

 - `AudioSegment`:音频片段实例

**异常:**

 - `ValueError`:如果音频实例列表为空或者采样率不一致,则会抛出ValueError异常
 - `TypeError`:如果输入的片段类型不一致,则会抛出TypeError异常

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment1 = AudioSegment.from_file('data/test.wav')
audio_segment2 = AudioSegment.from_file('data/test.wav')
audio_segment = AudioSegment.concatenate(audio_segment1, audio_segment2)
print(audio_segment.samples)
```
<br/>

---

> **@classmethod**<br/>
> **def make_silence(cls, duration, sample_rate):**

创建给定持续时间和采样率的静音音频段

**参数:**

 - **duration(float):** 静音的时间,以秒为单位
 - **sample_rate(int):** 音频采样率

**返回:**

 - `AudioSegment`:给定持续时间的静音AudioSegment实例

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.make_silence(duration=10, sample_rate=16000)
print(audio_segment.samples)
```
<br/>

---

> **def to_wav_file(self, filepath, dtype='float32'):**

保存音频段到磁盘为wav文件

**参数:**

 - **filepath(str|file):** WAV文件路径或文件对象,以保存音频段
 - **dtype(str):** 音频数据类型,可选: 'int16', 'int32', 'float32', 'float64'

**异常:**

 - `TypeError`:如果类型不支持,则会抛出TypeError异常

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
audio_segment.to_wav_file("output.wav")
```
<br/>

---

> **def superimpose(self, other):**

将另一个段的样本添加到这个段的样本中(以样本方式添加,而不是段连接)。

**参数:**

 - **other(AudioSegments):** WAV文件路径或文件对象,以保存音频段
 - **dtype(str):** 音频数据类型,可选: 'int16', 'int32', 'float32', 'float64'

**异常:**

 - `ValueError`:如果两段音频采样率或者长度不一致,则会抛出ValueError异常
 - `TypeError`:如果两个片段的类型不匹配,则会抛出TypeError异常

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
other_segment = AudioSegment.from_file("data/test.wav")
audio_segment.superimpose(other_segment)
```
<br/>

---

> **def to_bytes(self, dtype='float32'):**

创建音频内容的字节

**参数:**

 - **dtype(str):** 导出样本的数据类型。可选: 'int16', 'int32', 'float32', 'float64'

**返回:**

 - `bytes`:音频内容的字节

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
print(audio_segment.to_bytes())
```
<br/>

---

> **def to_pcm_bytes(self):**

创建pcm格式的字节

**返回:**

 - `bytes`:pcm格式的字节

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
print(audio_segment.to_pcm_bytes())
```
<br/>

---

> **def to(self, dtype='int16'):**

类型转换

**参数:**

 - **dtype(str):** 导出样本的数据类型。可选: 'int16', 'int32', 'float32', 'float64'

**返回:**

 - `str`:转换后的数据

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
print(audio_segment.to(dtype='int16'))
```
<br/>

---

> **def gain_db(self, gain):**

对音频施加分贝增益。

**参数:**

 - **gain(float|1darray):** 用于样品的分贝增益

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
audio_segment.gain_db(gain=-20)
print(audio_segment.samples)
```
<br/>

---

> **def change_speed(self, speed_rate):**

通过线性插值改变音频速度。

**参数:**

 - **speed_rate(float):** 修改的音频速率: speed_rate > 1.0, 加快音频速度; speed_rate = 1.0, 音频速度不变; speed_rate < 1.0, 减慢音频速度; speed_rate <= 0.0, 错误数值.

**异常:**

 - `ValueError`:如果速度速率小于或等于0,则引发ValueError

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
audio_segment.change_speed(speed_rate=1.2)
print(audio_segment.samples)
```
<br/>

---

> **def normalize(self, target_db=-20, max_gain_db=300.0):**

将音频归一化,使其具有所需的有效值(以分贝为单位)。

**参数:**

 - **target_db(float):** 目标均方根值,单位为分贝。这个值应该小于0.0,因为0.0是全尺寸音频。
 - **max_gain_db(float):** 最大允许的增益值,单位为分贝,这是为了防止在对全0信号进行归一化时出现Nan值。

**异常:**

 - `ValueError`:如果所需的增益大于max_gain_db,则引发ValueError

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
audio_segment.normalize(target_db=-20)
print(audio_segment.samples)
```
<br/>

---

> **def resample(self, target_sample_rate, filter='kaiser_best'):**

按目标采样率重新采样音频。

**参数:**

 - **target_sample_rate(int):** 目标均方根值,单位为分贝。这个值应该小于0.0,因为0.0是全尺寸音频。
 - **filter(str):** 使用的重采样滤波器,支持'kaiser_best'、'kaiser_fast'

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
audio_segment.resample(target_sample_rate=8000)
print(audio_segment.samples)
```
<br/>

---

> **def pad_silence(self, duration, sides='both'):**

在这个音频样本上加一段静音。

**参数:**

 - **duration(float):** 静默段的持续时间(以秒为单位)
 - **sides(str):** 添加的位置: 'beginning' - 在开始位置前增加静音段; 'end' - 在结束位置增加静音段; 'both' - 在开始和结束位置都增加静音段.。

**异常:**

 - `ValueError`:如果sides的值不是beginning、end或both,则引发ValueError

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
audio_segment.pad_silence(duration=2, sides='end')
print(audio_segment.samples)
```
<br/>

---

> **def pad(self, pad_width, mode='wrap', \*\*kwargs):**

在这个音频样本上加一段音频,等同numpy.pad。

**参数:**

 - **pad_width(sequence|array_like|int):** 填充宽度
 - **sides(str|function|optional):** 填充模式

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
audio_segment.pad(pad_width=(0, 16000 * 2), mode='wrap')
print(audio_segment.samples)
```
<br/>

---

> **def shift(self, shift_ms):**

音频偏移。如果shift_ms为正,则随时间提前移位;如果为负,则随时间延迟移位。填补静音以保持持续时间不变。

**参数:**

 - **shift_ms(float):** 偏移时间。如果是正的,随时间前进;如果负,延时移位。

**异常:**

 - `ValueError`:如果shift_ms的绝对值大于音频持续时间,则引发ValueError

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
audio_segment.shift(shift_ms=1000)
print(audio_segment.samples)
```
<br/>

---

> **def subsegment(self, start_sec=None, end_sec=None):**

在给定的边界之间切割音频片段。

**参数:**

 - **start_sec(float):** 开始裁剪的位置,以秒为单位,默认为0。
 - **end_sec(float):** 结束裁剪的位置,以秒为单位,默认为音频长度。

**异常:**

 - `ValueError`:如果start_sec或end_sec的值越界,则引发ValueError

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
audio_segment.subsegment(start_sec=1, end_sec=3)
print(audio_segment.samples)
```
<br/>

---

> **def random_subsegment(self, duration):**

随机剪切指定长度的音频片段。

**参数:**

 - **duration(float):** 随机裁剪的片段长度,以秒为单位

**异常:**

 - `ValueError`:如果片段长度大于原始段,则引发ValueError

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
audio_segment.random_subsegment(duration=2)
print(audio_segment.samples)
```
<br/>

---

> **def reverb(self, reverb_file, allow_resample=True):**

使音频片段混响。

**参数:**

 - **reverb_file(str):** 混响音频的路径
 - **allow_resample(bool):** 指示是否允许在两个音频段具有不同的采样率时重采样

**异常:**

 - `ValueError`:如果两个音频段之间的采样率不匹配,则引发ValueError

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
audio_segment.reverb(reverb_file='data/reverb.wav')
print(audio_segment.samples)
```
<br/>

---

> **def reverb_and_normalize(self, reverb_file, allow_resample=True):**

使音频片段混响,然后归一化。

**参数:**

 - **reverb_file(str):** 混响音频的路径
 - **allow_resample(bool):** 指示是否允许在两个音频段具有不同的采样率时重采样

**异常:**

 - `ValueError`:如果两个音频段之间的采样率不匹配,则引发ValueError

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
audio_segment.reverb_and_normalize(reverb_file='data/reverb.wav')
print(audio_segment.samples)
```
<br/>

---

> **def add_noise(self, noise_file, snr_dB, max_gain_db=300.0, allow_resample=True):**

以特定的信噪比添加给定的噪声段。如果噪声段比该噪声段长,则从该噪声段中采样匹配长度的随机子段。

**参数:**

 - **noise_file(str):** 噪声音频的路径
 - **snr_dB(float):** 信噪比,单位为分贝
 - **max_gain_db(float):** 最大允许的增益值,单位为分贝,这是为了防止在对全0信号进行归一化时出现Nan
 - **allow_resample(bool):** 指示是否允许在两个音频段具有不同的采样率时重采样

**异常:**

 - `ValueError`:如果两个音频段之间的采样率不匹配,则引发ValueError

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
audio_segment.add_noise(noise_file='data/noise.wav', snr_dB=10)
print(audio_segment.samples)
```
<br/>

---

> **def crop(self, duration, mode='eval'):**

根据模式裁剪指定的音频长度,如果为'train'模式,则随机剪切,否则从末尾剪切。

**参数:**

 - **duration(float):** 裁剪的音频长度,以秒为单位
 - **mode(str):** 裁剪的模型,'train'或'eval'

**异常:**

 - `ValueError`:如果两个音频段之间的采样率不匹配,则引发ValueError

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test.wav")
audio_segment.crop(duration=3, mode='train')
print(audio_segment.samples)
```
<br/>

---

> **def vad(self, return_seconds=False, \*\*kwargs):**

创建给定持续时间和采样率的静音音频段。

**参数:**

 - **return_seconds(bool):** 指示是否返回秒数而不是样本索引
 - **kwargs(dict):** 传递给Silero VAD模型的参数

**返回:**

 - `List[Dict]`:语音活动时间戳列表

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file("data/test_long.wav")
speech_timestamps = audio_segment.vad(return_seconds=True)
for speech_timestamp in speech_timestamps:
    print(speech_timestamp)
```
<br/>

---

> **@property**<br/>
> **def samples(self):**

返回音频样本

**返回:**

 - `float`:返回音频样本

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file('data/test.wav')
print(audio_segment.samples)
```
<br/>

---

> **@property**<br/>
> **def sample_rate(self):**

返回音频采样率

**返回:**

 - `int`:返回音频采样率

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file('data/test.wav')
print(audio_segment.sample_rate)
```
<br/>

---

> **@property**<br/>
> **def num_samples(self):**

返回样品数量

**返回:**

 - `int`:返回样品数量

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file('data/test.wav')
print(audio_segment.num_samples)
```
<br/>

---

> **@property**<br/>
> **def duration(self):**

返回音频持续时间,以秒为单位

**返回:**

 - `float`:返回音频持续时间,以秒为单位

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file('data/test.wav')
print(audio_segment.duration)
```
<br/>

---

> **@property**<br/>
> **def rms_db(self):**

返回以分贝为单位的音频均方根能量

**返回:**

 - `float`:返回以分贝为单位的音频均方根能量

**示例代码:**

```python
from yeaudio.audio import AudioSegment

audio_segment = AudioSegment.from_file('data/test.wav')
print(audio_segment.rms_db)
```
<br/>

## VadModel

语音活动检测模型,非流式

> **def `__init__`(self,
                   batch_size: int = 1,
                   device_id: Union[str, int] = "-1",
                   quantize: bool = True,
                   intra_op_num_threads: int = 4,
                   max_end_sil: int = None):**

**参数:**

 - **batch_size (int, optional):** 批处理大小,默认为1。
 - **device_id (Union[str, int], optional):** 设备ID,用于指定模型运行的设备,默认为"-1"表示使用CPU。如果指定为GPU,则为GPU的ID。
 - **quantize (bool, optional):** 是否使用量化模型,默认为False。
 - **intra_op_num_threads (int, optional):** ONNX Runtime的线程数,默认为4。
 - **max_end_sil (int, optional):** 最大静默结束时间,如果未指定,则使用模型配置中的默认值。

> **def `__call__`(self, audio_in: Union[np.ndarray, List[np.ndarray]]) -> List:**

**参数:**

 - **audio_in (Union[np.ndarray, List[np.ndarray]]):** 输入音频数据,可以是单个numpy数组或numpy数组列表,采样率为16000

**返回:**

 - List: 返回结构为[[开始, 结束],[开始, 结束]...],如果是-1,则包含该位置,如果为[],没有检测到活动事件,单位毫秒


**示例代码:**

```python
from yeaudio.audio import AudioSegment
from yeaudio.vad_model import VadModel

vad_model = VadModel()
audio_segment = AudioSegment.from_file("data/test_long.wav")
audio_segment.resample(target_sample_rate=vad_model.sample_rate)
samples = audio_segment.samples

speech_timestamps = vad_model(samples)
for speech_timestamp in speech_timestamps:
    print(speech_timestamp)
```


## VadOnlineModel


语音活动检测模型,在线,或者叫流式

> **def `__init__`(self,
                   batch_size: int = 1,
                   device_id: Union[str, int] = "-1",
                   quantize: bool = True,
                   intra_op_num_threads: int = 4,
                   max_end_sil: int = None):**

**参数:**

 - **batch_size (int, optional):** 批处理大小,默认为1。
 - **device_id (Union[str, int], optional):** 设备ID,用于指定模型运行的设备,默认为"-1"表示使用CPU。如果指定为GPU,则为GPU的ID。
 - **quantize (bool, optional):** 是否使用量化模型,默认为False。
 - **intra_op_num_threads (int, optional):** ONNX Runtime的线程数,默认为4。
 - **max_end_sil (int, optional):** 最大静默结束时间,如果未指定,则使用模型配置中的默认值。

> **def `__call__`(self, audio_in: np.ndarray) -> List:**

**参数:**

 - **audio_in (np.ndarray):** 输入音频数据,采样率为16000

**返回:**

 - List: 返回结构为[[开始, 结束],[开始, 结束]...],如果是-1,则包含该位置,如果为[],没有检测到活动事件,单位毫秒


**示例代码:**

```python
from yeaudio.audio import AudioSegment
from yeaudio.vad_model import VadOnlineModel

vad_model = VadOnlineModel()

audio_segment = AudioSegment.from_file('data/test_long.wav')
audio_segment.resample(target_sample_rate=vad_model.sample_rate)
samples = audio_segment.samples

speech_length = len(samples)
step = 16000
param_dict = {"in_cache": []}
for sample_offset in range(0, speech_length, step):
    is_final = True if sample_offset + step >= speech_length - 1 else False
    data = samples[sample_offset:sample_offset + step]
    param_dict["is_final"] = is_final
    segments_result = vad_model(audio_in=data, param_dict=param_dict)
    if len(segments_result) > 0:
        print("segments_result", segments_result)

```

## SpeedPerturbAugmentor

随机语速扰动的音频数据增强器


> **def `__init__`(self, prob=1.0, speed_perturb_3_class=False, num_speakers=None):**

**参数:**

 - **prob(float):** 数据增强概率
 - **speed_perturb_3_class(bool):** 是否使用语速三类语速增强,只在声纹识别项目上使用
 - **num_speakers(int):** 说话人数量,只在声纹识别项目上使用

> **def `__call__`(self, audio_segment: AudioSegment, spk_id: int = None) -> AudioSegment or \[AudioSegment, int]:**

**参数:**

 - **audio_segment:** AudioSegment实例


## VolumePerturbAugmentor

随机音量扰动的音频数据增强器


> **def `__init__`(self, prob=0.0, min_gain_dBFS=-15, max_gain_dBFS=15):**

**参数:**

 - **prob(float):** 数据增强概率
 - **min_gain_dBFS(int):** 最小音量,单位为分贝。
 - **max_gain_dBFS(int):** 最大音量,单位为分贝。

> **def `__call__`(self, audio_segment: AudioSegment) -> AudioSegment:**

**参数:**

 - **audio_segment:** AudioSegment实例


## ShiftPerturbAugmentor

添加随机位移扰动的音频数增强器


> **def `__init__`(self, prob=0.0, min_shift_ms=-15, max_shift_ms=15):**

**参数:**

 - **prob(float):** 数据增强概率
 - **min_shift_ms(int):** 最小偏移,单位为毫秒。
 - **max_shift_ms(int):** 最大偏移,单位为毫秒。

> **def `__call__`(self, audio_segment: AudioSegment) -> AudioSegment:**

**参数:**

 - **audio_segment:** AudioSegment实例


## ResampleAugmentor

随机重采样的音频数据增强器


> **def `__init__`(self, prob=0.0, new_sample_rate=(8000, 16000, 24000)):**

**参数:**

 - **prob(float):** 数据增强概率
 - **new_sample_rate(list):** 新采样率列表

> **def `__call__`(self, audio_segment: AudioSegment) -> AudioSegment:**

**参数:**

 - **audio_segment:** AudioSegment实例


## NoisePerturbAugmentor

随机噪声扰动的音频数据增强器


> **def `__init__`(self, noise_dir='', prob=0.0, min_snr_dB=10, max_snr_dB=50):**

**参数:**

 - **noise_dir(str):** 噪声文件夹路径,该文件夹下是噪声音频文件
 - **prob(float):** 数据增强概率
 - **min_snr_dB(int):** 最小信噪比
 - **max_snr_dB(int):** 最大信噪比

> **def `__call__`(self, audio_segment: AudioSegment) -> AudioSegment:**

**参数:**

 - **audio_segment:** AudioSegment实例


## ReverbPerturbAugmentor

随机混响的音频数据增强器

> **def `__init__`(self, reverb_dir='', prob=0.0):**

**参数:**

 - **reverb_dir(str):** 混响文件夹路径,该文件夹下是噪声音频文件
 - **prob(float):** 数据增强概率

> **def `__call__`(self, audio_segment: AudioSegment) -> AudioSegment:**

**参数:**

 - **audio_segment:** AudioSegment实例


## SpecAugmentor

频域掩蔽和时域掩蔽的音频特征数据增强器<br/>
论文:https://arxiv.org/abs/1904.08779<br/>
论文:https://arxiv.org/abs/1912.05533

> **def `__init__`(self, prob=0.0,
                   freq_mask_ratio=0.15,
                   n_freq_masks=2,
                   time_mask_ratio=0.05,
                   n_time_masks=2,
                   inplace=True,
                   max_time_warp=5,
                   replace_with_zero=False):**

**参数:**

 - **prob(float):** 数据增强概率
 - **freq_mask_ratio(float):** 频域掩蔽的比例
 - **n_freq_masks(int):** 频域掩蔽次数
 - **time_mask_ratio(float):** 时间掩蔽的比例
 - **n_time_masks(int):** 时间掩蔽次数
 - **inplace(bool):** 用结果覆盖
 - **max_time_warp(bool):** 最大时间扭曲
 - **replace_with_zero(bool):** 是否使用0作为掩码,否则使用平均值

> **def `__call__`(self, x) -> np.ndarray:**

**参数:**

 - **x:** 音频特征,维度(time, freq)


## SpecSubAugmentor

从原始音频中随机替换部分帧,以模拟语音的时移。<br/>
论文:https://arxiv.org/abs/2106.05642

> **def `__init__`(self, prob=0.0, max_time=20, num_time_sub=3):**

**参数:**

 - **prob(float):** 数据增强概率
 - **max_time(int):** 时间替换的最大宽度
 - **num_time_sub(int):** 时间替换的的次数

> **def `__call__`(self, x) -> np.ndarray:**

**参数:**

 - **x:** 音频特征,维度(time, freq)

<br/>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/yeyupiaoling/YeAudio",
    "name": "yeaudio",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "audio, speech",
    "author": "yeyupiaoling",
    "author_email": null,
    "download_url": "https://github.com/yeyupiaoling/YeAudio.git",
    "platform": null,
    "description": "# \u591c\u96e8\u98d8\u96f6\u97f3\u9891\u5de5\u5177\r\n\r\n\u8fd9\u6b3ePython\u97f3\u9891\u5904\u7406\u5de5\u5177\u529f\u80fd\u5f3a\u5927\uff0c\u652f\u6301\u8bfb\u53d6\u591a\u79cd\u683c\u5f0f\u7684\u97f3\u9891\u6587\u4ef6\u3002\u5b83\u4e0d\u4ec5\u80fd\u591f\u5bf9\u97f3\u9891\u8fdb\u884c\u88c1\u526a\u3001\u6dfb\u52a0\u6df7\u54cd\u3001\u6dfb\u52a0\u566a\u58f0\u7b49\u591a\u79cd\u5904\u7406\u64cd\u4f5c\uff0c\u8fd8\u5e7f\u6cdb\u5e94\u7528\u4e8e\u8bed\u97f3\u8bc6\u522b\u3001\u8bed\u97f3\u5408\u6210\u3001\u58f0\u97f3\u5206\u7c7b\u4ee5\u53ca\u58f0\u7eb9\u8bc6\u522b\u7b49\u591a\u4e2a\u9879\u76ee\u9886\u57df\u3002\r\n\r\n# \u5b89\u88c5\r\n\r\n\u4f7f\u7528pip\u5b89\u88c5\u3002\r\n\r\n```shell\r\npip install yeaudio -U -i https://pypi.tuna.tsinghua.edu.cn/simple\r\n```\r\n\r\n**\uff08\u63a8\u8350\uff09** \u4f7f\u7528\u6e90\u7801\u5b89\u88c5\u3002\r\n\r\n```shell\r\ngit clone https://github.com/yeyupiaoling/YeAudio.git\r\ncd YeAudio\r\npip install . -i https://pypi.tuna.tsinghua.edu.cn/simple\r\n```\r\n\r\n# \u5feb\u901f\u4f7f\u7528\r\n\r\n\u8bfb\u53d6\u666e\u901a\u97f3\u9891\uff1a\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file('data/test.wav')\r\nprint(f'\u97f3\u9891\u957f\u5ea6\uff1a{audio_segment.duration}')\r\nprint(f'\u97f3\u9891\u91c7\u6837\u7387\uff1a{audio_segment.sample_rate}')\r\nprint(f'\u97f3\u9891\u6570\u636e\uff1a{audio_segment.samples}')\r\n```\r\n\r\n\u8bfb\u53d6\u89c6\u9891\u4e2d\u7684\u97f3\u9891\uff1a\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file('data/test.mp4')\r\nprint(f'\u97f3\u9891\u957f\u5ea6\uff1a{audio_segment.duration}')\r\nprint(f'\u97f3\u9891\u91c7\u6837\u7387\uff1a{audio_segment.sample_rate}')\r\nprint(f'\u97f3\u9891\u6570\u636e\uff1a{audio_segment.samples}')\r\n```\r\n\r\n# API\u6587\u6863\r\n\r\n - [AudioSegment](#AudioSegment)\r\n - [VadModel](#VadModel)\r\n - [VadOnlineModel](#VadOnlineModel)\r\n - [SpeedPerturbAugmentor](#SpeedPerturbAugmentor)\r\n - [VolumePerturbAugmentor](#VolumePerturbAugmentor)\r\n - [ShiftPerturbAugmentor](#ShiftPerturbAugmentor)\r\n - [ResampleAugmentor](#ResampleAugmentor)\r\n - [NoisePerturbAugmentor](#NoisePerturbAugmentor)\r\n - [ReverbPerturbAugmentor](#ReverbPerturbAugmentor)\r\n - [SpecAugmentor](#SpecAugmentor)\r\n - [SpecSubAugmentor](#SpecSubAugmentor)\r\n\r\n## AudioSegment\r\n\r\n\u57fa\u7840\u97f3\u9891\u5de5\u5177\uff0c\u652f\u6301\u8bfb\u53d6\u591a\u79cd\u683c\u5f0f\u7684\u97f3\u9891\u6587\u4ef6\uff0c\u5df2\u7ecf\u5404\u79cd\u57fa\u7840\u64cd\u4f5c\uff0c\u5982\u88c1\u526a\u3001\u6dfb\u52a0\u6df7\u54cd\u3001\u6dfb\u52a0\u566a\u58f0\u7b49\u3002\r\n\r\n<br/>\r\n\r\n> **def `__init__`(self, samples, sample_rate):**\r\n\r\n\u521b\u5efa\u5355\u901a\u9053\u97f3\u9891\u7247\u6bb5\u5b9e\u4f8b\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **samples\uff08ndarray.float32\uff09\uff1a** \u9891\u6570\u636e\uff0c\u7ef4\u5ea6\u4e3a[num_samples x num_channels]\r\n - **sample_rate\uff08int\uff09\uff1a** \u97f3\u9891\u7684\u91c7\u6837\u7387\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nimport soundfile\r\nfrom yeaudio.audio import AudioSegment\r\n\r\nsamples, sample_rate = soundfile.read(\"data/test.wav\")\r\naudio_segment = AudioSegment(samples, sample_rate)\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def `__eq__`(self, other):**\r\n\r\n\u8fd4\u56de\u4e24\u4e2a\u5bf9\u8c61\u662f\u5426\u76f8\u7b49\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **other\uff08AudioSegment\uff09\uff1a** \u6bd4\u8f83\u7684\u53e6\u4e00\u4e2a\u97f3\u9891\u7247\u6bb5\u5b9e\u4f8b\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment1 = AudioSegment.from_file(\"data/test.wav\")\r\naudio_segment2 = AudioSegment.from_file(\"data/test.wav\")\r\nprint(audio_segment1 == audio_segment2)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def `__ne__`(self, other):**\r\n\r\n\u8fd4\u56de\u4e24\u4e2a\u5b9e\u4f8b\u662f\u5426\u4e0d\u76f8\u7b49\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **other\uff08AudioSegment\uff09\uff1a** \u6bd4\u8f83\u7684\u53e6\u4e00\u4e2a\u97f3\u9891\u7247\u6bb5\u5b9e\u4f8b\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment1 = AudioSegment.from_file(\"data/test.wav\")\r\naudio_segment2 = AudioSegment.from_file(\"data/test.wav\")\r\nprint(audio_segment1 != audio_segment2)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def `__str__`(self):**\r\n\r\n\u8fd4\u56de\u8be5\u97f3\u9891\u7684\u4fe1\u606f\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\nprint(str(audio_segment))\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **@classmethod**<br/>\r\n> **def from_file(cls, file):**\r\n\r\n\u4ece\u97f3\u9891\u6587\u4ef6\u521b\u5efa\u97f3\u9891\u6bb5\uff0c\u652f\u6301wav\u3001mp3\u3001mp4\u7b49\u591a\u79cd\u97f3\u9891\u683c\u5f0f\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **file\uff08str|BufferedReader\uff09\uff1a** \u4ef6\u8def\u5f84\uff0c\u6216\u8005\u6587\u4ef6\u5bf9\u8c61\r\n\r\n**\u8fd4\u56de\uff1a**\r\n\r\n - `AudioSegment`\uff1a\u97f3\u9891\u7247\u6bb5\u5b9e\u4f8b\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file('data/test.wav')\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **@classmethod**<br/>\r\n> **def slice_from_file(cls, file, start=None, end=None):**\r\n\r\n\u53ea\u52a0\u8f7d\u4e00\u5c0f\u6bb5\u97f3\u9891\uff0c\u800c\u4e0d\u9700\u8981\u5c06\u6574\u4e2a\u6587\u4ef6\u52a0\u8f7d\u5230\u5185\u5b58\u4e2d\uff0c\u8fd9\u662f\u975e\u5e38\u6d6a\u8d39\u7684\u3002\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **file\uff08str|file\uff09\uff1a** \u8f93\u5165\u97f3\u9891\u6587\u4ef6\u8def\u5f84\u6216\u6587\u4ef6\u5bf9\u8c61\r\n - **start\uff08float\uff09\uff1a** \u5f00\u59cb\u65f6\u95f4\uff0c\u5355\u4f4d\u4e3a\u79d2\u3002\u5982\u679cstart\u662f\u8d1f\u7684\uff0c\u5219\u5b83\u4ece\u672b\u5c3e\u5f00\u59cb\u8ba1\u7b97\u3002\u5982\u679c\u6ca1\u6709\u63d0\u4f9b\uff0c\u8fd9\u4e2a\u51fd\u6570\u5c06\u4ece\u6700\u5f00\u59cb\u8bfb\u53d6\u3002\r\n - **end\uff08float\uff09\uff1a** \u7ed3\u675f\u65f6\u95f4\uff0c\u5355\u4f4d\u4e3a\u79d2\u3002\u5982\u679cend\u662f\u8d1f\u7684\uff0c\u5219\u5b83\u4ece\u672b\u5c3e\u5f00\u59cb\u8ba1\u7b97\u3002\u5982\u679c\u6ca1\u6709\u63d0\u4f9b\uff0c\u9ed8\u8ba4\u7684\u884c\u4e3a\u662f\u8bfb\u53d6\u5230\u6587\u4ef6\u7684\u672b\u5c3e\u3002\r\n\r\n**\u8fd4\u56de\uff1a**\r\n\r\n - `AudioSegment`\uff1aAudioSegment\u8f93\u5165\u97f3\u9891\u6587\u4ef6\u7684\u6307\u5b9a\u7247\u7684\u5b9e\u4f8b\r\n\r\n**\u5f02\u5e38\uff1a**\r\n\r\n - `ValueError`\uff1a\u5982\u679c\u5f00\u59cb\u6216\u7ed3\u675f\u7684\u8bbe\u5b9a\u4e0d\u6b63\u786e\uff0c\u5219\u4f1a\u629b\u51faValueError\u5f02\u5e38\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.slice_from_file('data/test.wav', start=1, end=2)\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **@classmethod**<br/>\r\n> **def from_bytes(cls, data):**\r\n\r\n\u4ecewav\u683c\u5f0f\u7684\u97f3\u9891\u5b57\u8282\u521b\u5efa\u97f3\u9891\u6bb5\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **data\uff08bytes\uff09\uff1a** \u5305\u542b\u97f3\u9891\u6837\u672c\u7684\u5b57\u8282\r\n\r\n**\u8fd4\u56de\uff1a**\r\n\r\n - `AudioSegment`\uff1a\u97f3\u9891\u7247\u6bb5\u5b9e\u4f8b\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\nwith open('data/test.wav', 'rb') as f:\r\n    data = f.read()\r\n    audio_segment = AudioSegment.from_bytes(data)\r\n    print(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **@classmethod**<br/>\r\n> **def from_pcm_bytes(cls, data, channels=1, samp_width=2, sample_rate=16000):**\r\n\r\n\u4ece\u5305\u542b\u65e0\u683c\u5f0fPCM\u97f3\u9891\u7684\u5b57\u8282\u521b\u5efa\u97f3\u9891\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **data\uff08bytes\uff09\uff1a** \u5305\u542b\u97f3\u9891\u6837\u672c\u7684\u5b57\u8282\r\n - **channels\uff08int\uff09\uff1a** \u97f3\u9891\u7684\u901a\u9053\u6570\r\n - **samp_width\uff08int\uff09\uff1a** \u9891\u91c7\u6837\u7684\u5bbd\u5ea6\uff0c\u5982np.int16\u4e3a2\r\n - **sample_rate\uff08int\uff09\uff1a** \u97f3\u9891\u6837\u672c\u91c7\u6837\u7387\r\n\r\n**\u8fd4\u56de\uff1a**\r\n\r\n - `AudioSegment`\uff1a\u97f3\u9891\u7247\u6bb5\u5b9e\u4f8b\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\nwith open('data/test.wav', 'rb') as f:\r\n    data = f.read()\r\n    audio_segment = AudioSegment.from_pcm_bytes(data[44:], channels=1, samp_width=2, sample_rate=16000)\r\n    print(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **@classmethod**<br/>\r\n> **def from_ndarray(cls, data, sample_rate=16000):**\r\n\r\n\u4ecenumpy.ndarray\u521b\u5efa\u97f3\u9891\u6bb5\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **data\uff08bytes\uff09\uff1a** numpy.ndarray\u7c7b\u578b\u7684\u97f3\u9891\u6570\u636e\r\n - **sample_rate\uff08int\uff09\uff1a** \u97f3\u9891\u6837\u672c\u91c7\u6837\u7387\r\n\r\n**\u8fd4\u56de\uff1a**\r\n\r\n - `AudioSegment`\uff1a\u97f3\u9891\u7247\u6bb5\u5b9e\u4f8b\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nimport soundfile\r\n\r\nfrom yeaudio.audio import AudioSegment\r\n\r\nsamples, sample_rate = soundfile.read('data/test.wav')\r\naudio_segment = AudioSegment.from_ndarray(samples, sample_rate=16000)\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **@classmethod**<br/>\r\n> **def concatenate(cls, \\*segments):**\r\n\r\n\u5c06\u4efb\u610f\u6570\u91cf\u7684\u97f3\u9891\u7247\u6bb5\u8fde\u63a5\u5728\u4e00\u8d77\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **segments\uff08AudioSegment\uff09\uff1a** \u8f93\u5165\u97f3\u9891\u7247\u6bb5\u88ab\u8fde\u63a5\r\n\r\n**\u8fd4\u56de\uff1a**\r\n\r\n - `AudioSegment`\uff1a\u97f3\u9891\u7247\u6bb5\u5b9e\u4f8b\r\n\r\n**\u5f02\u5e38\uff1a**\r\n\r\n - `ValueError`\uff1a\u5982\u679c\u97f3\u9891\u5b9e\u4f8b\u5217\u8868\u4e3a\u7a7a\u6216\u8005\u91c7\u6837\u7387\u4e0d\u4e00\u81f4\uff0c\u5219\u4f1a\u629b\u51faValueError\u5f02\u5e38\r\n - `TypeError`\uff1a\u5982\u679c\u8f93\u5165\u7684\u7247\u6bb5\u7c7b\u578b\u4e0d\u4e00\u81f4\uff0c\u5219\u4f1a\u629b\u51faTypeError\u5f02\u5e38\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment1 = AudioSegment.from_file('data/test.wav')\r\naudio_segment2 = AudioSegment.from_file('data/test.wav')\r\naudio_segment = AudioSegment.concatenate(audio_segment1, audio_segment2)\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **@classmethod**<br/>\r\n> **def make_silence(cls, duration, sample_rate):**\r\n\r\n\u521b\u5efa\u7ed9\u5b9a\u6301\u7eed\u65f6\u95f4\u548c\u91c7\u6837\u7387\u7684\u9759\u97f3\u97f3\u9891\u6bb5\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **duration\uff08float\uff09\uff1a** \u9759\u97f3\u7684\u65f6\u95f4\uff0c\u4ee5\u79d2\u4e3a\u5355\u4f4d\r\n - **sample_rate\uff08int\uff09\uff1a** \u97f3\u9891\u91c7\u6837\u7387\r\n\r\n**\u8fd4\u56de\uff1a**\r\n\r\n - `AudioSegment`\uff1a\u7ed9\u5b9a\u6301\u7eed\u65f6\u95f4\u7684\u9759\u97f3AudioSegment\u5b9e\u4f8b\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.make_silence(duration=10, sample_rate=16000)\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def to_wav_file(self, filepath, dtype='float32'):**\r\n\r\n\u4fdd\u5b58\u97f3\u9891\u6bb5\u5230\u78c1\u76d8\u4e3awav\u6587\u4ef6\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **filepath\uff08str|file\uff09\uff1a** WAV\u6587\u4ef6\u8def\u5f84\u6216\u6587\u4ef6\u5bf9\u8c61\uff0c\u4ee5\u4fdd\u5b58\u97f3\u9891\u6bb5\r\n - **dtype\uff08str\uff09\uff1a** \u97f3\u9891\u6570\u636e\u7c7b\u578b\uff0c\u53ef\u9009: 'int16', 'int32', 'float32', 'float64'\r\n\r\n**\u5f02\u5e38\uff1a**\r\n\r\n - `TypeError`\uff1a\u5982\u679c\u7c7b\u578b\u4e0d\u652f\u6301\uff0c\u5219\u4f1a\u629b\u51faTypeError\u5f02\u5e38\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\naudio_segment.to_wav_file(\"output.wav\")\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def superimpose(self, other):**\r\n\r\n\u5c06\u53e6\u4e00\u4e2a\u6bb5\u7684\u6837\u672c\u6dfb\u52a0\u5230\u8fd9\u4e2a\u6bb5\u7684\u6837\u672c\u4e2d(\u4ee5\u6837\u672c\u65b9\u5f0f\u6dfb\u52a0\uff0c\u800c\u4e0d\u662f\u6bb5\u8fde\u63a5)\u3002\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **other\uff08AudioSegments\uff09\uff1a** WAV\u6587\u4ef6\u8def\u5f84\u6216\u6587\u4ef6\u5bf9\u8c61\uff0c\u4ee5\u4fdd\u5b58\u97f3\u9891\u6bb5\r\n - **dtype\uff08str\uff09\uff1a** \u97f3\u9891\u6570\u636e\u7c7b\u578b\uff0c\u53ef\u9009: 'int16', 'int32', 'float32', 'float64'\r\n\r\n**\u5f02\u5e38\uff1a**\r\n\r\n - `ValueError`\uff1a\u5982\u679c\u4e24\u6bb5\u97f3\u9891\u91c7\u6837\u7387\u6216\u8005\u957f\u5ea6\u4e0d\u4e00\u81f4\uff0c\u5219\u4f1a\u629b\u51faValueError\u5f02\u5e38\r\n - `TypeError`\uff1a\u5982\u679c\u4e24\u4e2a\u7247\u6bb5\u7684\u7c7b\u578b\u4e0d\u5339\u914d\uff0c\u5219\u4f1a\u629b\u51faTypeError\u5f02\u5e38\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\nother_segment = AudioSegment.from_file(\"data/test.wav\")\r\naudio_segment.superimpose(other_segment)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def to_bytes(self, dtype='float32'):**\r\n\r\n\u521b\u5efa\u97f3\u9891\u5185\u5bb9\u7684\u5b57\u8282\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **dtype\uff08str\uff09\uff1a** \u5bfc\u51fa\u6837\u672c\u7684\u6570\u636e\u7c7b\u578b\u3002\u53ef\u9009: 'int16', 'int32', 'float32', 'float64'\r\n\r\n**\u8fd4\u56de\uff1a**\r\n\r\n - `bytes`\uff1a\u97f3\u9891\u5185\u5bb9\u7684\u5b57\u8282\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\nprint(audio_segment.to_bytes())\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def to_pcm_bytes(self):**\r\n\r\n\u521b\u5efapcm\u683c\u5f0f\u7684\u5b57\u8282\r\n\r\n**\u8fd4\u56de\uff1a**\r\n\r\n - `bytes`\uff1apcm\u683c\u5f0f\u7684\u5b57\u8282\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\nprint(audio_segment.to_pcm_bytes())\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def to(self, dtype='int16'):**\r\n\r\n\u7c7b\u578b\u8f6c\u6362\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **dtype\uff08str\uff09\uff1a** \u5bfc\u51fa\u6837\u672c\u7684\u6570\u636e\u7c7b\u578b\u3002\u53ef\u9009: 'int16', 'int32', 'float32', 'float64'\r\n\r\n**\u8fd4\u56de\uff1a**\r\n\r\n - `str`\uff1a\u8f6c\u6362\u540e\u7684\u6570\u636e\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\nprint(audio_segment.to(dtype='int16'))\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def gain_db(self, gain):**\r\n\r\n\u5bf9\u97f3\u9891\u65bd\u52a0\u5206\u8d1d\u589e\u76ca\u3002\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **gain\uff08float|1darray\uff09\uff1a** \u7528\u4e8e\u6837\u54c1\u7684\u5206\u8d1d\u589e\u76ca\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\naudio_segment.gain_db(gain=-20)\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def change_speed(self, speed_rate):**\r\n\r\n\u901a\u8fc7\u7ebf\u6027\u63d2\u503c\u6539\u53d8\u97f3\u9891\u901f\u5ea6\u3002\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **speed_rate\uff08float\uff09\uff1a** \u4fee\u6539\u7684\u97f3\u9891\u901f\u7387: speed_rate > 1.0, \u52a0\u5feb\u97f3\u9891\u901f\u5ea6; speed_rate = 1.0, \u97f3\u9891\u901f\u5ea6\u4e0d\u53d8; speed_rate < 1.0, \u51cf\u6162\u97f3\u9891\u901f\u5ea6; speed_rate <= 0.0, \u9519\u8bef\u6570\u503c.\r\n\r\n**\u5f02\u5e38\uff1a**\r\n\r\n - `ValueError`\uff1a\u5982\u679c\u901f\u5ea6\u901f\u7387\u5c0f\u4e8e\u6216\u7b49\u4e8e0\uff0c\u5219\u5f15\u53d1ValueError\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\naudio_segment.change_speed(speed_rate=1.2)\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def normalize(self, target_db=-20, max_gain_db=300.0):**\r\n\r\n\u5c06\u97f3\u9891\u5f52\u4e00\u5316\uff0c\u4f7f\u5176\u5177\u6709\u6240\u9700\u7684\u6709\u6548\u503c(\u4ee5\u5206\u8d1d\u4e3a\u5355\u4f4d)\u3002\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **target_db\uff08float\uff09\uff1a** \u76ee\u6807\u5747\u65b9\u6839\u503c\uff0c\u5355\u4f4d\u4e3a\u5206\u8d1d\u3002\u8fd9\u4e2a\u503c\u5e94\u8be5\u5c0f\u4e8e0.0\uff0c\u56e0\u4e3a0.0\u662f\u5168\u5c3a\u5bf8\u97f3\u9891\u3002\r\n - **max_gain_db\uff08float\uff09\uff1a** \u6700\u5927\u5141\u8bb8\u7684\u589e\u76ca\u503c\uff0c\u5355\u4f4d\u4e3a\u5206\u8d1d\uff0c\u8fd9\u662f\u4e3a\u4e86\u9632\u6b62\u5728\u5bf9\u51680\u4fe1\u53f7\u8fdb\u884c\u5f52\u4e00\u5316\u65f6\u51fa\u73b0Nan\u503c\u3002\r\n\r\n**\u5f02\u5e38\uff1a**\r\n\r\n - `ValueError`\uff1a\u5982\u679c\u6240\u9700\u7684\u589e\u76ca\u5927\u4e8emax_gain_db\uff0c\u5219\u5f15\u53d1ValueError\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\naudio_segment.normalize(target_db=-20)\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def resample(self, target_sample_rate, filter='kaiser_best'):**\r\n\r\n\u6309\u76ee\u6807\u91c7\u6837\u7387\u91cd\u65b0\u91c7\u6837\u97f3\u9891\u3002\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **target_sample_rate\uff08int\uff09\uff1a** \u76ee\u6807\u5747\u65b9\u6839\u503c\uff0c\u5355\u4f4d\u4e3a\u5206\u8d1d\u3002\u8fd9\u4e2a\u503c\u5e94\u8be5\u5c0f\u4e8e0.0\uff0c\u56e0\u4e3a0.0\u662f\u5168\u5c3a\u5bf8\u97f3\u9891\u3002\r\n - **filter\uff08str\uff09\uff1a** \u4f7f\u7528\u7684\u91cd\u91c7\u6837\u6ee4\u6ce2\u5668\uff0c\u652f\u6301'kaiser_best'\u3001'kaiser_fast'\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\naudio_segment.resample(target_sample_rate=8000)\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def pad_silence(self, duration, sides='both'):**\r\n\r\n\u5728\u8fd9\u4e2a\u97f3\u9891\u6837\u672c\u4e0a\u52a0\u4e00\u6bb5\u9759\u97f3\u3002\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **duration\uff08float\uff09\uff1a** \u9759\u9ed8\u6bb5\u7684\u6301\u7eed\u65f6\u95f4(\u4ee5\u79d2\u4e3a\u5355\u4f4d)\r\n - **sides\uff08str\uff09\uff1a** \u6dfb\u52a0\u7684\u4f4d\u7f6e: 'beginning' - \u5728\u5f00\u59cb\u4f4d\u7f6e\u524d\u589e\u52a0\u9759\u97f3\u6bb5; 'end' - \u5728\u7ed3\u675f\u4f4d\u7f6e\u589e\u52a0\u9759\u97f3\u6bb5; 'both' - \u5728\u5f00\u59cb\u548c\u7ed3\u675f\u4f4d\u7f6e\u90fd\u589e\u52a0\u9759\u97f3\u6bb5.\u3002\r\n\r\n**\u5f02\u5e38\uff1a**\r\n\r\n - `ValueError`\uff1a\u5982\u679csides\u7684\u503c\u4e0d\u662fbeginning\u3001end\u6216both\uff0c\u5219\u5f15\u53d1ValueError\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\naudio_segment.pad_silence(duration=2, sides='end')\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def pad(self, pad_width, mode='wrap', \\*\\*kwargs):**\r\n\r\n\u5728\u8fd9\u4e2a\u97f3\u9891\u6837\u672c\u4e0a\u52a0\u4e00\u6bb5\u97f3\u9891\uff0c\u7b49\u540cnumpy.pad\u3002\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **pad_width\uff08sequence|array_like|int\uff09\uff1a** \u586b\u5145\u5bbd\u5ea6\r\n - **sides\uff08str|function|optional\uff09\uff1a** \u586b\u5145\u6a21\u5f0f\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\naudio_segment.pad(pad_width=(0, 16000 * 2), mode='wrap')\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def shift(self, shift_ms):**\r\n\r\n\u97f3\u9891\u504f\u79fb\u3002\u5982\u679cshift_ms\u4e3a\u6b63\uff0c\u5219\u968f\u65f6\u95f4\u63d0\u524d\u79fb\u4f4d;\u5982\u679c\u4e3a\u8d1f\uff0c\u5219\u968f\u65f6\u95f4\u5ef6\u8fdf\u79fb\u4f4d\u3002\u586b\u8865\u9759\u97f3\u4ee5\u4fdd\u6301\u6301\u7eed\u65f6\u95f4\u4e0d\u53d8\u3002\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **shift_ms\uff08float\uff09\uff1a** \u504f\u79fb\u65f6\u95f4\u3002\u5982\u679c\u662f\u6b63\u7684\uff0c\u968f\u65f6\u95f4\u524d\u8fdb\uff1b\u5982\u679c\u8d1f\uff0c\u5ef6\u65f6\u79fb\u4f4d\u3002\r\n\r\n**\u5f02\u5e38\uff1a**\r\n\r\n - `ValueError`\uff1a\u5982\u679cshift_ms\u7684\u7edd\u5bf9\u503c\u5927\u4e8e\u97f3\u9891\u6301\u7eed\u65f6\u95f4\uff0c\u5219\u5f15\u53d1ValueError\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\naudio_segment.shift(shift_ms=1000)\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def subsegment(self, start_sec=None, end_sec=None):**\r\n\r\n\u5728\u7ed9\u5b9a\u7684\u8fb9\u754c\u4e4b\u95f4\u5207\u5272\u97f3\u9891\u7247\u6bb5\u3002\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **start_sec\uff08float\uff09\uff1a** \u5f00\u59cb\u88c1\u526a\u7684\u4f4d\u7f6e\uff0c\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff0c\u9ed8\u8ba4\u4e3a0\u3002\r\n - **end_sec\uff08float\uff09\uff1a** \u7ed3\u675f\u88c1\u526a\u7684\u4f4d\u7f6e\uff0c\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff0c\u9ed8\u8ba4\u4e3a\u97f3\u9891\u957f\u5ea6\u3002\r\n\r\n**\u5f02\u5e38\uff1a**\r\n\r\n - `ValueError`\uff1a\u5982\u679cstart_sec\u6216end_sec\u7684\u503c\u8d8a\u754c\uff0c\u5219\u5f15\u53d1ValueError\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\naudio_segment.subsegment(start_sec=1, end_sec=3)\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def random_subsegment(self, duration):**\r\n\r\n\u968f\u673a\u526a\u5207\u6307\u5b9a\u957f\u5ea6\u7684\u97f3\u9891\u7247\u6bb5\u3002\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **duration\uff08float\uff09\uff1a** \u968f\u673a\u88c1\u526a\u7684\u7247\u6bb5\u957f\u5ea6\uff0c\u4ee5\u79d2\u4e3a\u5355\u4f4d\r\n\r\n**\u5f02\u5e38\uff1a**\r\n\r\n - `ValueError`\uff1a\u5982\u679c\u7247\u6bb5\u957f\u5ea6\u5927\u4e8e\u539f\u59cb\u6bb5\uff0c\u5219\u5f15\u53d1ValueError\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\naudio_segment.random_subsegment(duration=2)\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def reverb(self, reverb_file, allow_resample=True):**\r\n\r\n\u4f7f\u97f3\u9891\u7247\u6bb5\u6df7\u54cd\u3002\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **reverb_file\uff08str\uff09\uff1a** \u6df7\u54cd\u97f3\u9891\u7684\u8def\u5f84\r\n - **allow_resample\uff08bool\uff09\uff1a** \u6307\u793a\u662f\u5426\u5141\u8bb8\u5728\u4e24\u4e2a\u97f3\u9891\u6bb5\u5177\u6709\u4e0d\u540c\u7684\u91c7\u6837\u7387\u65f6\u91cd\u91c7\u6837\r\n\r\n**\u5f02\u5e38\uff1a**\r\n\r\n - `ValueError`\uff1a\u5982\u679c\u4e24\u4e2a\u97f3\u9891\u6bb5\u4e4b\u95f4\u7684\u91c7\u6837\u7387\u4e0d\u5339\u914d\uff0c\u5219\u5f15\u53d1ValueError\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\naudio_segment.reverb(reverb_file='data/reverb.wav')\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def reverb_and_normalize(self, reverb_file, allow_resample=True):**\r\n\r\n\u4f7f\u97f3\u9891\u7247\u6bb5\u6df7\u54cd\uff0c\u7136\u540e\u5f52\u4e00\u5316\u3002\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **reverb_file\uff08str\uff09\uff1a** \u6df7\u54cd\u97f3\u9891\u7684\u8def\u5f84\r\n - **allow_resample\uff08bool\uff09\uff1a** \u6307\u793a\u662f\u5426\u5141\u8bb8\u5728\u4e24\u4e2a\u97f3\u9891\u6bb5\u5177\u6709\u4e0d\u540c\u7684\u91c7\u6837\u7387\u65f6\u91cd\u91c7\u6837\r\n\r\n**\u5f02\u5e38\uff1a**\r\n\r\n - `ValueError`\uff1a\u5982\u679c\u4e24\u4e2a\u97f3\u9891\u6bb5\u4e4b\u95f4\u7684\u91c7\u6837\u7387\u4e0d\u5339\u914d\uff0c\u5219\u5f15\u53d1ValueError\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\naudio_segment.reverb_and_normalize(reverb_file='data/reverb.wav')\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def add_noise(self, noise_file, snr_dB, max_gain_db=300.0, allow_resample=True):**\r\n\r\n\u4ee5\u7279\u5b9a\u7684\u4fe1\u566a\u6bd4\u6dfb\u52a0\u7ed9\u5b9a\u7684\u566a\u58f0\u6bb5\u3002\u5982\u679c\u566a\u58f0\u6bb5\u6bd4\u8be5\u566a\u58f0\u6bb5\u957f\uff0c\u5219\u4ece\u8be5\u566a\u58f0\u6bb5\u4e2d\u91c7\u6837\u5339\u914d\u957f\u5ea6\u7684\u968f\u673a\u5b50\u6bb5\u3002\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **noise_file\uff08str\uff09\uff1a** \u566a\u58f0\u97f3\u9891\u7684\u8def\u5f84\r\n - **snr_dB\uff08float\uff09\uff1a** \u4fe1\u566a\u6bd4\uff0c\u5355\u4f4d\u4e3a\u5206\u8d1d\r\n - **max_gain_db\uff08float\uff09\uff1a** \u6700\u5927\u5141\u8bb8\u7684\u589e\u76ca\u503c\uff0c\u5355\u4f4d\u4e3a\u5206\u8d1d\uff0c\u8fd9\u662f\u4e3a\u4e86\u9632\u6b62\u5728\u5bf9\u51680\u4fe1\u53f7\u8fdb\u884c\u5f52\u4e00\u5316\u65f6\u51fa\u73b0Nan\r\n - **allow_resample\uff08bool\uff09\uff1a** \u6307\u793a\u662f\u5426\u5141\u8bb8\u5728\u4e24\u4e2a\u97f3\u9891\u6bb5\u5177\u6709\u4e0d\u540c\u7684\u91c7\u6837\u7387\u65f6\u91cd\u91c7\u6837\r\n\r\n**\u5f02\u5e38\uff1a**\r\n\r\n - `ValueError`\uff1a\u5982\u679c\u4e24\u4e2a\u97f3\u9891\u6bb5\u4e4b\u95f4\u7684\u91c7\u6837\u7387\u4e0d\u5339\u914d\uff0c\u5219\u5f15\u53d1ValueError\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\naudio_segment.add_noise(noise_file='data/noise.wav', snr_dB=10)\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def crop(self, duration, mode='eval'):**\r\n\r\n\u6839\u636e\u6a21\u5f0f\u88c1\u526a\u6307\u5b9a\u7684\u97f3\u9891\u957f\u5ea6\uff0c\u5982\u679c\u4e3a'train'\u6a21\u5f0f\uff0c\u5219\u968f\u673a\u526a\u5207\uff0c\u5426\u5219\u4ece\u672b\u5c3e\u526a\u5207\u3002\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **duration\uff08float\uff09\uff1a** \u88c1\u526a\u7684\u97f3\u9891\u957f\u5ea6\uff0c\u4ee5\u79d2\u4e3a\u5355\u4f4d\r\n - **mode\uff08str\uff09\uff1a** \u88c1\u526a\u7684\u6a21\u578b\uff0c'train'\u6216'eval'\r\n\r\n**\u5f02\u5e38\uff1a**\r\n\r\n - `ValueError`\uff1a\u5982\u679c\u4e24\u4e2a\u97f3\u9891\u6bb5\u4e4b\u95f4\u7684\u91c7\u6837\u7387\u4e0d\u5339\u914d\uff0c\u5219\u5f15\u53d1ValueError\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test.wav\")\r\naudio_segment.crop(duration=3, mode='train')\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **def vad(self, return_seconds=False, \\*\\*kwargs):**\r\n\r\n\u521b\u5efa\u7ed9\u5b9a\u6301\u7eed\u65f6\u95f4\u548c\u91c7\u6837\u7387\u7684\u9759\u97f3\u97f3\u9891\u6bb5\u3002\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **return_seconds\uff08bool\uff09\uff1a** \u6307\u793a\u662f\u5426\u8fd4\u56de\u79d2\u6570\u800c\u4e0d\u662f\u6837\u672c\u7d22\u5f15\r\n - **kwargs\uff08dict\uff09\uff1a** \u4f20\u9012\u7ed9Silero VAD\u6a21\u578b\u7684\u53c2\u6570\r\n\r\n**\u8fd4\u56de\uff1a**\r\n\r\n - `List[Dict]`\uff1a\u8bed\u97f3\u6d3b\u52a8\u65f6\u95f4\u6233\u5217\u8868\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file(\"data/test_long.wav\")\r\nspeech_timestamps = audio_segment.vad(return_seconds=True)\r\nfor speech_timestamp in speech_timestamps:\r\n    print(speech_timestamp)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **@property**<br/>\r\n> **def samples(self):**\r\n\r\n\u8fd4\u56de\u97f3\u9891\u6837\u672c\r\n\r\n**\u8fd4\u56de\uff1a**\r\n\r\n - `float`\uff1a\u8fd4\u56de\u97f3\u9891\u6837\u672c\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file('data/test.wav')\r\nprint(audio_segment.samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **@property**<br/>\r\n> **def sample_rate(self):**\r\n\r\n\u8fd4\u56de\u97f3\u9891\u91c7\u6837\u7387\r\n\r\n**\u8fd4\u56de\uff1a**\r\n\r\n - `int`\uff1a\u8fd4\u56de\u97f3\u9891\u91c7\u6837\u7387\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file('data/test.wav')\r\nprint(audio_segment.sample_rate)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **@property**<br/>\r\n> **def num_samples(self):**\r\n\r\n\u8fd4\u56de\u6837\u54c1\u6570\u91cf\r\n\r\n**\u8fd4\u56de\uff1a**\r\n\r\n - `int`\uff1a\u8fd4\u56de\u6837\u54c1\u6570\u91cf\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file('data/test.wav')\r\nprint(audio_segment.num_samples)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **@property**<br/>\r\n> **def duration(self):**\r\n\r\n\u8fd4\u56de\u97f3\u9891\u6301\u7eed\u65f6\u95f4\uff0c\u4ee5\u79d2\u4e3a\u5355\u4f4d\r\n\r\n**\u8fd4\u56de\uff1a**\r\n\r\n - `float`\uff1a\u8fd4\u56de\u97f3\u9891\u6301\u7eed\u65f6\u95f4\uff0c\u4ee5\u79d2\u4e3a\u5355\u4f4d\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file('data/test.wav')\r\nprint(audio_segment.duration)\r\n```\r\n<br/>\r\n\r\n---\r\n\r\n> **@property**<br/>\r\n> **def rms_db(self):**\r\n\r\n\u8fd4\u56de\u4ee5\u5206\u8d1d\u4e3a\u5355\u4f4d\u7684\u97f3\u9891\u5747\u65b9\u6839\u80fd\u91cf\r\n\r\n**\u8fd4\u56de\uff1a**\r\n\r\n - `float`\uff1a\u8fd4\u56de\u4ee5\u5206\u8d1d\u4e3a\u5355\u4f4d\u7684\u97f3\u9891\u5747\u65b9\u6839\u80fd\u91cf\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\n\r\naudio_segment = AudioSegment.from_file('data/test.wav')\r\nprint(audio_segment.rms_db)\r\n```\r\n<br/>\r\n\r\n## VadModel\r\n\r\n\u8bed\u97f3\u6d3b\u52a8\u68c0\u6d4b\u6a21\u578b\uff0c\u975e\u6d41\u5f0f\r\n\r\n> **def `__init__`(self,\r\n                   batch_size: int = 1,\r\n                   device_id: Union[str, int] = \"-1\",\r\n                   quantize: bool = True,\r\n                   intra_op_num_threads: int = 4,\r\n                   max_end_sil: int = None):**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **batch_size (int, optional):** \u6279\u5904\u7406\u5927\u5c0f\uff0c\u9ed8\u8ba4\u4e3a1\u3002\r\n - **device_id (Union[str, int], optional):** \u8bbe\u5907ID\uff0c\u7528\u4e8e\u6307\u5b9a\u6a21\u578b\u8fd0\u884c\u7684\u8bbe\u5907\uff0c\u9ed8\u8ba4\u4e3a\"-1\"\u8868\u793a\u4f7f\u7528CPU\u3002\u5982\u679c\u6307\u5b9a\u4e3aGPU\uff0c\u5219\u4e3aGPU\u7684ID\u3002\r\n - **quantize (bool, optional):** \u662f\u5426\u4f7f\u7528\u91cf\u5316\u6a21\u578b\uff0c\u9ed8\u8ba4\u4e3aFalse\u3002\r\n - **intra_op_num_threads (int, optional):** ONNX Runtime\u7684\u7ebf\u7a0b\u6570\uff0c\u9ed8\u8ba4\u4e3a4\u3002\r\n - **max_end_sil (int, optional):** \u6700\u5927\u9759\u9ed8\u7ed3\u675f\u65f6\u95f4\uff0c\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u6a21\u578b\u914d\u7f6e\u4e2d\u7684\u9ed8\u8ba4\u503c\u3002\r\n\r\n> **def `__call__`(self, audio_in: Union[np.ndarray, List[np.ndarray]]) -> List:**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **audio_in (Union[np.ndarray, List[np.ndarray]]):** \u8f93\u5165\u97f3\u9891\u6570\u636e\uff0c\u53ef\u4ee5\u662f\u5355\u4e2anumpy\u6570\u7ec4\u6216numpy\u6570\u7ec4\u5217\u8868\uff0c\u91c7\u6837\u7387\u4e3a16000\r\n\r\n**\u8fd4\u56de\uff1a**\r\n\r\n - List: \u8fd4\u56de\u7ed3\u6784\u4e3a[[\u5f00\u59cb, \u7ed3\u675f],[\u5f00\u59cb, \u7ed3\u675f]...]\uff0c\u5982\u679c\u662f-1\uff0c\u5219\u5305\u542b\u8be5\u4f4d\u7f6e\uff0c\u5982\u679c\u4e3a[]\uff0c\u6ca1\u6709\u68c0\u6d4b\u5230\u6d3b\u52a8\u4e8b\u4ef6\uff0c\u5355\u4f4d\u6beb\u79d2\r\n\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\nfrom yeaudio.vad_model import VadModel\r\n\r\nvad_model = VadModel()\r\naudio_segment = AudioSegment.from_file(\"data/test_long.wav\")\r\naudio_segment.resample(target_sample_rate=vad_model.sample_rate)\r\nsamples = audio_segment.samples\r\n\r\nspeech_timestamps = vad_model(samples)\r\nfor speech_timestamp in speech_timestamps:\r\n    print(speech_timestamp)\r\n```\r\n\r\n\r\n## VadOnlineModel\r\n\r\n\r\n\u8bed\u97f3\u6d3b\u52a8\u68c0\u6d4b\u6a21\u578b\uff0c\u5728\u7ebf\uff0c\u6216\u8005\u53eb\u6d41\u5f0f\r\n\r\n> **def `__init__`(self,\r\n                   batch_size: int = 1,\r\n                   device_id: Union[str, int] = \"-1\",\r\n                   quantize: bool = True,\r\n                   intra_op_num_threads: int = 4,\r\n                   max_end_sil: int = None):**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **batch_size (int, optional):** \u6279\u5904\u7406\u5927\u5c0f\uff0c\u9ed8\u8ba4\u4e3a1\u3002\r\n - **device_id (Union[str, int], optional):** \u8bbe\u5907ID\uff0c\u7528\u4e8e\u6307\u5b9a\u6a21\u578b\u8fd0\u884c\u7684\u8bbe\u5907\uff0c\u9ed8\u8ba4\u4e3a\"-1\"\u8868\u793a\u4f7f\u7528CPU\u3002\u5982\u679c\u6307\u5b9a\u4e3aGPU\uff0c\u5219\u4e3aGPU\u7684ID\u3002\r\n - **quantize (bool, optional):** \u662f\u5426\u4f7f\u7528\u91cf\u5316\u6a21\u578b\uff0c\u9ed8\u8ba4\u4e3aFalse\u3002\r\n - **intra_op_num_threads (int, optional):** ONNX Runtime\u7684\u7ebf\u7a0b\u6570\uff0c\u9ed8\u8ba4\u4e3a4\u3002\r\n - **max_end_sil (int, optional):** \u6700\u5927\u9759\u9ed8\u7ed3\u675f\u65f6\u95f4\uff0c\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u6a21\u578b\u914d\u7f6e\u4e2d\u7684\u9ed8\u8ba4\u503c\u3002\r\n\r\n> **def `__call__`(self, audio_in: np.ndarray) -> List:**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **audio_in (np.ndarray):** \u8f93\u5165\u97f3\u9891\u6570\u636e\uff0c\u91c7\u6837\u7387\u4e3a16000\r\n\r\n**\u8fd4\u56de\uff1a**\r\n\r\n - List: \u8fd4\u56de\u7ed3\u6784\u4e3a[[\u5f00\u59cb, \u7ed3\u675f],[\u5f00\u59cb, \u7ed3\u675f]...]\uff0c\u5982\u679c\u662f-1\uff0c\u5219\u5305\u542b\u8be5\u4f4d\u7f6e\uff0c\u5982\u679c\u4e3a[]\uff0c\u6ca1\u6709\u68c0\u6d4b\u5230\u6d3b\u52a8\u4e8b\u4ef6\uff0c\u5355\u4f4d\u6beb\u79d2\r\n\r\n\r\n**\u793a\u4f8b\u4ee3\u7801\uff1a**\r\n\r\n```python\r\nfrom yeaudio.audio import AudioSegment\r\nfrom yeaudio.vad_model import VadOnlineModel\r\n\r\nvad_model = VadOnlineModel()\r\n\r\naudio_segment = AudioSegment.from_file('data/test_long.wav')\r\naudio_segment.resample(target_sample_rate=vad_model.sample_rate)\r\nsamples = audio_segment.samples\r\n\r\nspeech_length = len(samples)\r\nstep = 16000\r\nparam_dict = {\"in_cache\": []}\r\nfor sample_offset in range(0, speech_length, step):\r\n    is_final = True if sample_offset + step >= speech_length - 1 else False\r\n    data = samples[sample_offset:sample_offset + step]\r\n    param_dict[\"is_final\"] = is_final\r\n    segments_result = vad_model(audio_in=data, param_dict=param_dict)\r\n    if len(segments_result) > 0:\r\n        print(\"segments_result\", segments_result)\r\n\r\n```\r\n\r\n## SpeedPerturbAugmentor\r\n\r\n\u968f\u673a\u8bed\u901f\u6270\u52a8\u7684\u97f3\u9891\u6570\u636e\u589e\u5f3a\u5668\r\n\r\n\r\n> **def `__init__`(self, prob=1.0, speed_perturb_3_class=False, num_speakers=None):**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **prob\uff08float\uff09\uff1a** \u6570\u636e\u589e\u5f3a\u6982\u7387\r\n - **speed_perturb_3_class\uff08bool\uff09\uff1a** \u662f\u5426\u4f7f\u7528\u8bed\u901f\u4e09\u7c7b\u8bed\u901f\u589e\u5f3a\uff0c\u53ea\u5728\u58f0\u7eb9\u8bc6\u522b\u9879\u76ee\u4e0a\u4f7f\u7528\r\n - **num_speakers\uff08int\uff09\uff1a** \u8bf4\u8bdd\u4eba\u6570\u91cf\uff0c\u53ea\u5728\u58f0\u7eb9\u8bc6\u522b\u9879\u76ee\u4e0a\u4f7f\u7528\r\n\r\n> **def `__call__`(self, audio_segment: AudioSegment, spk_id: int = None) -> AudioSegment or \\[AudioSegment, int]:**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **audio_segment\uff1a** AudioSegment\u5b9e\u4f8b\r\n\r\n\r\n## VolumePerturbAugmentor\r\n\r\n\u968f\u673a\u97f3\u91cf\u6270\u52a8\u7684\u97f3\u9891\u6570\u636e\u589e\u5f3a\u5668\r\n\r\n\r\n> **def `__init__`(self, prob=0.0, min_gain_dBFS=-15, max_gain_dBFS=15):**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **prob\uff08float\uff09\uff1a** \u6570\u636e\u589e\u5f3a\u6982\u7387\r\n - **min_gain_dBFS\uff08int\uff09\uff1a** \u6700\u5c0f\u97f3\u91cf\uff0c\u5355\u4f4d\u4e3a\u5206\u8d1d\u3002\r\n - **max_gain_dBFS\uff08int\uff09\uff1a** \u6700\u5927\u97f3\u91cf\uff0c\u5355\u4f4d\u4e3a\u5206\u8d1d\u3002\r\n\r\n> **def `__call__`(self, audio_segment: AudioSegment) -> AudioSegment:**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **audio_segment\uff1a** AudioSegment\u5b9e\u4f8b\r\n\r\n\r\n## ShiftPerturbAugmentor\r\n\r\n\u6dfb\u52a0\u968f\u673a\u4f4d\u79fb\u6270\u52a8\u7684\u97f3\u9891\u6570\u589e\u5f3a\u5668\r\n\r\n\r\n> **def `__init__`(self, prob=0.0, min_shift_ms=-15, max_shift_ms=15):**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **prob\uff08float\uff09\uff1a** \u6570\u636e\u589e\u5f3a\u6982\u7387\r\n - **min_shift_ms\uff08int\uff09\uff1a** \u6700\u5c0f\u504f\u79fb\uff0c\u5355\u4f4d\u4e3a\u6beb\u79d2\u3002\r\n - **max_shift_ms\uff08int\uff09\uff1a** \u6700\u5927\u504f\u79fb\uff0c\u5355\u4f4d\u4e3a\u6beb\u79d2\u3002\r\n\r\n> **def `__call__`(self, audio_segment: AudioSegment) -> AudioSegment:**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **audio_segment\uff1a** AudioSegment\u5b9e\u4f8b\r\n\r\n\r\n## ResampleAugmentor\r\n\r\n\u968f\u673a\u91cd\u91c7\u6837\u7684\u97f3\u9891\u6570\u636e\u589e\u5f3a\u5668\r\n\r\n\r\n> **def `__init__`(self, prob=0.0, new_sample_rate=(8000, 16000, 24000)):**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **prob\uff08float\uff09\uff1a** \u6570\u636e\u589e\u5f3a\u6982\u7387\r\n - **new_sample_rate\uff08list\uff09\uff1a** \u65b0\u91c7\u6837\u7387\u5217\u8868\r\n\r\n> **def `__call__`(self, audio_segment: AudioSegment) -> AudioSegment:**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **audio_segment\uff1a** AudioSegment\u5b9e\u4f8b\r\n\r\n\r\n## NoisePerturbAugmentor\r\n\r\n\u968f\u673a\u566a\u58f0\u6270\u52a8\u7684\u97f3\u9891\u6570\u636e\u589e\u5f3a\u5668\r\n\r\n\r\n> **def `__init__`(self, noise_dir='', prob=0.0, min_snr_dB=10, max_snr_dB=50):**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **noise_dir\uff08str\uff09\uff1a** \u566a\u58f0\u6587\u4ef6\u5939\u8def\u5f84\uff0c\u8be5\u6587\u4ef6\u5939\u4e0b\u662f\u566a\u58f0\u97f3\u9891\u6587\u4ef6\r\n - **prob\uff08float\uff09\uff1a** \u6570\u636e\u589e\u5f3a\u6982\u7387\r\n - **min_snr_dB\uff08int\uff09\uff1a** \u6700\u5c0f\u4fe1\u566a\u6bd4\r\n - **max_snr_dB\uff08int\uff09\uff1a** \u6700\u5927\u4fe1\u566a\u6bd4\r\n\r\n> **def `__call__`(self, audio_segment: AudioSegment) -> AudioSegment:**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **audio_segment\uff1a** AudioSegment\u5b9e\u4f8b\r\n\r\n\r\n## ReverbPerturbAugmentor\r\n\r\n\u968f\u673a\u6df7\u54cd\u7684\u97f3\u9891\u6570\u636e\u589e\u5f3a\u5668\r\n\r\n> **def `__init__`(self, reverb_dir='', prob=0.0):**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **reverb_dir\uff08str\uff09\uff1a** \u6df7\u54cd\u6587\u4ef6\u5939\u8def\u5f84\uff0c\u8be5\u6587\u4ef6\u5939\u4e0b\u662f\u566a\u58f0\u97f3\u9891\u6587\u4ef6\r\n - **prob\uff08float\uff09\uff1a** \u6570\u636e\u589e\u5f3a\u6982\u7387\r\n\r\n> **def `__call__`(self, audio_segment: AudioSegment) -> AudioSegment:**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **audio_segment\uff1a** AudioSegment\u5b9e\u4f8b\r\n\r\n\r\n## SpecAugmentor\r\n\r\n\u9891\u57df\u63a9\u853d\u548c\u65f6\u57df\u63a9\u853d\u7684\u97f3\u9891\u7279\u5f81\u6570\u636e\u589e\u5f3a\u5668<br/>\r\n\u8bba\u6587\uff1ahttps://arxiv.org/abs/1904.08779<br/>\r\n\u8bba\u6587\uff1ahttps://arxiv.org/abs/1912.05533\r\n\r\n> **def `__init__`(self, prob=0.0,\r\n                   freq_mask_ratio=0.15,\r\n                   n_freq_masks=2,\r\n                   time_mask_ratio=0.05,\r\n                   n_time_masks=2,\r\n                   inplace=True,\r\n                   max_time_warp=5,\r\n                   replace_with_zero=False):**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **prob\uff08float\uff09\uff1a** \u6570\u636e\u589e\u5f3a\u6982\u7387\r\n - **freq_mask_ratio\uff08float\uff09\uff1a** \u9891\u57df\u63a9\u853d\u7684\u6bd4\u4f8b\r\n - **n_freq_masks\uff08int\uff09\uff1a** \u9891\u57df\u63a9\u853d\u6b21\u6570\r\n - **time_mask_ratio\uff08float\uff09\uff1a** \u65f6\u95f4\u63a9\u853d\u7684\u6bd4\u4f8b\r\n - **n_time_masks\uff08int\uff09\uff1a** \u65f6\u95f4\u63a9\u853d\u6b21\u6570\r\n - **inplace\uff08bool\uff09\uff1a** \u7528\u7ed3\u679c\u8986\u76d6\r\n - **max_time_warp\uff08bool\uff09\uff1a** \u6700\u5927\u65f6\u95f4\u626d\u66f2\r\n - **replace_with_zero\uff08bool\uff09\uff1a** \u662f\u5426\u4f7f\u75280\u4f5c\u4e3a\u63a9\u7801\uff0c\u5426\u5219\u4f7f\u7528\u5e73\u5747\u503c\r\n\r\n> **def `__call__`(self, x) -> np.ndarray:**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **x\uff1a** \u97f3\u9891\u7279\u5f81\uff0c\u7ef4\u5ea6(time, freq)\r\n\r\n\r\n## SpecSubAugmentor\r\n\r\n\u4ece\u539f\u59cb\u97f3\u9891\u4e2d\u968f\u673a\u66ff\u6362\u90e8\u5206\u5e27\uff0c\u4ee5\u6a21\u62df\u8bed\u97f3\u7684\u65f6\u79fb\u3002<br/>\r\n\u8bba\u6587\uff1ahttps://arxiv.org/abs/2106.05642\r\n\r\n> **def `__init__`(self, prob=0.0, max_time=20, num_time_sub=3):**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **prob\uff08float\uff09\uff1a** \u6570\u636e\u589e\u5f3a\u6982\u7387\r\n - **max_time\uff08int\uff09\uff1a** \u65f6\u95f4\u66ff\u6362\u7684\u6700\u5927\u5bbd\u5ea6\r\n - **num_time_sub\uff08int\uff09\uff1a** \u65f6\u95f4\u66ff\u6362\u7684\u7684\u6b21\u6570\r\n\r\n> **def `__call__`(self, x) -> np.ndarray:**\r\n\r\n**\u53c2\u6570\uff1a**\r\n\r\n - **x\uff1a** \u97f3\u9891\u7279\u5f81\uff0c\u7ef4\u5ea6(time, freq)\r\n\r\n<br/>\r\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Audio ToolKit for Python",
    "version": "0.0.7",
    "project_urls": {
        "Download": "https://github.com/yeyupiaoling/YeAudio.git",
        "Homepage": "https://github.com/yeyupiaoling/YeAudio"
    },
    "split_keywords": [
        "audio",
        " speech"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "18b1fffff9cd139d548dded4e55b50f33d534333e53e80d7ca380ba45f753116",
                "md5": "014fb823d6c5e08d985c1c8a5c961173",
                "sha256": "cd314c6ac4e92b1cc4f19a6f5256ed5370d8b1125210ecc685713c98ddf82e35"
            },
            "downloads": -1,
            "filename": "yeaudio-0.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "014fb823d6c5e08d985c1c8a5c961173",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 2093948,
            "upload_time": "2024-11-14T02:46:12",
            "upload_time_iso_8601": "2024-11-14T02:46:12.713377Z",
            "url": "https://files.pythonhosted.org/packages/18/b1/fffff9cd139d548dded4e55b50f33d534333e53e80d7ca380ba45f753116/yeaudio-0.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-14 02:46:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "yeyupiaoling",
    "github_project": "YeAudio",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "yeaudio"
}
        
Elapsed time: 1.85840s