A python library for working with praat, textgrids, time aligned audio transcripts, and audio files.

Related tags

AudiopraatIO
Overview

praatIO

Questions? Comments? Feedback?


A library for working with praat, time aligned audio transcripts, and audio files that comes with batteries included.

Praat uses a file format called textgrids, which are time aligned speech transcripts. This library isn't just a data struct for reading and writing textgrids--many utilities are provided to make it easy to work with with transcripts and associated audio files. This library also provides some other tools for use with praat.

Praat is an open source software program for doing phonetic analysis and annotation of speech. Praat can be downloaded here

Table of contents

  1. Documentation
  2. Tutorials
  3. Version History
  4. Requirements
  5. Installation
  6. Version 4 to 5 Migration
  7. Usage
  8. Common Use Cases
  9. Tests
  10. Citing praatIO
  11. Acknowledgements

Documentation

Automatically generated pdocs can be found here:

http://timmahrt.github.io/praatIO/

Tutorials

There are tutorials available for learning how to use PraatIO. These are in the form of IPython Notebooks which can be found in the /tutorials/ folder distributed with PraatIO.

You can view them online using the external website Jupyter:

Tutorial 1: An introduction and tutorial

Version History

Praatio uses semantic versioning (Major.Minor.Patch)

Please view CHANGELOG.md for version history.

Requirements

Python module https://pypi.org/project/typing-extensions/. It should be installed automatically with praatio but you can install it manually if you have any problems.

Python 3.7.* or above

Click here to visit travis-ci and see the specific versions of python that praatIO is currently tested under

If you are using Python 2.x or Python < 3.7, you can use PraatIO 4.x.

Installation

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

python -m pip install praatio --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:\Python37\python.exe setup.py install

Version 4 to 5 Migration

Many things changed between versions 4 and 5. If you see an error like WARNING: You've tried to import 'tgio' which was renamed 'textgrid' in praatio 5.x. it means that you have installed version 5 but your code was written for praatio 4.x or earlier.

The immediate solution is to uninstall praatio 5 and install praatio 4. From the command line:

pip uninstall praatio
pip install "praatio<5"

If praatio is being installed as a project dependency--ie it is set as a dependency in setup.py like

    install_requires=["praatio"],

then changing it to the following should fix the problem

    install_requires=["praatio ~= 4.1"],

Many files, classes, and functions were renamed in praatio 5 to hopefully be clearer. There were too many changes to list here but the tgio module was renamed textgrid.

Also, the interface for openTextgrid() and tg.save() has changed. Here are examples of the required arguments in the new interface

textgrid.openTextgrid(
  fn=name,
  includeEmptyIntervals=False
)
tg.save(
  fn=name,
  format= "short_textgrid",
  includeBlankSpaces= False
)

Please consult the documentation to help in upgrading to version 5.

Usage

99% of the time you're going to want to run

from praatio import textgrid
tg = textgrid.openTextgrid(r"C:\Users\tim\Documents\transcript.TextGrid", False)

Or if you want to work with KlattGrid files

from praatio import klattgrid
kg = klattgrid.openKlattGrid(r"C:\Users\tim\Documents\transcript.KlattGrid")

See /test for example usages

Common Use Cases

What can you do with this library?

  • query a textgrid to get information about the tiers or intervals contained within

    tg = textgrid.openTextgrid("path_to_textgrid", False)
    entryList = tg.tierDict["speaker_1_tier"].entryList # Get all intervals
    entryList = tg.tierDict["phone_tier"].find("a") # Get the indicies of all occurrences of 'a'
  • create or augment textgrids using data from other sources

  • found that you clipped your audio file five seconds early and have added it back to your wavefile but now your textgrid is misaligned? Add five seconds to every interval in the textgrid

    tg = textgrid.openTextgrid("path_to_textgrid", False)
    moddedTG = tg.editTimestamps(5)
    moddedTG.save('output_path_to_textgrid', 'long_textgrid', True)
  • utilize the klattgrid interface to raise all speech formants by 20%

    kg = klattgrid.openKlattGrid("path_to_klattgrid")
    incrTwenty = lambda x: x * 1.2
    kg.tierDict["oral_formants"].modifySubtiers("formants",incrTwenty)
    kg.save(join(outputPath, "bobby_twenty_percent_less.KlattGrid"))
  • replace labeled segments in a recording with silence or delete them

    • see /examples/deleteVowels.py
  • use set operations (union, intersection, difference) on textgrid tiers

    • see /examples/textgrid_set_operations.py
  • see /praatio/praatio_scripts.py for various ready-to-use functions such as

    • splitAudioOnTier(): split an audio file into chunks specified by intervals in one tier
    • spellCheckEntries(): spellcheck a textgrid tier
    • tgBoundariesToZeroCrossings(): adjust all boundaries and points to fall at the nearest zero crossing in the corresponding audio file
    • alignBoundariesAcrossTiers(): for handmade textgrids, sometimes entries may look as if they are aligned at the same time but actually are off by a small amount, this will correct them

