Skip to main content

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 files and 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 - also called IPUs. See: https://hal.archives-ouvertes.fr/hal-03697808

AudiooPy is self-implemented, it does not require any other external library.

License

AudiooPy is an open source library 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 <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:

  1. "audioopy": the source code package
  2. "docs": the documentation of audioopy library in HTML and Markdown
  3. "tests": the tests of the source code
  4. "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

Example of 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.040)
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())

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 programs, then launch the doc generator:

>python -m pip install ".[docs]"
>python makedoc.py

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

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.

Changes

  • Version 0.1:

    • Initial version, extracted from SPPAS 4.17.
    • A few self-implemented functions into AudioFrames() instead of using 'audioop' standard library.
  • Version 0.2:

    • Self-implemented functions into AudioFrames(), except for resample() which is only partially self-implemented.
    • Added function clip() in AudioFrames().
    • Added 2090: NumberFramesError.
    • Updated scripts

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

AudiooPy-0.2-py3-none-any.whl (70.8 kB view details)

Uploaded Python 3

File details

Details for the file AudiooPy-0.2-py3-none-any.whl.

File metadata

  • Download URL: AudiooPy-0.2-py3-none-any.whl
  • Upload date:
  • Size: 70.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for AudiooPy-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f6e701cd455a9d845e147cff08ddfaab359d6823a94457d44d79ff18d12c43a6
MD5 82a1a5d1161ba235d59770bea63c23f2
BLAKE2b-256 ef8264566c6d0eebaf78ce97d6196ea7ac533f28d82ca91cf429a8b761e72a23

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page