praat-parselmouth

Praat in Python, the Pythonic way

https://github.com/yannickjadoul/parselmouth

Science Score: 49.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
    Links to: sciencedirect.com
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.5%) to scientific vocabulary

Keywords from Contributors

energy-system-model versions parallel mesh spacy-extension molecular-dynamics-simulation led hydrology regionalization energy-system
Last synced: 6 months ago · JSON representation

Repository

Praat in Python, the Pythonic way

Basic Info
Statistics
  • Stars: 1,170
  • Watchers: 19
  • Forks: 125
  • Open Issues: 21
  • Releases: 15
Created almost 9 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog License Code of conduct Citation

README.md

Parselmouth

Parselmouth - Praat in Python, the Pythonic way

PyPI Gitter chat GitHub Actions status pre-commit.ci status ReadTheDocs status License Launch Binder

Parselmouth is a Python library for the Praat software.

Though other attempts have been made at porting functionality from Praat to Python, Parselmouth is unique in its aim to provide a complete and Pythonic interface to the internal Praat code. While other projects either wrap Praat's scripting language or reimplementing parts of Praat's functionality in Python, Parselmouth directly accesses Praat's C/C++ code (which means the algorithms and their output are exactly the same as in Praat) and provides efficient access to the program's data, but also provides an interface that looks no different from any other Python library.

Drop by our Gitter chat room or post a message to our Google discussion group if you have any question, remarks, or requests!

Try out Parselmouth online, in interactive Jupyter notebooks on Binder.

Installation

Parselmouth can be installed like any other Python library, using (a recent version of) the Python package manager pip, on Linux, macOS, and Windows: pip install praat-parselmouth or, to update your installed version to the latest release: pip install -U praat-parselmouth

For more detailed instructions, please refer to the documentation.

Example usage

```Python import parselmouth

import numpy as np import matplotlib.pyplot as plt import seaborn as sns

sns.set() # Use seaborn's default style to make attractive graphs

Plot nice figures using Python's "standard" matplotlib library

snd = parselmouth.Sound("docs/examples/audio/thenorthwindandthesun.wav") plt.figure() plt.plot(snd.xs(), snd.values.T) plt.xlim([snd.xmin, snd.xmax]) plt.xlabel("time [s]") plt.ylabel("amplitude") plt.show() # or plt.savefig("sound.png"), or plt.savefig("sound.pdf") ![docs/images/example_sound.png](docs/images/example_sound.png) Python def drawspectrogram(spectrogram, dynamicrange=70): X, Y = spectrogram.xgrid(), spectrogram.ygrid() sgdb = 10 * np.log10(spectrogram.values) plt.pcolormesh(X, Y, sgdb, vmin=sgdb.max() - dynamic_range, cmap='afmhot') plt.ylim([spectrogram.ymin, spectrogram.ymax]) plt.xlabel("time [s]") plt.ylabel("frequency [Hz]")

def draw_intensity(intensity): plt.plot(intensity.xs(), intensity.values.T, linewidth=3, color='w') plt.plot(intensity.xs(), intensity.values.T, linewidth=1) plt.grid(False) plt.ylim(0) plt.ylabel("intensity [dB]")

intensity = snd.tointensity() spectrogram = snd.tospectrogram() plt.figure() drawspectrogram(spectrogram) plt.twinx() drawintensity(intensity) plt.xlim([snd.xmin, snd.xmax]) plt.show() # or plt.savefig("spectrogram.pdf") ![docs/images/example_spectrogram.png](docs/images/example_spectrogram.png) Python def drawpitch(pitch): # Extract selected pitch contour, and # replace unvoiced samples by NaN to not plot pitchvalues = pitch.selectedarray['frequency'] pitchvalues[pitchvalues==0] = np.nan plt.plot(pitch.xs(), pitchvalues, 'o', markersize=5, color='w') plt.plot(pitch.xs(), pitch_values, 'o', markersize=2) plt.grid(False) plt.ylim(0, pitch.ceiling) plt.ylabel("fundamental frequency [Hz]")

pitch = snd.to_pitch()

If desired, pre-emphasize the sound fragment before calculating the spectrogram

preemphasizedsnd = snd.copy() preemphasizedsnd.preemphasize() spectrogram = preemphasizedsnd.tospectrogram(windowlength=0.03, maximumfrequency=8000) plt.figure() drawspectrogram(spectrogram) plt.twinx() drawpitch(pitch) plt.xlim([snd.xmin, snd.xmax]) plt.show() # or plt.savefig("spectrogram_0.03.pdf") ![docs/images/example_spectrogram_0.03.png](docs/images/example_spectrogram_0.03.png) Python

Find all .wav files in a directory, pre-emphasize and save as new .wav and .aiff file

import parselmouth

import glob import os.path

for wavefile in glob.glob("audio/*.wav"): print("Processing {}...".format(wavefile)) s = parselmouth.Sound(wavefile) s.preemphasize() s.save(os.path.splitext(wavefile)[0] + "pre.wav", 'WAV') # or parselmouth.SoundFileFormat.WAV instead of 'WAV' s.save(os.path.splitext(wavefile)[0] + "pre.aiff", 'AIFF') ```

