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)
Full LAKH MIDI dataset converted to MuseNet MIDI output format (9 instruments + drums)

LAKH MuseNet MIDI Dataset Full LAKH MIDI dataset converted to MuseNet MIDI output format (9 instruments + drums) Bonus: Choir on Channel 10 Please CC

Alex 6 Nov 20, 2022
Audio features extraction

Yaafe Yet Another Audio Feature Extractor Build status Branch master : Branch dev : Anaconda : Install Conda Yaafe can be easily install with conda. T

Yaafe 231 Dec 26, 2022
Suyash More 111 Jan 07, 2023
❤️ This Is The EzilaXMusicPlayer Advaced Repo 🎵

Telegram EzilaXMusicPlayer Bot 🎵 A bot that can play music on telegram group's voice Chat ❤️ Requirements 📝 FFmpeg NodeJS nodesource.com Python 3.7+

Sadew Jayasekara 11 Nov 12, 2022
music library manager and MusicBrainz tagger

beets Beets is the media library management system for obsessive music geeks. The purpose of beets is to get your music collection right once and for

beetbox 11.3k Dec 31, 2022
Gateware for the Terasic/Arrow DECA board, to become a USB2 high speed audio interface

DECA USB Audio Interface DECA based USB 2.0 High Speed audio interface Status / current limitations enumerates as class compliant audio device on Linu

Hans Baier 16 Mar 21, 2022
A library for augmenting annotated audio data

muda A library for Musical Data Augmentation. muda package implements annotation-aware musical data augmentation, as described in the muda paper. The

Brian McFee 214 Nov 22, 2022
voice assistant made with python that search for covid19 data(like total cases, deaths and etc) in a specific country

covid19-voice-assistant voice assistant made with python that search for covid19 data(like total cases, deaths and etc) in a specific country installi

Miguel 2 Dec 05, 2021
Music player - endlessly plays your music

Music player First, if you wonder about what is supposed to be a music player or what makes a music player different from a simple media player, read

Albert Zeyer 482 Dec 19, 2022
convert-to-opus-cli is a Python CLI program for converting audio files to opus audio format.

convert-to-opus-cli convert-to-opus-cli is a Python CLI program for converting audio files to opus audio format. Installation Must have installed ffmp

4 Dec 21, 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
Make an audio file (really) long-winded

longwind Make an audio file (really) long-winded Daily repetitions are an illusion anyway.

Vincent Lostanlen 2 Sep 12, 2022
Manipulate audio with a simple and easy high level interface

Pydub Pydub lets you do stuff to audio in a way that isn't stupid. Stuff you might be looking for: Installing Pydub API Documentation Dependencies Pla

James Robert 6.6k Jan 01, 2023
Learn chords with your MIDI keyboard !

miditeach miditeach is a music learning tool that can be used to practice your chords skills with a midi keyboard 🎹 ! Features Midi keyboard input se

Alexis LOUIS 3 Oct 20, 2021
A fast MDCT implementation using SciPy and FFTs

MDCT A fast MDCT implementation using SciPy and FFTs Installation As usual pip install mdct Dependencies NumPy SciPy STFT Usage import mdct spectrum

Nils Werner 43 Sep 02, 2022
Audio Retrieval with Natural Language Queries: A Benchmark Study

Audio Retrieval with Natural Language Queries: A Benchmark Study Paper | Project page | Text-to-audio search demo This repository is the implementatio

21 Oct 31, 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
:speech_balloon: SpeechPy - A Library for Speech Processing and Recognition: http://speechpy.readthedocs.io/en/latest/

SpeechPy Official Project Documentation Table of Contents Documentation Which Python versions are supported Citation How to Install? Local Installatio

Amirsina Torfi 870 Dec 27, 2022
ianZiPu is a way to write notation for Guqin (古琴) music.

PyBetween Wrapper for Between - 비트윈을 위한 파이썬 라이브러리 Legal Disclaimer 오직 교육적 목적으로만 사용할수 있으며, 비트윈은 VCNC의 자산입니다. 악의적 공격에 이용할시 처벌 받을수 있습니다. 사용에 따른 책임은 사용자가

Nancy Yi Liang 8 Nov 25, 2022
A voice assistant which can be used to interact with your computer and controls your pc operations

Introduction 👨‍💻 It is a voice assistant which can be used to interact with your computer and also you have been seeing it in Iron man movies, but t

Sujith 84 Dec 22, 2022