Skip to content

Commit

Permalink
change get_current_audio_backend to get_current_backend
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileGoat committed Oct 20, 2022
1 parent 8cbcff0 commit 7ee4a58
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions python/paddle/audio/backends/__init__.py
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from . import init_backend
from .init_backend import get_current_audio_backend # noqa: F401
from .init_backend import get_current_backend # noqa: F401
from .init_backend import list_available_backends # noqa: F401
from .init_backend import set_backend

Expand All @@ -23,7 +23,7 @@
from .backend import save # noqa: F401

__all__ = [
'get_current_audio_backend',
'get_current_backend',
'list_available_backends',
'set_backend',
'info',
Expand Down
8 changes: 4 additions & 4 deletions python/paddle/audio/backends/init_backend.py
Expand Up @@ -53,7 +53,7 @@ def list_available_backends() -> List[str]:
waveform = wav_data.tile([num_channels, 1])
wav_path = "./test.wav"
current_backend = paddle.audio.backends.get_current_audio_backend()
current_backend = paddle.audio.backends.get_current_backend()
print(current_backend) # wave_backend, the default backend.
backends = paddle.audio.backends.list_available_backends()
# default backends is ['wave_backend']
Expand Down Expand Up @@ -89,7 +89,7 @@ def list_available_backends() -> List[str]:
return backends


def get_current_audio_backend() -> str:
def get_current_backend() -> str:
""" Get the name of the current audio backend
Returns:
Expand All @@ -109,7 +109,7 @@ def get_current_audio_backend() -> str:
waveform = wav_data.tile([num_channels, 1])
wav_path = "./test.wav"
current_backend = paddle.audio.backends.get_current_audio_backend()
current_backend = paddle.audio.backends.get_current_backend()
print(current_backend) # wave_backend, the default backend.
backends = paddle.audio.backends.list_available_backends()
# default backends is ['wave_backend']
Expand Down Expand Up @@ -149,7 +149,7 @@ def set_backend(backend_name: str):
waveform = wav_data.tile([num_channels, 1])
wav_path = "./test.wav"
current_backend = paddle.audio.backends.get_current_audio_backend()
current_backend = paddle.audio.backends.get_current_backend()
print(current_backend) # wave_backend, the default backend.
backends = paddle.audio.backends.list_available_backends()
# default backends is ['wave_backend']
Expand Down
6 changes: 3 additions & 3 deletions python/paddle/tests/test_audio_backend.py
Expand Up @@ -84,7 +84,7 @@ def test_backend(self):
waveform = waveform.T
np.testing.assert_array_almost_equal(wav_data, waveform)

current_backend = paddle.audio.backends.get_current_audio_backend()
current_backend = paddle.audio.backends.get_current_backend()
self.assertTrue(current_backend in ["wave_backend", "soundfile"])

paddle.audio.backends.set_backend("wave_backend")
Expand All @@ -104,11 +104,11 @@ def test_backend(self):
backends = paddle.audio.backends.list_available_backends()
for backend in backends:
self.assertTrue(backend in ["wave_backend", "soundfile"])
current_backend = paddle.audio.backends.get_current_audio_backend()
current_backend = paddle.audio.backends.get_current_backend()
self.assertTrue(current_backend, "wave_backend")
paddleaudio.backends.set_audio_backend("soundfile")
paddle.audio.backends.set_backend("soundfile")
current_backend = paddle.audio.backends.get_current_audio_backend()
current_backend = paddle.audio.backends.get_current_backend()
self.assertTrue(current_backend, "soundfile")
wav_info = paddle.audio.backends.info(wave_wav_path)
self.assertTrue(wav_info.sample_rate, self.sr)
Expand Down

0 comments on commit 7ee4a58

Please sign in to comment.