未验证 提交 d4b68daf 编写于 作者: Y YangZhou 提交者: GitHub

[audio] rm kaiser window in audio get_window function && rm audio utils (#47469)

* rm kaiser window in audio window function

* rm paddle audio utils which is redundant

* rm kaiser in test_audio_functions.py
上级 91096ae2
......@@ -231,16 +231,6 @@ def _tukey(
return _truncate(w, needs_trunc)
@window_function_register.register()
def _kaiser(
M: int, beta: float, sym: bool = True, dtype: str = 'float64'
) -> Tensor:
"""Compute a Kaiser window.
The Kaiser window is a taper formed by using a Bessel function.
"""
raise NotImplementedError()
@window_function_register.register()
def _gaussian(
M: int, std: float, sym: bool = True, dtype: str = 'float64'
......@@ -346,7 +336,7 @@ def get_window(
"""Return a window of a given length and type.
Args:
window (Union[str, Tuple[str, float]]): The window function applied to the signal before the Fourier transform. Supported window functions: 'hamming', 'hann', 'kaiser', 'gaussian', 'general_gaussian', 'exponential', 'triang', 'bohman', 'blackman', 'cosine', 'tukey', 'taylor'.
window (Union[str, Tuple[str, float]]): The window function applied to the signal before the Fourier transform. Supported window functions: 'hamming', 'hann', 'gaussian', 'general_gaussian', 'exponential', 'triang', 'bohman', 'blackman', 'cosine', 'tukey', 'taylor'.
win_length (int): Number of samples.
fftbins (bool, optional): If True, create a "periodic" window. Otherwise, create a "symmetric" window, for use in filter design. Defaults to True.
dtype (str, optional): The data type of the return window. Defaults to 'float64'.
......@@ -363,7 +353,7 @@ def get_window(
cosine_window = paddle.audio.functional.get_window('cosine', n_fft)
std = 7
gussian_window = paddle.audio.functional.get_window(('gaussian',std), n_fft)
gaussian_window = paddle.audio.functional.get_window(('gaussian',std), n_fft)
"""
sym = not fftbins
......
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
__all__ = ['ParameterError']
class ParameterError(Exception):
"""Exception class for Parameter checking"""
pass
......@@ -178,13 +178,6 @@ class TestAudioFuncitons(unittest.TestCase):
np.testing.assert_array_almost_equal(
window_scipy_exp, window_paddle_exp.numpy(), decimal=5
)
try:
window_paddle = paddle.audio.functional.get_window(
("kaiser", 1.0), self.n_fft
)
except NotImplementedError:
pass
try:
window_paddle = paddle.audio.functional.get_window("hann", -1)
except ValueError:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册