Tests

I run tests with the following command (this requires pytest and pytest-cov to be installed):

pytest --cov=praatio tests/

Citing praatIO

PraatIO 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. PraatIO. https://github.com/timmahrt/praatIO, 2016.

Acknowledgements

Development of PraatIO was possible thanks to NSF grant BCS 12-51343 to Jennifer Cole, Josรฉ I. Hualde, and Caroline Smith and to the A*MIDEX project (nยฐ ANR-11-IDEX-0001-02) to James Sneed German funded by the Investissements d'Avenir French Government program, managed by the French National Research Agency (ANR).

Owner
Tim
I write tools for working with speech data.
Tim
Music player and music library manager for Linux, Windows, and macOS

Ex Falso / Quod Libet - A Music Library / Editor / Player Quod Libet is a music management program. It provides several different ways to view your au

Quod Libet 1.2k Jan 07, 2023
This is an AI that runs in the terminal. It is a voice assistant that can do common activities and can also help in your coding doubts like

This is an AI that runs in the terminal. It is a voice assistant that can do common activities and can also help in your coding doubts like

OneBit 1 Nov 05, 2021
Graphical interface to control granular sound synthesis.

Granular sound synthesis interface SoundGrain is a graphical interface where users can draw and edit trajectories to control granular sound synthesis

Olivier Bรฉlanger 122 Dec 10, 2022
Python I/O for STEM audio files

stempeg = stems + ffmpeg Python package to read and write STEM audio files. Technically, stems are audio containers that combine multiple audio stream

Fabian-Robert Stรถter 72 Dec 23, 2022
๐ŸŽต Python sound notifications made easy

chime Python sound notifications made easy. Table of contents Table of contents Motivation Installation Basic usage Theming IPython/Jupyter magic Exce

Max Halford 231 Jan 09, 2023
A python script that can play .mp3 URLs upon the ringing or motion detection of a Ring doorbell. The sound plays through Sonos speakers.

Ring x Sonos A python script that plays .mp3 files whenever a doorbell is rung or a doorbell detects motion. Features Music! Authors @braden Running T

braden 0 Nov 12, 2021
praudio provides audio preprocessing framework for Deep Learning audio applications

praudio provides objects and a script for performing complex preprocessing operations on entire audio datasets with one command.

Valerio Velardo 105 Dec 26, 2022
An audio-solving python funcaptcha solving module

funcapsolver funcapsolver is a funcaptcha audio-solving module, which allows captchas to be interacted with and solved with the use of google's speech

Acier 8 Nov 21, 2022
Audio augmentations library for PyTorch for audio in the time-domain

Audio augmentations library for PyTorch for audio in the time-domain, with support for stochastic data augmentations as used often in self-supervised / contrastive learning.

Janne 166 Jan 08, 2023
gentle forced aligner

Gentle Robust yet lenient forced-aligner built on Kaldi. A tool for aligning speech with text. Getting Started There are three ways to install Gentle.

