Skip to main content

A collection of python scripts for extracting and analyzing acoustics from audio files.

Project description

pyAcoustics

A collection of python scripts for extracting and analyzing acoustics from audio files.

Table of contents

  1. Common use cases
  2. Version history
  3. Requirements
  4. Installation
  5. Example usage
  6. Citing pyAcoustics
  7. Acknowledgements

Common Use Cases

What can you do with this library?

  • Extract pitch and intensity::

    pyacoustics.intensity_and_pitch.praat_pi.getPraatPitchAndIntensity()

  • Extract segments of a wav file::

    pyacoustics.signals.audio_scripts.getSubwav()

  • Perform simple manipulations on wav files::

    pyacoustics.signals.resampleAudio()

    pyacoustics.signals.splitStereoAudio()

  • Split audio files on segments of silence or on pure tones::

    pyacoustics.speech_detection.split_on_tone.splitFileOnTone()

  • Programmatically manipulate pitch or duration of a file::

    pyacoustics.morph.morph_utils.praat_pitch()

  • Mask speech with speech shaped noise::

    pyacoustics.speech_filters.speech_shaped_noise.batchMaskSpeakerData()

  • And more!

Version history

Praatio uses semantic versioning (Major.Minor.Patch)

Please view CHANGELOG.md for version history.

Requirements

Many of the individual features require different packages. If you aren't using those packages then you don't need to install the dependencies.

pyacoustics.intensity_and_pitch.praat_pi requires praat

pyacoustics.intensity_and_pitch.get_f0 requires the ESPS getF0 function as implemented by Snack although I recall having difficulty installing it.

pyacoustics.speech_rate/dictionary_estimate.py requires my library psyle

pyacoustics.signals.data_fitting.py requires SciPy, NumPy, and scikit-learn

My praatIO library is used extensively and can be downloaded here

Installation

PyAcoustics is on pypi and can be installed or upgraded from the command-line shell with pip like so::

python -m pip install pyacoustics --upgrade

Otherwise, to manually install, after downloading the source from github, from a command-line shell, navigate to the directory containing setup.py and type::

python setup.py install

If python is not in your path, you'll need to enter the full path e.g.::

C:\Python36\python.exe setup.py install

Example usage

See the example folders for a few real-world examples using this library.

  • examples/split_audio_on_silence.py

    Detects the presence of speech in a recording based on acoustic intensity. Everything louder than some threshold specified by the user is considered speech.

  • examples/split_audio_on_tone.py

    Detects the presence of pure tones in a recording. One can use this to automatically segment stimuli. Beeps can be played while the speech is being recorded and then later this tool can automatically segment the speech, based on the presence of those tones.

    Also detects speech using a pitch analysis. Most syllables contain some voicing, so a stream of modulating pitch values suggests that someone is speaking. This aspect is not extensively tested but it works well for the example files.

  • examples/estimate_speech_rate.py

    Calculates the speech rate through a matlab script written by Uwe Reichel that estimates the location of syllable boundaries.

Citing PyAcoustics

PyAcoustics is general purpose coding and doesn't need to be cited but if you would like to, it can be cited like so:

Tim Mahrt. PyAcoustics. https://github.com/timmahrt/pyAcoustics, 2016.

Acknowledgements

PyAcoustics is an ongoing collection of code with contributions from a number of projects worked on over several years. Development of various aspects of PyAcoustics was possible thanks to NSF grant IIS 07-03624 to Jennifer Cole and Mark Hasegawa-Johnson, NSF grant BCS 12-51343 to Jennifer Cole, José Hualde, and Caroline Smith, and NSF grant IBSS SMA 14-16791 to Jennifer Cole, Nancy McElwain, and Daniel Berry.

Project details


Download files

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

Source Distribution

pyacoustics-2.0.0.tar.gz (29.0 kB view details)

Uploaded Source

Built Distribution

pyacoustics-2.0.0-py3-none-any.whl (37.4 kB view details)

Uploaded Python 3

File details

Details for the file pyacoustics-2.0.0.tar.gz.

File metadata

  • Download URL: pyacoustics-2.0.0.tar.gz
  • Upload date:
  • Size: 29.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for pyacoustics-2.0.0.tar.gz
Algorithm Hash digest
SHA256 10803dd348b901b44213050cd98714c3a6429f6f00c092ad8ae7593d9008a26b
MD5 e2d7c7ce0a9291dcbd48a47593aa59f9
BLAKE2b-256 8ac37587965d2149467a83b69e9d2ecf2ad729950034cf74e7850aec19ce7fae

See more details on using hashes here.

File details

Details for the file pyacoustics-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyacoustics-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 37.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for pyacoustics-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39459bd64fe08f33403d14ef2c1efcc41d87427d2ff84482f69e180938e4a338
MD5 38ec194a8bdf3bac19d000842b231a86
BLAKE2b-256 73812002f7c6d084c8ec33802a97e1e10f848375ce67d41d96ff7d741da01933

See more details on using hashes here.

Supported by

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