More examples of different use cases of Parselmouth can be found in the documentation's examples section.

Documentation

Documentation is available at ReadTheDocs, including the API reference of Parselmouth.

Development

Currently, the actual project and Parselmouth's code is not very well documented. Or well, hardly documented at all. That is planned to still change in order to allow for easier contribution to this open source project. Until that day in some undefined future, if you want to contribute to Parselmouth, do let me know on Gitter or by email, and I will very gladly guide you through the project and help you get started.

Briefly summarized, Parselmouth is built using cmake. Next to that, to manually build Parselmouth, the only requirement is a modern C++ compiler supporting the C++17 standard.

Acknowledgements

  • Parselmouth builds on the extensive code base of Praat by Paul Boersma, which actually implements the huge variety of speech processing and phonetic algorithms that can now be accessed through Parselmouth.
  • In order to do so, Parselmouth makes use of the amazing pybind11 library, allowing to expose the C/C++ functionality of Praat as a Python interface.
  • Special thanks go to Bill Thompson and Robin Jadoul for their non-visible-in-history but very valuable contributions.

License

  • Parselmouth is released under the GNU General Public License, version 3 or later. See the LICENSE file for details.

A manuscript introducing Parselmouth (and supplementary material) has been published in the Journal of Phonetics. Scientific research using Parselmouth's functionality can cite Parselmouth as follows:

Jadoul, Y., Thompson, B., & de Boer, B. (2018). Introducing Parselmouth: A Python interface to Praat. Journal of Phonetics, 71, 1-15. https://doi.org/10.1016/j.wocn.2018.07.001

Parselmouth only exposes Praat's existing functionality and implementation of algorithms. If you use Parselmouth in your research and plan to cite it in a scientific publication, please do not forget to cite Praat.

Boersma, P., & Weenink, D. (2021). Praat: doing phonetics by computer [Computer program]. Version 6.1.38, retrieved 2 January 2021 from http://www.praat.org/

Owner

  • Name: Yannick Jadoul
  • Login: YannickJadoul
  • Kind: user
  • Location: Rome, Italy
  • Company: Sapienza University of Rome & Vrije Universiteit Brussel

GitHub Events

Total
  • Create event: 6
  • Release event: 1
  • Issues event: 12
  • Watch event: 103
  • Delete event: 6
  • Issue comment event: 47
  • Push event: 27
  • Pull request event: 14
  • Fork event: 13
Last Year
  • Create event: 6
  • Release event: 1
  • Issues event: 12
  • Watch event: 103
  • Delete event: 6
  • Issue comment event: 47
  • Push event: 27
  • Pull request event: 14
  • Fork event: 13

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 956
  • Total Committers: 6
  • Avg Commits per committer: 159.333
  • Development Distribution Score (DDS): 0.058
Past Year
  • Commits: 47
  • Committers: 3
  • Avg Commits per committer: 15.667
  • Development Distribution Score (DDS): 0.149
Top Committers
Name Email Commits
Yannick Jadoul y****l@b****t 901
dependabot[bot] 4****] 39
pre-commit-ci[bot] 6****] 13
Michał Górny m****y@g****g 1
Takeshi Ikuma t****a@g****m 1
Marianne m****k@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 83
  • Total pull requests: 76
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 7 days
  • Total issue authors: 75
  • Total pull request authors: 8
  • Average comments per issue: 4.54
  • Average comments per pull request: 0.86
  • Merged pull requests: 53
  • Bot issues: 0
  • Bot pull requests: 57
