Merge pull request #2007 from KPatr1ck/audio
[Audio] Refactor paddleaudio to paddlespeech.audiopull/2032/head
commit
9286792538
@ -1,2 +0,0 @@
|
||||
.eggs
|
||||
*.wav
|
@ -1,9 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
Date: 2022-3-15, Author: Xiaojie Chen.
|
||||
- kaldi and librosa mfcc, fbank, spectrogram.
|
||||
- unit test and benchmark.
|
||||
|
||||
Date: 2022-2-25, Author: Hui Zhang.
|
||||
- Refactor architecture.
|
||||
- dtw distance and mcd style dtw.
|
@ -1,7 +0,0 @@
|
||||
# PaddleAudio
|
||||
|
||||
PaddleAudio is an audio library for PaddlePaddle.
|
||||
|
||||
## Install
|
||||
|
||||
`pip install .`
|
@ -1,19 +0,0 @@
|
||||
# Minimal makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
SOURCEDIR = source
|
||||
BUILDDIR = build
|
||||
|
||||
# Put it first so that "make" without argument is like "make help".
|
||||
help:
|
||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
||||
.PHONY: help Makefile
|
||||
|
||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
%: Makefile
|
||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
@ -1,24 +0,0 @@
|
||||
# Build docs for PaddleAudio
|
||||
|
||||
Execute the following steps in **current directory**.
|
||||
|
||||
## 1. Install
|
||||
|
||||
`pip install Sphinx sphinx_rtd_theme`
|
||||
|
||||
|
||||
## 2. Generate API docs
|
||||
|
||||
Generate API docs from doc string.
|
||||
|
||||
`sphinx-apidoc -fMeT -o source ../paddleaudio ../paddleaudio/utils --templatedir source/_templates`
|
||||
|
||||
|
||||
## 3. Build
|
||||
|
||||
`sphinx-build source _html`
|
||||
|
||||
|
||||
## 4. Preview
|
||||
|
||||
Open `_html/index.html` for page preview.
|
Before Width: | Height: | Size: 4.9 KiB |
@ -1,35 +0,0 @@
|
||||
@ECHO OFF
|
||||
|
||||
pushd %~dp0
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set SOURCEDIR=source
|
||||
set BUILDDIR=build
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
%SPHINXBUILD% >NUL 2>NUL
|
||||
if errorlevel 9009 (
|
||||
echo.
|
||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||
echo.may add the Sphinx directory to PATH.
|
||||
echo.
|
||||
echo.If you don't have Sphinx installed, grab it from
|
||||
echo.http://sphinx-doc.org/
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
|
||||
goto end
|
||||
|
||||
:help
|
||||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
|
||||
|
||||
:end
|
||||
popd
|
@ -1,60 +0,0 @@
|
||||
# Copyright (c) 2021 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.
|
||||
'''
|
||||
This module is used to store environmental variables in PaddleAudio.
|
||||
PPAUDIO_HOME --> the root directory for storing PaddleAudio related data. Default to ~/.paddleaudio. Users can change the
|
||||
├ default value through the PPAUDIO_HOME environment variable.
|
||||
├─ MODEL_HOME --> Store model files.
|
||||
└─ DATA_HOME --> Store automatically downloaded datasets.
|
||||
'''
|
||||
import os
|
||||
|
||||
__all__ = [
|
||||
'USER_HOME',
|
||||
'PPAUDIO_HOME',
|
||||
'MODEL_HOME',
|
||||
'DATA_HOME',
|
||||
]
|
||||
|
||||
|
||||
def _get_user_home():
|
||||
return os.path.expanduser('~')
|
||||
|
||||
|
||||
def _get_ppaudio_home():
|
||||
if 'PPAUDIO_HOME' in os.environ:
|
||||
home_path = os.environ['PPAUDIO_HOME']
|
||||
if os.path.exists(home_path):
|
||||
if os.path.isdir(home_path):
|
||||
return home_path
|
||||
else:
|
||||
raise RuntimeError(
|
||||
'The environment variable PPAUDIO_HOME {} is not a directory.'.
|
||||
format(home_path))
|
||||
else:
|
||||
return home_path
|
||||
return os.path.join(_get_user_home(), '.paddleaudio')
|
||||
|
||||
|
||||
def _get_sub_home(directory):
|
||||
home = os.path.join(_get_ppaudio_home(), directory)
|
||||
if not os.path.exists(home):
|
||||
os.makedirs(home)
|
||||
return home
|
||||
|
||||
|
||||
USER_HOME = _get_user_home()
|
||||
PPAUDIO_HOME = _get_ppaudio_home()
|
||||
MODEL_HOME = _get_sub_home('models')
|
||||
DATA_HOME = _get_sub_home('datasets')
|
@ -1,99 +0,0 @@
|
||||
# Copyright (c) 2021 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.
|
||||
import glob
|
||||
import os
|
||||
|
||||
import setuptools
|
||||
from setuptools.command.install import install
|
||||
from setuptools.command.test import test
|
||||
|
||||
# set the version here
|
||||
VERSION = '0.0.0'
|
||||
|
||||
|
||||
# Inspired by the example at https://pytest.org/latest/goodpractises.html
|
||||
class TestCommand(test):
|
||||
def finalize_options(self):
|
||||
test.finalize_options(self)
|
||||
self.test_args = []
|
||||
self.test_suite = True
|
||||
|
||||
def run(self):
|
||||
self.run_benchmark()
|
||||
super(TestCommand, self).run()
|
||||
|
||||
def run_tests(self):
|
||||
# Run nose ensuring that argv simulates running nosetests directly
|
||||
import nose
|
||||
nose.run_exit(argv=['nosetests', '-w', 'tests'])
|
||||
|
||||
def run_benchmark(self):
|
||||
for benchmark_item in glob.glob('tests/benchmark/*py'):
|
||||
os.system(f'pytest {benchmark_item}')
|
||||
|
||||
|
||||
class InstallCommand(install):
|
||||
def run(self):
|
||||
install.run(self)
|
||||
|
||||
|
||||
def write_version_py(filename='paddleaudio/__init__.py'):
|
||||
with open(filename, "a") as f:
|
||||
f.write(f"__version__ = '{VERSION}'")
|
||||
|
||||
|
||||
def remove_version_py(filename='paddleaudio/__init__.py'):
|
||||
with open(filename, "r") as f:
|
||||
lines = f.readlines()
|
||||
with open(filename, "w") as f:
|
||||
for line in lines:
|
||||
if "__version__" not in line:
|
||||
f.write(line)
|
||||
|
||||
|
||||
remove_version_py()
|
||||
write_version_py()
|
||||
|
||||
setuptools.setup(
|
||||
name="paddleaudio",
|
||||
version=VERSION,
|
||||
author="",
|
||||
author_email="",
|
||||
description="PaddleAudio, in development",
|
||||
long_description="",
|
||||
long_description_content_type="text/markdown",
|
||||
url="",
|
||||
packages=setuptools.find_packages(include=['paddleaudio*']),
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: OS Independent",
|
||||
],
|
||||
python_requires='>=3.6',
|
||||
install_requires=[
|
||||
'numpy >= 1.15.0', 'scipy >= 1.0.0', 'resampy >= 0.2.2',
|
||||
'soundfile >= 0.9.0', 'colorlog', 'pathos == 0.2.8'
|
||||
],
|
||||
extras_require={
|
||||
'test': [
|
||||
'nose', 'librosa==0.8.1', 'soundfile==0.10.3.post1',
|
||||
'torchaudio==0.10.2', 'pytest-benchmark'
|
||||
],
|
||||
},
|
||||
cmdclass={
|
||||
'install': InstallCommand,
|
||||
'test': TestCommand,
|
||||
}, )
|
||||
|
||||
remove_version_py()
|
Loading…
Reference in new issue