Package: praudio
READMEpraudioprovides objects and a script for performing complex
preprocessing operations on entire audio datasets with one command.praudiois implemented having Deep Learning audio/music applications in mind.Operations are carried out on CPU. Preprocessing can also be run on-the-fly,
for example, while training a model.The library useslibrosaas an audio processing backend.How do I install the library?You can installpraudioboth withpipvia PyPi, and by cloning thepraudiorepo from GitHub.For both approaches, it's advisable to use a dedicated Python virtual
environment.Installing from PyPiInstalling from PyPi is the easiest option. In the terminal type:$pipinstallpraudioInstalling from GitHubFirst, you should clone the repository from GitHub:$gitclonegit@github.com:musikalkemist/praudio.gitThen, move to the project root and, to install the package, type in the terminal:$pipinstall.You can also use a rule in the available Makefile (see below):$makeinstallTo install the package in development mode use:$pipinstall-e.[testing]You can also use a rule in Makefile:$makeinstall_devThis will install all the packages necessary to run the tests, lint,
type checker. It will also install the package in 'editable' mode, which is
ideal for development.Python versionpraudioworks in Python 3.6, 3.7, 3.8.How do I preprocess an audio dataset?The core of the library is thepreprocessentry point. This script works
with a config file. You set the type of preprocessing you want to apply in a
yaml file, and then run the script. Your dataset will be entirely
preprocessed and the results recursively stored in a directory of your
choice that can potentially be created from scratch.To run the entry point, ensure the library is installed and then type:$preprocess/path/to/config.ymlIn the config.yml, you should provide the following parameters:dataset_dir: Path to the directory where your audio dataset is storedsave_dir: Path where to save the preprocessed audio.Underfile_preprocessor, you should provide settings forloaderandtransforms_chain.loader: Provide settings for the loader.transforms_chain: Parameters for each transform in the sequence.
of transforms which are applied to your data (i.e., TransformChain).These config parameters are used to dinamically initialise the relative
objects in the library. To learn what parameters are available at each
level in the config file, please refer to the docstrings in the relative
objects.Check outtest/config.sampleconfig.ymlto see an example of a valid config
file.Package structureThe package is divided into a number of subpackages:configcreationiopreprocessorstransformsconfighas facilities to load, save, and validate configuration files,
which are used to specify the types of preprocessing pipelines to use.creationhas classes that are responsible to instantiate key objects in
the library.iocontains facilities to load / save audio signals from / to files.preprocessorsfeatures objects which are responsible to preprocess single
audio files, from loading to storing, as well as, batch of files.transformscontains a series of objects which manipulate audio signals,
such as short-time Fourier transform, log, scaling.What's the Makefile for?The Makefile has a series of rules that can be used to ensure quality of
the code, and automate repetitive tasks.LinterThe project usespylint. The linter helps enforcing a coding
standard, sniffs for code smells and offers simple refactoring suggestions.To run the linter type:$makelintTypehintThe project usesmypy.mypyis an optional static type checker for
Python. You can add type hints (PEP 484) to your Python programs,
and use mypy to type check them statically.To run the type checker type:$maketypehintTestingThe project usespytestfor unittests. Tests can be run in one go usingcoverage. This package suggests the percentage of code that is covered in
unittests.To run all the unittests type:$maketestChecklistChecklist is a utility rule that runs the linter, type checker, and the
test suite in one go:$makechecklistCleanUse the clean rule to get rid ofpycfiles and__pychache__:$makecleanDependenciespraudiohas the following dependencies:librosa==0.8.1pyyaml==5.4.1types-PyYAML==5.4.6librosais extensively used to extract audio features in transform objects.Current limitationsThepraudiopreprocessors are capable of operating only on mono signals.
This is a significant limitation if you are working in generative music.
If you are using the library for audio / music analysis, this shouldn't
be a problem.Future improvementsAdd audio augmentation / padding / cropping transforms.Enable preprocessing of signals with multiple channels.Turn transform parameters into full-fledged objects (e.g., STFTParams)Instead of using a dictionary for configurations, instantiate parameter
objects with validationImplement different types of Savers / Loaders with factories to produce
them.