@@ -79,6 +79,13 @@ def apply_effects_tensor(
7979 the same channels order. The shape of the Tensor can be different based on the
8080 effects applied. Sample rate can also be different based on the effects applied.
8181
82+ Notes:
83+ This function works in the way very similar to ``sox`` command, however there are slight
84+ differences. For example, ``sox`` commnad adds certain effects automatically (such as
85+ ``rate`` effect after ``speed`` and ``pitch`` and other effects), but this function does
86+ only applies the given effects. (Therefore, to actually apply ``speed`` effect, you also
87+ need to give ``rate`` effect with desired sampling rate.)
88+
8289 Examples:
8390 >>> # Defines the effects to apply
8491 >>> effects = [
@@ -98,7 +105,7 @@ def apply_effects_tensor(
98105 >>> # Apply effects
99106 >>> waveform, sample_rate = apply_effects_tensor(
100107 ... wave_form, sample_rate, effects, channels_first=True)
101- >>> # The new waveform his sampling rate 8000, 1 second.
108+ >>> # The new waveform is sampling rate 8000, 1 second.
102109 >>> # normalization and channel order are preserved
103110 >>> waveform.shape
104111 torch.Size([2, 8000])
@@ -107,13 +114,6 @@ def apply_effects_tensor(
107114 [ 0.1331, 0.0436, -0.3783, ..., -0.0035, 0.0012, 0.0008]])
108115 >>> sample_rate
109116 8000
110-
111- Notes:
112- This function works in the way very similar to ``sox`` command, however there are slight
113- differences. For example, ``sox`` commnad adds certain effects automatically (such as
114- ``rate`` effect after ``speed`` and ``pitch`` and other effects), but this function does
115- only applies the given effects. (Therefore, to actually apply ``speed`` effect, you also
116- need to give ``rate`` effect with desired sampling rate.)
117117 """
118118 in_signal = torch .classes .torchaudio .TensorSignal (tensor , sample_rate , channels_first )
119119 out_signal = torch .ops .torchaudio .sox_effects_apply_effects_tensor (in_signal , effects )
@@ -127,7 +127,7 @@ def apply_effects_file(
127127 normalize : bool = True ,
128128 channels_first : bool = True ,
129129) -> Tuple [torch .Tensor , int ]:
130- """Apply sox effects to the audio file and load Tensor
130+ """Apply sox effects to the audio file and load the resulting data as Tensor
131131
132132 Args:
133133 path (str): Path to the audio file.
@@ -147,6 +147,14 @@ def apply_effects_file(
147147 If ``channels_first=True``, the resulting Tensor has dimension ``[channel, time]``,
148148 otherwise ``[time, channel]``.
149149
150+ Notes:
151+ This function works in the way very similar to ``sox`` command, however there are slight
152+ differences. For example, ``sox`` commnad adds certain effects automatically (such as
153+ ``rate`` effect after ``speed``, ``pitch`` etc), but this function only applies the given
154+ effects. Therefore, to actually apply ``speed`` effect, you also need to give ``rate``
155+ effect with desired sampling rate, because internally, ``speed`` effects only alter sampling
156+ rate and leave samples untouched.
157+
150158 Examples:
151159 >>> # Defines the effects to apply
152160 >>> effects = [
@@ -165,14 +173,6 @@ def apply_effects_file(
165173 -5.6159e-07, 4.8103e-07]])
166174 >>> sample_rate
167175 8000
168-
169- Notes:
170- This function works in the way very similar to ``sox`` command, however there are slight
171- differences. For example, ``sox`` commnad adds certain effects automatically (such as
172- ``rate`` effect after ``speed``, ``pitch`` etc), but this function only applies the given
173- effects. Therefore, to actually apply ``speed`` effect, you also need to give ``rate``
174- effect with desired sampling rate, because internally, ``speed`` effects only alter sampling
175- rate and leave samples untouched.
176176 """
177177 signal = torch .ops .torchaudio .sox_effects_apply_effects_file (path , effects , normalize , channels_first )
178178 return signal .get_tensor (), signal .get_sample_rate ()
0 commit comments