Audio manager in Python Object-Oriented Programming
Project description
AudiooPy - Audio manager in Python Object-Oriented Programming
Overview
AudiooPy contains some useful operations on sound fragments. It operates on sound frames, meaning they consist of signed integer samples 8, 16, or 32 bits wide, stored in bytes-like objects.
Among others, it allows the followings:
- Audio reader/writer for wav -- based on Python standard library
- Manipulate raw audio data
- Audio mixer
- Channels extractor
- Channels mixer
- Automated calculation of statistical descriptors for audio data
- High-fidelity automatic detection of sounding segments. See: https://hal.archives-ouvertes.fr/hal-03697808
AudiooPy is self-implemented, it does not require any other external library.
License
AudiooPy is under the terms of the GNU General Public License version 3.
Install AudiooPy
From pypi.org:
> python -m pip install AudiooPy
From its wheel package:
Download the wheel file (AudiooPy-xxx.whl) and install it in your python environment with:
> python -m pip install dist/<AudiooPy-xxx.whl>
From its repo:
Download the repository and unpack it, or clone with git
. Optionally, it can be installed with:
> python -m pip install .
Install all the optional dependencies with:
> python -m pip install ".[docs, tests]"
AudiooPy package includes the following folders and files:
- "audioopy": the source code package
- "docs": the documentation of audioopy library in HTML and Markdown
- "tests": the tests of the source code
- "scripts": a few python scripts using audioopy to manipulate audio files
Quick Start
A few scripts are already available in the scripts
folder. Try for example:
> python ./scripts/audioinfo.py -w samples/oriana1.wa
Or, you can do it yourself! Open an audio file and get some information with:
import audioopy.aio
audio = audioopy.aio.open("samples/oriana1.wav")
audio.get_sampwidth()
audio.get_framerate()
audio.get_duration()
audio.get_nchannels()
audio.get_nframes()
audio.rms()
audio.clipping_rate(0.4)
Advanced usage
Automatic detection of sounding segments:
import audioopy
import audioopy.aio
import audioopy.audioutils
audio = audioopy.aio.open("samples/oriana1.wav")
channel = audio.extract_channel(0)
chansil = audioopy.ChannelSilence(channel, winlenght=0.01)
chansil.search_silences(threshold=0, mintrackdur=0.04)
chansil.filter_silences(minsildur=0.250)
tracks = chansil.extract_tracks(mintrackdur=0.300, shiftdurstart=0.010, shiftdurend=0.010)
tracks.append((channel.get_nframes(), channel.get_nframes()))
tracks_times = audioopy.audioutils.frames2times(tracks, channel.get_framerate())
Projects using AudiooPy
AudiooPy was initially developed within SPPAS https://sppas.org; it was extracted from its original software by the author to lead its own life as standalone package.
The developer's corner
Create a wheel
AudiooPy is no system dependent. Information to build its wheel are stored into the file pyproject.toml
.
The universal wheel is created with: python -m build
Make the doc
The API documentation is available in the docs
folder. Click the file index.html
to browse throw the documented classes.
To re-generate the doc, install the required external program, then launch the doc generator:
>python -m pip install ".[docs]"
>python makedoc.py
How to contribute
If you plan to contribute to the code, please send an e-mail to the author.
Author/Copyright
Copyright (C) 2024 - Brigitte Bigi - contact@sppas.org Laboratoire Parole et Langage, Aix-en-Provence, France.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.