Past Year
  • Issues: 9
  • Pull requests: 19
  • Average time to close issues: 4 days
  • Average time to close pull requests: 2 days
  • Issue authors: 9
  • Pull request authors: 6
  • Average comments per issue: 1.67
  • Average comments per pull request: 1.0
  • Merged pull requests: 12
  • Bot issues: 0
  • Bot pull requests: 12
Top Authors
Issue Authors
  • auspicious3000 (4)
  • qo4on (2)
  • calebstrait (2)
  • ucasiggcas (2)
  • hadware (2)
  • YannickJadoul (2)
  • nils-werner (1)
  • Guillaume-Risch (1)
  • Luke-Poeppel (1)
  • tikuma-lsuhsc (1)
  • msukhare (1)
  • reedajorgy (1)
  • iamsumitjangra (1)
  • Sakun92 (1)
  • GeorgeQii (1)
Pull Request Authors
  • dependabot[bot] (35)
  • pre-commit-ci[bot] (22)
  • hokiedsp (12)
  • mgorny (2)
  • npt-1707 (2)
  • dtruong27 (1)
  • mdhk (1)
  • IParraMartin (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (35) github_actions (14) python (2) submodules (1)

Packages

  • Total packages: 3
  • Total downloads:
    • pypi 171,983 last-month
  • Total docker downloads: 13,210
  • Total dependent packages: 27
    (may contain duplicates)
  • Total dependent repositories: 850
    (may contain duplicates)
  • Total versions: 45
  • Total maintainers: 1
pypi.org: praat-parselmouth

Praat in Python, the Pythonic way

  • Versions: 15
  • Dependent Packages: 27
  • Dependent Repositories: 850
  • Downloads: 171,983 Last month
  • Docker Downloads: 13,210
Rankings
Dependent repos count: 0.4%
Dependent packages count: 0.6%
Downloads: 0.7%
Average: 1.9%
Stargazers count: 2.1%
Docker downloads count: 3.6%
Forks count: 4.3%
Maintainers (1)
Last synced: 6 months ago
proxy.golang.org: github.com/yannickjadoul/parselmouth
  • Versions: 15
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 7.0%
Average: 8.2%
Dependent repos count: 9.3%
Last synced: 7 months ago
proxy.golang.org: github.com/YannickJadoul/Parselmouth
  • Versions: 15
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 7.0%
Average: 8.2%
Dependent repos count: 9.3%
Last synced: 7 months ago

Dependencies

docs/examples/requirements.txt pypi
  • flask *
  • matplotlib *
  • pandas *
  • requests *
  • seaborn *
docs/requirements.txt pypi
  • GitPython *
  • PyGithub *
  • Sphinx >=3
  • ipykernel *
  • ipywidgets *
  • nbsphinx *
  • requests *
  • sphinx_rtd_theme *
pybind11/docs/requirements.txt pypi
  • breathe ==4.25.1
  • commonmark ==0.9.1
  • recommonmark ==0.7.1
  • sphinx ==3.3.1
  • sphinx_rtd_theme ==0.5.0
  • sphinxcontrib-moderncmakedomain ==3.17
  • sphinxcontrib-svg2pdfconverter ==1.1.0
pybind11/tests/requirements.txt pypi
  • numpy ==1.16.6
  • numpy ==1.18.0
  • numpy ==1.19.3
  • pytest ==4.6.9
  • pytest ==6.1.2
  • pytest ==6.2.1
  • pytest-timeout *
  • scipy ==1.2.3
  • scipy ==1.5.4
requirements.txt pypi
  • numpy >=1.7
tests/requirements.txt pypi
  • pytest *
  • pytest-lazy-fixture *
  • tgt *
.github/workflows/ci.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • ammaraskar/gcc-problem-matcher master composite
  • ammaraskar/msvc-problem-matcher master composite
  • jwlawson/actions-setup-cmake v1.13 composite
.github/workflows/wheels.yml actions
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • jwlawson/actions-setup-cmake v1.13 composite
  • ncipollo/release-action v1 composite
binder/requirements.txt pypi
pybind11/pyproject.toml pypi
pybind11/setup.py pypi
pybind11/tools/pyproject.toml pypi
pyproject.toml pypi
  • numpy >=1.7.0
setup.py pypi