Praat in Python, the Pythonic way

Related tags

AudioParselmouth
Overview

Parselmouth

Parselmouth - Praat in Python, the Pythonic way

PyPI Gitter chat GitHub Actions 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.

Warning: Parselmouth 0.4.0 is the last version supporting Python 2. Python 2 has reached End Of Life on January 1, 2020, and is officially not supported anymore: see https://python3statement.org/. Please move to Python 3, to be able to keep using new Parselmouth functionality.

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

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/the_north_wind_and_the_sun.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

def draw_spectrogram(spectrogram, dynamic_range=70):
    X, Y = spectrogram.x_grid(), spectrogram.y_grid()
    sg_db = 10 * np.log10(spectrogram.values)
    plt.pcolormesh(X, Y, sg_db, vmin=sg_db.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.to_intensity()
spectrogram = snd.to_spectrogram()
plt.figure()
draw_spectrogram(spectrogram)
plt.twinx()
draw_intensity(intensity)
plt.xlim([snd.xmin, snd.xmax])
plt.show() # or plt.savefig("spectrogram.pdf")

docs/images/example_spectrogram.png

def draw_pitch(pitch):
    # Extract selected pitch contour, and
    # replace unvoiced samples by NaN to not plot
    pitch_values = pitch.selected_array['frequency']
    pitch_values[pitch_values==0] = np.nan
    plt.plot(pitch.xs(), pitch_values, '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
pre_emphasized_snd = snd.copy()
pre_emphasized_snd.pre_emphasize()
spectrogram = pre_emphasized_snd.to_spectrogram(window_length=0.03, maximum_frequency=8000)
plt.figure()
draw_spectrogram(spectrogram)
plt.twinx()
draw_pitch(pitch)
plt.xlim([snd.xmin, snd.xmax])
plt.show() # or plt.savefig("spectrogram_0.03.pdf")

docs/images/example_spectrogram_0.03.png

# 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 wave_file in glob.glob("audio/*.wav"):
    print("Processing {}...".format(wave_file))
    s = parselmouth.Sound(wave_file)
    s.pre_emphasize()
    s.save(os.path.splitext(wave_file)[0] + "_pre.wav", 'WAV') # or parselmouth.SoundFileFormat.WAV instead of 'WAV'
    s.save(os.path.splitext(wave_file)[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

Comments
  • Can't install the library

    Can't install the library

    I am using Linux OS (Ubuntu 16.04) and Python version 3.5.

    I have just installed the library (on my Anaconda virtenv) and I am getting an error when trying to import it:

    import parselmouth
    

    "Traceback (most recent call last): File "", line 1, in File "/home/taras/anaconda3/envs/CondaEnvPy3Tf/lib/python3.5/site-packages/parselmouth/init.py", line 22, in from parselmouth.base import Parselmouth File "/home/taras/anaconda3/envs/CondaEnvPy3Tf/lib/python3.5/site-packages/parselmouth/base.py", line 30, in from parselmouth.adapters.dfp.interface import DFPInterface File "/home/taras/anaconda3/envs/CondaEnvPy3Tf/lib/python3.5/site-packages/parselmouth/adapters/dfp/interface.py", line 17, in from urllib import quote ImportError: cannot import name 'quote' "

    opened by Svito-zar 29
  • ImportError: DLL load failed: %1 is not a valid Win32 application.

    ImportError: DLL load failed: %1 is not a valid Win32 application.

    @jyothika12 Seems your additional problem from #10 is bigger than expected. Let's continue the discussion here, in a separate issue.

    I have just tried the same on a freshly installed Python 3.7, 32-bit on a Windows installation, but I cannot reproduce the error:

    C:\Users\Yannick>powershell                                                                                                                                                                                                                                                        
    Windows PowerShell                                                                                                                                                                                                                                                                 
    Copyright (C) Microsoft Corporation. All rights reserved.                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                       
    PS C:\Users\Yannick> & 'C:\Program Files (x86)\Python37-32/python.exe'                                                                                                                                                                                                             
    Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32                                                                                                                                                                                       
    Type "help", "copyright", "credits" or "license" for more information.                                                                                                                                                                                                             
    >>> ls                                                                                                                                                                                                                                                                             
    Traceback (most recent call last):                                                                                                                                                                                                                                                 
      File "<stdin>", line 1, in <module>                                                                                                                                                                                                                                              
    NameError: name 'ls' is not defined                                                                                                                                                                                                                                                
    >>> import sys                                                                                                                                                                                                                                                                     
    >>> import subprocess                                                                                                                                                                                                                                                              
    >>> subprocess.call([sys.executable, "-m", "pip", "install", "-U", "--force-reinstall", "praat-parselmouth"])                                                                                                                                                                      
    Collecting praat-parselmouth                                                                                                                                                                                                                                                       
      Downloading https://files.pythonhosted.org/packages/3b/32/f344046db6759ed2b3939f7671caf469ad15489dfe97c56b37807d4c4232/praat_parselmouth-0.3.3-cp37-cp37m-win32.whl (6.9MB)                                                                                                      
        100% |████████████████████████████████| 6.9MB 2.0MB/s                                                                                                                                                                                                                          
    Collecting numpy>=1.7.0 (from praat-parselmouth)                                                                                                                                                                                                                                   
      Downloading https://files.pythonhosted.org/packages/07/46/656c25b39fc152ea525eef14b641993624a6325a8ae815b200de57cff0bc/numpy-1.16.4-cp37-cp37m-win32.whl (10.0MB)                                                                                                                
        100% |████████████████████████████████| 10.0MB 2.1MB/s                                                                                                                                                                                                                         
    Installing collected packages: numpy, praat-parselmouth                                                                                                                                                                                                                            
      The script f2py.exe is installed in 'C:\Program Files (x86)\Python37-32\Scripts' which is not on PATH.                                                                                                                                                                           
      Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.                                                                                                                                                                
    Successfully installed numpy-1.16.4 praat-parselmouth-0.3.3                                                                                                                                                                                                                        
    You are using pip version 19.0.3, however version 19.1.1 is available.                                                                                                                                                                                                             
    You should consider upgrading via the 'python -m pip install --upgrade pip' command.                                                                                                                                                                                               
    0                                                                                                                                                                                                                                                                                  
    >>> import parselmouth                                                                                                                                                                                                                                                             
    >>>                         
    
    opened by YannickJadoul 21
  • Installation Failing when using Visual Studio 2022 and Windows 11

    Installation Failing when using Visual Studio 2022 and Windows 11

    System Information

    Operating System - Windows 11 Python Version - 3.10.0 Visual Studio - Visual Studio 2022 Package Manager - PIP

    Description

    The problem may be due to Windows 11 or VS 2022. When I try to install the package, it gives me the following error:

    Building wheels for collected packages: praat-parselmouth
      Building wheel for praat-parselmouth (PEP 517) ... error
      ERROR: Command errored out with exit status 1:
       command: 'C:\Users\soham\miniconda3\python.exe' 'C:\Users\soham\miniconda3\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' build_wheel 'C:\Users\soham\AppData\Local\Temp\tmp1gyd0p55'
           cwd: C:\Users\soham\AppData\Local\Temp\pip-install-ehh6vn7e\praat-parselmouth_8aabdbb89a704e4daaa852d44164ce2e
      Complete output (343 lines):
      WARNING: '' not a valid package name; please use only .-separated package names in setup.py
      Not searching for unused variables given on the command line.
      CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
        Compatibility with CMake < 2.8.12 will be removed from a future version of
        CMake.
    
        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.
    
    
      CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
      -- Configuring incomplete, errors occurred!
      See also "C:/Users/soham/AppData/Local/Temp/pip-install-ehh6vn7e/praat-parselmouth_8aabdbb89a704e4daaa852d44164ce2e/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
      Not searching for unused variables given on the command line.
      CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
        Compatibility with CMake < 2.8.12 will be removed from a future version of
        CMake.
    
        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.
    
    
      CMake Error at CMakeLists.txt:2 (PROJECT):
        Generator
    
          Visual Studio 16 2019
    
        could not find any instance of Visual Studio.
    
    
    
      -- Configuring incomplete, errors occurred!
      See also "C:/Users/soham/AppData/Local/Temp/pip-install-ehh6vn7e/praat-parselmouth_8aabdbb89a704e4daaa852d44164ce2e/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
      Not searching for unused variables given on the command line.
      CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
        Compatibility with CMake < 2.8.12 will be removed from a future version of
        CMake.
    
        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.
    
    
      CMake Error at CMakeLists.txt:2 (PROJECT):
        Running
    
         'nmake' '-?'
    
        failed with:
    
         The system cannot find the file specified
    
    
      -- Configuring incomplete, errors occurred!
      See also "C:/Users/soham/AppData/Local/Temp/pip-install-ehh6vn7e/praat-parselmouth_8aabdbb89a704e4daaa852d44164ce2e/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
      Not searching for unused variables given on the command line.
      CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
        Compatibility with CMake < 2.8.12 will be removed from a future version of
        CMake.
    
        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.
    
    
      -- The C compiler identification is unknown
      CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
        The CMAKE_C_COMPILER:
    
          cl
    
        is not a full path and was not found in the PATH.
    
        To use the JOM generator with Visual C++, cmake must be run from a shell
        that can use the compiler cl from the command line.  This environment is
        unable to invoke the cl compiler.  To fix this problem, run cmake from the
        Visual Studio Command Prompt (vcvarsall.bat).
    
        Tell CMake where to find the compiler by setting either the environment
        variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
        the compiler, or to the compiler name if it is in the PATH.
    
    
      -- Configuring incomplete, errors occurred!
      See also "C:/Users/soham/AppData/Local/Temp/pip-install-ehh6vn7e/praat-parselmouth_8aabdbb89a704e4daaa852d44164ce2e/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
      See also "C:/Users/soham/AppData/Local/Temp/pip-install-ehh6vn7e/praat-parselmouth_8aabdbb89a704e4daaa852d44164ce2e/_cmake_test_compile/build/CMakeFiles/CMakeError.log".
      Not searching for unused variables given on the command line.
      CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
        Compatibility with CMake < 2.8.12 will be removed from a future version of
        CMake.
    
        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.
    
    
      CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
      -- Configuring incomplete, errors occurred!
      See also "C:/Users/soham/AppData/Local/Temp/pip-install-ehh6vn7e/praat-parselmouth_8aabdbb89a704e4daaa852d44164ce2e/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
      Not searching for unused variables given on the command line.
      CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
        Compatibility with CMake < 2.8.12 will be removed from a future version of
        CMake.
    
        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.
    
    
      CMake Error at CMakeLists.txt:2 (PROJECT):
        Generator
    
          Visual Studio 15 2017
    
        could not find any instance of Visual Studio.
    
    
    
      -- Configuring incomplete, errors occurred!
      See also "C:/Users/soham/AppData/Local/Temp/pip-install-ehh6vn7e/praat-parselmouth_8aabdbb89a704e4daaa852d44164ce2e/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
      Not searching for unused variables given on the command line.
      CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
        Compatibility with CMake < 2.8.12 will be removed from a future version of
        CMake.
    
        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.
    
    
      CMake Error at CMakeLists.txt:2 (PROJECT):
        Running
    
         'nmake' '-?'
    
        failed with:
    
         The system cannot find the file specified
    
    
      -- Configuring incomplete, errors occurred!
      See also "C:/Users/soham/AppData/Local/Temp/pip-install-ehh6vn7e/praat-parselmouth_8aabdbb89a704e4daaa852d44164ce2e/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
      Not searching for unused variables given on the command line.
      CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
        Compatibility with CMake < 2.8.12 will be removed from a future version of
        CMake.
    
        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.
    
    
      -- The C compiler identification is unknown
      CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
        The CMAKE_C_COMPILER:
    
          cl
    
        is not a full path and was not found in the PATH.
    
        To use the JOM generator with Visual C++, cmake must be run from a shell
        that can use the compiler cl from the command line.  This environment is
        unable to invoke the cl compiler.  To fix this problem, run cmake from the
        Visual Studio Command Prompt (vcvarsall.bat).
    
        Tell CMake where to find the compiler by setting either the environment
        variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
        the compiler, or to the compiler name if it is in the PATH.
    
    
      -- Configuring incomplete, errors occurred!
      See also "C:/Users/soham/AppData/Local/Temp/pip-install-ehh6vn7e/praat-parselmouth_8aabdbb89a704e4daaa852d44164ce2e/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
      See also "C:/Users/soham/AppData/Local/Temp/pip-install-ehh6vn7e/praat-parselmouth_8aabdbb89a704e4daaa852d44164ce2e/_cmake_test_compile/build/CMakeFiles/CMakeError.log".
    
    
      --------------------------------------------------------------------------------
      -- Trying "Ninja (Visual Studio 16 2019 x64 v141)" generator
      --------------------------------
      ---------------------------
      ----------------------
      -----------------
      ------------
      -------
      --
      --
      -------
      ------------
      -----------------
      ----------------------
      ---------------------------
      --------------------------------
      -- Trying "Ninja (Visual Studio 16 2019 x64 v141)" generator - failure
      --------------------------------------------------------------------------------
    
    
    
      --------------------------------------------------------------------------------
      -- Trying "Visual Studio 16 2019 x64 v141" generator
      --------------------------------
      ---------------------------
      ----------------------
      -----------------
      ------------
      -------
      --
      --
      -------
      ------------
      -----------------
      ----------------------
      ---------------------------
      --------------------------------
      -- Trying "Visual Studio 16 2019 x64 v141" generator - failure
      --------------------------------------------------------------------------------
    
    
    
      --------------------------------------------------------------------------------
      -- Trying "NMake Makefiles (Visual Studio 16 2019 x64 v141)" generator
      --------------------------------
      ---------------------------
      ----------------------
      -----------------
      ------------
      -------
      --
      --
      -------
      ------------
      -----------------
      ----------------------
      ---------------------------
      --------------------------------
      -- Trying "NMake Makefiles (Visual Studio 16 2019 x64 v141)" generator - failure
      --------------------------------------------------------------------------------
    
    
    
      --------------------------------------------------------------------------------
      -- Trying "NMake Makefiles JOM (Visual Studio 16 2019 x64 v141)" generator
      --------------------------------
      ---------------------------
      ----------------------
      -----------------
      ------------
      -------
      --
      --
      -------
      ------------
      -----------------
      ----------------------
      ---------------------------
      --------------------------------
      -- Trying "NMake Makefiles JOM (Visual Studio 16 2019 x64 v141)" generator - failure
      --------------------------------------------------------------------------------
    
    
    
      --------------------------------------------------------------------------------
      -- Trying "Ninja (Visual Studio 15 2017 x64 v141)" generator
      --------------------------------
      ---------------------------
      ----------------------
      -----------------
      ------------
      -------
      --
      --
      -------
      ------------
      -----------------
      ----------------------
      ---------------------------
      --------------------------------
      -- Trying "Ninja (Visual Studio 15 2017 x64 v141)" generator - failure
      --------------------------------------------------------------------------------
    
    
    
      --------------------------------------------------------------------------------
      -- Trying "Visual Studio 15 2017 x64 v141" generator
      --------------------------------
      ---------------------------
      ----------------------
      -----------------
      ------------
      -------
      --
      --
      -------
      ------------
      -----------------
      ----------------------
      ---------------------------
      --------------------------------
      -- Trying "Visual Studio 15 2017 x64 v141" generator - failure
      --------------------------------------------------------------------------------
    
    
    
      --------------------------------------------------------------------------------
      -- Trying "NMake Makefiles (Visual Studio 15 2017 x64 v141)" generator
      --------------------------------
      ---------------------------
      ----------------------
      -----------------
      ------------
      -------
      --
      --
      -------
      ------------
      -----------------
      ----------------------
      ---------------------------
      --------------------------------
      -- Trying "NMake Makefiles (Visual Studio 15 2017 x64 v141)" generator - failure
      --------------------------------------------------------------------------------
    
    
    
      --------------------------------------------------------------------------------
      -- Trying "NMake Makefiles JOM (Visual Studio 15 2017 x64 v141)" generator
      --------------------------------
      ---------------------------
      ----------------------
      -----------------
      ------------
      -------
      --
      --
      -------
      ------------
      -----------------
      ----------------------
      ---------------------------
      --------------------------------
      -- Trying "NMake Makefiles JOM (Visual Studio 15 2017 x64 v141)" generator - failure
      --------------------------------------------------------------------------------
    
      ********************************************************************************
      scikit-build could not get a working generator for your system. Aborting build.
    
      Building Windows wheels for requires Microsoft Visual Studio 2017 or 2019:
    
        https://visualstudio.microsoft.com/vs/
    
      ********************************************************************************
      ----------------------------------------
      ERROR: Failed building wheel for praat-parselmouth
    Failed to build praat-parselmouth
    ERROR: Could not build wheels for praat-parselmouth which use PEP 517 and cannot be installed directly
    
    opened by SohamSen15 15
  • Segfault when computing formants on stereo audio from array

    Segfault when computing formants on stereo audio from array

    Hey,

    First, i'd like to thank you again for your work on parselmouth. It's an amazing work. I ran into a small problem that can become a bit troublesome since this won't output any stacktrace. An example is worth a thousand words:

    from parselmouth import Sound
    from scipy.io.wavfile import read
    rate, array = read("some_stereo_audio.wav")
    snd = Sound(array, rate)
    snd.to_formant_burg() # <--------- this will segfault
    

    However, this works if I load the sound directly from the path (snd = Sound("some_stereo_audio.wav")).

    I'm running python 3.8 on ubuntu, but this segfaulted all the same on a python 3.7 on centos. I tested it on all parselmouth versions >= 0.3.2

    opened by hadware 13
  • Building wheel hangs on ppc64le

    Building wheel hangs on ppc64le

    When installing praat-parselmouth using pip install praat-parselmouth inside a conda environment on a power9 ppc64le system. The installation always hangs at this step

    Building wheels for collected packages: praat-parselmouth Building wheel for praat-parselmouth (pyproject.toml) ...

    opened by auspicious3000 10
  • package version 0.3.2.post2

    package version 0.3.2.post2

    I found the version in wheel meta (0.3.2) does not match the version provided on pypi (0.3.2.post2). It may cause problems when installing with version specifications like pip install praat_parselmouth==0.3.2. Hope the wheel could contain the right version (assign version="0.3.2.post2" in setup.py) or just preserve the package of version 0.3.2 on pypi.

    opened by craynic 9
  • Breaks JSON package in Python 3.7 on Arch linux

    Breaks JSON package in Python 3.7 on Arch linux

    No idea why this is the case, but importing parselmouth has caused the JSON library to stop working, I assume due to some sort of reassignment of json.load or something similar.

    Minimal case:

    import json
    import parselmouth
    with open("main_survey", "r") as f:
          survey = json.load(f)
    

    crashes, while if I run it without importing parselmouth it works fine.

    output

    Traceback (most recent call last):
      File "test.py", line 5, in <module>
        survey = json.load(f)
      File "/usr/lib/python3.7/json/__init__.py", line 293, in load
        return loads(fp.read(),
      File "/usr/lib/python3.7/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 4486: ordinal not in range(128)
    
    opened by MichaelGoodale 9
  • "parselmouth.praat.run_file" is not thread safe?

    objects = run_file(mltrnl_praat, -20, 2, 0.3, "no", wavfile, path, 80, 400, 0.01, capture_output=True)
    print(objects)
    

    The arguments is same, but sometimes return objects is not same.

    run_file can be called by different threads?

    opened by hebo1982 8
  • Bump jwlawson/actions-setup-cmake from v1.6 to v1.7

    Bump jwlawson/actions-setup-cmake from v1.6 to v1.7

    Bumps jwlawson/actions-setup-cmake from v1.6 to v1.7.

    Release notes

    Sourced from jwlawson/actions-setup-cmake's releases.

    v1.7

    • Specify GitHub API version in request headers
    • Provide fallback when Link headers are unavailable
    • Remove async from some functions
    • Update dependencies
    Commits

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    dependencies github_actions 
    opened by dependabot[bot] 7
  • Memory issues when generating voice report in bulk

    Memory issues when generating voice report in bulk

    OS: Ubuntu 18.04.4 LTS python: 3.7.5

    I am running the below function in a loop iterating over audio files between 10~60 seconds long.

    def calc_voice_report(input_audio):
        sound = parselmouth.Sound(input_audio)
        pitch = sound.to_pitch()
        pulses = parselmouth.praat.call([sound, pitch], "To PointProcess (cc)")
        voice_report_str = \
            parselmouth.praat.call([sound, pitch, pulses], "Voice report", 0.0, 0.0, 75, 600, 1.3, 1.6, 0.03, 0.45)
        return voice_report_str
    

    The resulting string is then parsed and saved into a csv.

    After around 3k~8k files I ran into some sort of memory issue, either:

    • SIGFAULT 6
    • a parselmouth error stating that it's out of memory (did not save the error message will write it down if it happens again next time)
    • a computer freeze

    I had similar issues running praat voice report in a praat script (using subprocess to call it from python) which makes me think there is a memory leak caused by the voice report module.

    Is there a way to fully "clear" parselmouth of it's memory after a parselmouth.praat.call?

    opened by kkawabat 7
  • Extracting 12 Mel-frequency cepstral coefficients

    Extracting 12 Mel-frequency cepstral coefficients

    Hi Yannick, I was hoping you might be willing to help me get past just one more issue:

    I'm trying to extract 12 Mel-frequency cepstral coefficients (MFCCs) from a .wav file, and when I do the following:

    sound = parselmouth.Sound(path)
    mfcc_object = sound.to_mfcc(number_of_coefficients=12)
    mfccs = mfcc_object.extract_features()
    mfcc_arr = mfccs.as_array()
    print(mfcc_arr.shape)
    

    ...the result on 3 different .wavs are

    (4, 21)
    (4, 2439)
    (4, 114)
    

    I'm expecting the resulting arrays to be 12 by (something), not 4 by (something). Where am I going wrong?

    opened by calebstrait 7
  • Missing import praat

    Missing import praat

    Hello, I have a problem with the using of praat I tried this : from parselmouth.praat import call, run_file But I met this error Import "parselmouth.praat" could not be resolved(reportMissingImports) By the way I had installed parselmouth with pip install praat-parselmouth Have you any ideas to help me ?

    Thank you!

    opened by Guillaume-Risch 5
  • Formant calculation not as accurate as in the Praat software

    Formant calculation not as accurate as in the Praat software

    I tried to use Parselmouth's to_formant_burg(time_step=0.032) to calculate formants, but the returned values on the same audio file are very inaccurate compared to results from the Praat software. What are some potential causes for this difference in accuracy with the same software? Is it possible that Praat is using To Formant (robust) rather than To Formant (burg)?

    image

    image

    opened by hykilpikonna 2
  • Segmentation fault (core dumped) on ppc64le

    Segmentation fault (core dumped) on ppc64le

    System: power 9, linux ppc64le Anaconda version: Anaconda3-2021.11-Linux-ppc64le.sh, Anaconda3-2020.11-Linux-ppc64le.sh python version: 3.7, 3.8 parselmouth version: 0.4.0

    After successful installation using pip install, 'import parselmouth' gives Segmentation fault (core dumped). parselmouth version 0.3.3 can work but I would like to install 0.4.0.

    Are there alternative ways to install such as compiling from source?

    Thanks!

    opened by auspicious3000 3
  • parselmouth.praat.call stuck in

    parselmouth.praat.call stuck in "Change gender"

    Hello,

    I have multiple processes of a function calling the parselmouth.praat.call(...). After certain number of iterations, the program hangs forever. Is this because the praat.call() also spawns another subprocess? What would be the recommended way to use praat.call in multiprocessing?

    Thanks!

    opened by auspicious3000 13
  • case-insensitive-enums

    case-insensitive-enums

    Yannick,

    Here is a quick take on making Praat enums case-insensitive.

    Donno if this is the direction you'd like to take, but it's an easy mod. Take a look.

    P.S., test_enums.py was added more for my verification and demonstration to you. Feel free to delete it if you decide to add this feature.

    opened by hokiedsp 1
Releases(v0.4.3)
Python implementation of the Short Term Objective Intelligibility measure

Python implementation of STOI Implementation of the classical and extended Short Term Objective Intelligibility measures Intelligibility measure which

Pariente Manuel 250 Dec 21, 2022
A python library for working with praat, textgrids, time aligned audio transcripts, and audio files.

praatIO Questions? Comments? Feedback? A library for working with praat, time aligned audio transcripts, and audio files that comes with batteries inc

Tim 224 Dec 19, 2022
Guide & Examples to create deeplearning gstreamer plugins and use them in your pipeline

upai-gst-dl-plugins Guide & Examples to create deeplearning gstreamer plugins and use them in your pipeline Introduction Thanks to the work done by @j

UPAI.IO 11 Dec 11, 2022
An 8D music player made to enjoy Halloween this year!🤘

HAPPY HALLOWEEN buddy! Split Player Hello There! Welcome to SplitPlayer... Supposed To Be A 8DPlayer.... You Decide.... It can play the ordinary audio

Akshat Kumar Singh 1 Nov 04, 2021
PyAbsorp is a python module that has the main focus to help estimate the Sound Absorption Coefficient.

This is a package developed to be use to find the Sound Absorption Coefficient through some implemented models, like Biot-Allard, Johnson-Champoux and

Michael Markus Ackermann 8 Oct 19, 2022
Play any song directly into your group voice chat.

Telegram VCPlayer Bot Play any song directly into your group voice chat. Official Bot : VCPlayerBot | Discussion Group : VoiceChat Music Player Suppor

Shubham Kumar 50 Nov 21, 2022
Open Sound Strip, Sequence or Record in Audacity

Audacity Tools For Blender Sound editing in Blender Video Sequence Editor with Audacity integrated. Send/receive the full edited sequence or single st

64 Dec 31, 2022
Music generation using ml / dl

Data analysis Document here the project: deep_music Description: Project Description Data Source: Type of analysis: Please document the project the be

0 Jul 03, 2022
Audio2midi - Automatic Audio-to-symbolic Arrangement

Automatic Audio-to-symbolic Arrangement This is the repository of the project "Audio-to-symbolic Arrangement via Cross-modal Music Representation Lear

Ziyu Wang 24 Dec 05, 2022
AudioDVP:Photorealistic Audio-driven Video Portraits

AudioDVP This is the official implementation of Photorealistic Audio-driven Video Portraits. Major Requirements Ubuntu = 18.04 PyTorch = 1.2 GCC =

232 Jan 03, 2023
Muzic: Music Understanding and Generation with Artificial Intelligence

Muzic is a research project on AI music that empowers music understanding and generation with deep learning and artificial intelligence.

Microsoft 2.6k Dec 30, 2022
Gammatone-based spectrograms, using gammatone filterbanks or Fourier transform weightings.

Gammatone Filterbank Toolkit Utilities for analysing sound using perceptual models of human hearing. Jason Heeris, 2013 Summary This is a port of Malc

Jason Heeris 188 Dec 14, 2022
Automatically move or copy files based on metadata associated with the files. For example, file your photos based on EXIF metadata or use MP3 tags to file your music files.

Automatically move or copy files based on metadata associated with the files. For example, file your photos based on EXIF metadata or use MP3 tags to file your music files.

Rhet Turnbull 14 Nov 02, 2022
spafe: Simplified Python Audio-Features Extraction

spafe aims to simplify features extractions from mono audio files. The library can extract of the following features: BFCC, LFCC, LPC, LPCC, MFCC, IMFCC, MSRCC, NGCC, PNCC, PSRCC, PLP, RPLP, Frequenc

Ayoub Malek 310 Jan 01, 2023
:sound: Play and Record Sound with Python :snake:

Play and Record Sound with Python This Python module provides bindings for the PortAudio library and a few convenience functions to play and record Nu

spatialaudio.net 750 Dec 31, 2022
A rofi-blocks script that searches youtube and plays the selected audio on mpv.

rofi-ytm A rofi-blocks script that searches youtube and plays the selected audio on mpv. To use the script, run the following command rofi -modi block

Cliford 26 Dec 21, 2022
GNU Radio – the Free and Open Software Radio Ecosystem

GNU Radio is a free & open-source software development toolkit that provides signal processing blocks to implement software radios. It can be used wit

GNU Radio 4.1k Jan 06, 2023
Musillow is a music recommender app that finds songs similar to your favourites.

MUSILLOW The music recommender app Check it out now!!! View Demo · Report Bug · Request Feature About The App Musillow is a music recommender app that

3 Feb 03, 2022
digital audio workstation, instrument and effect plugins, wave editor

digital audio workstation, instrument and effect plugins, wave editor

306 Jan 05, 2023
MusicBrainz Picard

MusicBrainz Picard MusicBrainz Picard is a cross-platform (Linux/Mac OS X/Windows) application written in Python and is the official MusicBrainz tagge

MetaBrainz Foundation 3k Dec 31, 2022