1.2k Dec 30, 2022
Stream Music ๐ŸŽต ๐˜ผ ๐™—๐™ค๐™ฉ ๐™ฉ๐™๐™–๐™ฉ ๐™˜๐™–๐™ฃ ๐™ฅ๐™ก๐™–๐™ฎ ๐™ข๐™ช๐™จ๐™ž๐™˜ ๐™ค๐™ฃ ๐™๐™š๐™ก๐™š๐™œ๐™ง๐™–๐™ข ๐™‚๐™ง๐™ค๐™ช๐™ฅ ๐™–๐™ฃ๐™™ ๐˜พ๐™๐™–๐™ฃ๐™ฃ๐™š๐™ก ๐™‘๐™ค๐™ž๐™˜๐™š ๐˜พ๐™๐™–๐™ฉ๐™จ ๐˜ผ๐™ซ๐™–๐™ž๐™ก?

Stream Music ๐ŸŽต ๐˜ผ ๐™—๐™ค๐™ฉ ๐™ฉ๐™๐™–๐™ฉ ๐™˜๐™–๐™ฃ ๐™ฅ๐™ก๐™–๐™ฎ ๐™ข๐™ช๐™จ๐™ž๐™˜ ๐™ค๐™ฃ ๐™๐™š๐™ก๐™š๐™œ๐™ง๐™–๐™ข ๐™‚๐™ง๐™ค๐™ช๐™ฅ ๐™–๐™ฃ๐™™ ๐˜พ๐™๐™–๐™ฃ๐™ฃ๐™š๐™ก ๐™‘๐™ค๐™ž๐™˜๐™š ๐˜พ๐™๐™–๐™ฉ๐™จ ๐˜ผ๐™ซ๐™–๐™ž๐™ก?

Sadew Jayasekara 15 Nov 12, 2022
A simple python script to play bell sound in your system infinitely, just for fun and experimental purposes

A simple python script to play bell sound in your system infinitely, just for fun and experimental purposes

ู†ุงูุน ุงู„ู‡ู„ุงู„ูŠ 1 Oct 29, 2021
Vixtify - Python Controlled Music Player

Strumm Sound Playlist : Click me to listen Welcome to GitHub Pages You can use the editor on GitHub to maintain and preview the content for your websi

Vicky Kumar 2 Feb 03, 2022
A Python port and library-fication of the midicsv tool by John Walker.

A Python port and library-fication of the midicsv tool by John Walker. If you need to convert MIDI files to human-readable text files and back, this is the library for you.

Tim Wedde 52 Dec 29, 2022
๐™ฐ ๐™ผ๐šž๐šœ๐š’๐šŒ ๐™ฑ๐š˜๐š ๐™ฒ๐š›๐šŽ๐šŠ๐š๐šŽ๐š ๐™ฑ๐šข ๐šƒ๐šŽ๐šŠ๐š–๐™ณ๐š•๐š ๐Ÿ’–

TeamDltmusic ๐™ฐ ๐™ผ๐šž๐šœ๐š’๐šŒ ๐™ฑ๐š˜๐š ๐™ฒ๐š›๐šŽ๐šŠ๐š๐šŽ๐š ๐™ฑ๐šข ๐šƒ๐šŽ๐šŠ๐š–๐™ณ๐š•๐š ๐Ÿ’– Deploy String Session String Click hear you can find string session OR join He

TeamDlt 5 Jan 18, 2022
An audio guide for destroying oracles in Destiny's Vault of Glass raid

prophet An audio guide for destroying oracles in Destiny's Vault of Glass raid. This project allows you to make any encounter with oracles without hav

24 Sep 15, 2022
Spotify Song Recommendation Program

Spotify-Song-Recommendation-Program Made by Esra Nur ร–zรผm Written in Python The aim of this project was to build a recommendation system that recommen

esra nur รถzรผm 1 Jun 30, 2022
Audio spatialization over WebRTC and JACK Audio Connection Kit

Audio spatialization over WebRTC Spatify provides a framework for building multichannel installations using WebRTC.

Bruno Gola 34 Jun 29, 2022
A GUI-based audio player with support for a large variety of formats

Miza-Player A GUI-based audio player with support for a large variety of formats, able to play from web-hosted media platforms such as YouTube, includ

Thomas Xin 3 Dec 14, 2022
Praat in Python, the Pythonic way

Parselmouth - Praat in Python, the Pythonic way Parselmouth is a Python library for the Praat software. Though other attempts have been made at portin

Yannick Jadoul 786 Jan 09, 2023