From d9e8b07c7e4b178c91363473ee03c3dc5dc9f2b6 Mon Sep 17 00:00:00 2001 From: Tim Mahrt Date: Sat, 15 Nov 2025 12:34:55 +0900 Subject: [PATCH 1/4] refactor: convert rst file to md --- README.md | 210 +++++++++++++++++++++++++++++++++++++++++ README.rst | 268 ----------------------------------------------------- 2 files changed, 210 insertions(+), 268 deletions(-) create mode 100644 README.md delete mode 100644 README.rst diff --git a/README.md b/README.md new file mode 100644 index 0000000..32c1cd8 --- /dev/null +++ b/README.md @@ -0,0 +1,210 @@ + +# ProMo (Prosody Morph) + +[![](https://travis-ci.org/timmahrt/ProMo.svg?branch=main)](https://travis-ci.org/timmahrt/ProMo) +[![](https://coveralls.io/repos/github/timmahrt/ProMo/badge.svg?branch=main)](https://coveralls.io/github/timmahrt/ProMo?branch=main) +[![](https://img.shields.io/badge/license-MIT-blue.svg?)](http://opensource.org/licenses/MIT) + +----- + +A library for manipulating pitch and duration in an algorithmic way, for resynthesizing speech. + +This library can be used to resynthesize pitch in natural speech using pitch contours taken from other speech samples, generated pitch contours, or through algorithmic manipulations of the source pitch contour. + +## Table of contents + +1. [Documentation](#documentation) +2. [Common Use Cases](#common-use-cases) +3. [Illustrative Example](#illustrative-example) +4. [Tutorials](#tutorials) +5. [Version history](#version-history) +6. [Requirements](#requirements) +7. [Usage](#usage) +8. [Installation](#installation) +9. [Citing ProMo](#citing-promo) +10. [Acknowledgements](#acknowledgements) + +## Documentation + +Automatically generated pdocs can be found here: + +http://timmahrt.github.io/ProMo/ + + +## Common Use Cases + +What can you do with this library? + +Apply the pitch or duration from one speech sample to another. + +- alignment happens both in time and in hertz + + - after the morph process, the source pitch points will be at the same absolute pitch and relative time as they are in the target file + + - time is relative to the start and stop time of the interval being considered (e.g. the pitch value at 80% of the duration of the interval). + Relative time is used so that the source and target files don't have to be the same length. + + - temporal morphing is a minor effect if the sampling frequency is high but it can be significant when, for example, using a stylized pitch contour with few pitch samples. + +- modifications can be done between entire wav files or between corresponding intervals as specified in a textgrid or other annotation (indicating the boundaries of words, stressed vowels, etc.) + + - the larger the file, the less useful the results are likely to be without using a transcript of some sort + + - the transcripts do not have to match in lexical content, only in the number of intervals (same number of words or phones, etc.) + +- modifications can be scaled (it is possible to generate a wav file with a pitch contour that is 30% or 60% between the source and target contours). + +- can also morph the pitch range and average pitch independently. + +- resynthesis is performed by Praat. + +- pitch can be obtained from praat (such as by using praatio) or from other sources (e.g. ESPS getF0) + +- plots of the resynthesis (such as the ones below) can be generated + + +## Illustrative example + +Consider the phrase "Mary rolled the barrel". +In the first recording (examples/mary1.wav), "Mary rolled the barrel" was said in response to a question such as "Did John roll the barrel?". On the other hand, in the second recording (examples/mary2.wav) the utterance was said in response to a question such as "What happened yesterday". + +"Mary" in "mary1.wav" is produced with more emphasis than in "mary2.wav". +It is longer and carries a more drammatic pitch excursion. +Using ProMo, we can make mary1.wav spoken similar to mary2.wav, even though they were spoken in a different way and by different speakers. + +Duration and pitch carry meaning. +Change these, and you can change the meaning being conveyed. + +``Note that modifying pitch and duration too much can introduce artifacts. +Such artifacts can be heard even in pitch morphing mary1.wav to mary2.wav.`` + +Pitch morphing (examples/pitch_morph_example.py): + + The following image shows morphing of pitch from mary1.wav to mary2.wav on a word-by-word level in increments of 33% (33%, 66%, 100%). + Note that the morph adjusts the temporal dimension of the target signal to fit the duration of the source signal (the source and generated contours are equally shorter than the target contour). + This occurs at the level of the file unless the user specifies an equal number of segments to align in time + (e.g. using word-level transcriptions, as done here, or phone-level transcriptions, etc.) + + + +With the ability to morph pitch range and average pitch, it becomes easier +to morph contours produced by different speakers: + + The following image shows four different pitch manipulations. + On the **upper left** is the raw morph. + Notice that final output (black line) is very close to the target. + Differences stem from duration differences. + + However, the average pitch and pitch range are qualities of speech that can signify differences in gender in addition to other aspects of speaker identity. + By resetting the average pitch and pitch range to that of the source, it is possible to morph the contour while maintaining aspects of the source speaker's identity. + + The image in the **upper right** contains a morph followed by a reset of the average pitch to the source speaker's average pitch. + In the **bottom right** a morph followed by a reset of the speaker's pitch range. + In the **bottom right** pitch range was reset and then the speaker's average pitch was reset. + + The longer the speech sample, the more representative the pitch range and mean pitch will be of the speaker. + In this example both are skewed higher by the pitch accent on the first word. + + Here the average pitch of the source (a female speaker) is much higher than the target (a male speaker) and the resulting morph sounds like it comes from a different speaker than the source or target speakers. + The three recordings that involve resetting pitch range and/or average pitch sound much more natural. + + + +Duration morphing (examples/duration_manipulation_example.py): + + The following image shows morphing of duration from mary1.wav to mary2.wav on a word-by-word basis in increments of 33% (33%, 66%, 100%). + This process can operate over an entire file or, similar to pitch morphing, with annotated segments, as done in this example. + + + +## Tutorials + +Tutorials for learning about prosody manipulation and how to use ProMo are available. + +[Tutorial 1.1: Intro to ProMo]() + +[Tutorial 1.2: Pitch manipulation tutorial]() + +## Version History + +*ProMo uses semantic versioning (Major.Minor.Patch)* + +Please view [CHANGELOG.md](https://github.com/timmahrt/promo/blob/main/CHANGELOG.md) for version history. + +## Requirements + +``Python 3.3.*`` or above (or below, probably) + +My praatIO library is required and can be downloaded [here](https://github.com/timmahrt/praatIO) + +Matplotlib is required if you want to plot graphs. +[Matplotlib website](http://matplotlib.org/) + +Scipy is required if you want to use interpolation--typically if you have stylized pitch contours (in praat PitchTier format, for example) that you want to use in your morphing. +[Scipy website](http://scipy.org/) + +Matplotlib and SciPy are non-trivial to install, as they depends on several large +packages. +You can visit their websites for more information. +**I recommend the following instructions to install matplotlib** which uses *python wheels*. +These will install all required libraries in one fell swoop. + +On Mac, open a terminal and type: + + `python -m pip install matplotlib` + + `python -m pip install scipy` + +On Windows, open a cmd or powershell window and type: + + `<> -m pip install matplotlib` + + `<> -m pip install scipy` + + e.g. `C:\\python27\\python.exe -m install matplotlib` + +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:\Python27\python.exe setup.py install` + +If you are using ``Python 2.x`` or ``Python < 3.7``, you can use `Promo 1.x`. + +## Usage + +See /examples for example usages + + +## Installation + +Promo is on pypi and can be installed or upgraded from the command-line shell with pip like so:: + + `python -m pip install promo --upgrade` + +Otherwise, to manually install, after downloading the source from github, from a command-line shell, navigate to the directory containing setup.py and type:: + + `python setup.py install` + +If python is not in your path, you'll need to enter the full path e.g.:: + + `C:\Python36\python.exe setup.py install` + + +## Citing ProMo + +If you use ProMo in your research, please cite it like so: + +Tim Mahrt. ProMo: The Prosody-Morphing Library. +https://github.com/timmahrt/ProMo, 2016. + + +## Acknowledgements + +Development of ProMo 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). diff --git a/README.rst b/README.rst deleted file mode 100644 index e5b63be..0000000 --- a/README.rst +++ /dev/null @@ -1,268 +0,0 @@ - ------------------------ -ProMo (Prosody Morph) ------------------------ - -.. image:: https://travis-ci.org/timmahrt/ProMo.svg?branch=main - :target: https://travis-ci.org/timmahrt/ProMo - -.. image:: https://coveralls.io/repos/github/timmahrt/ProMo/badge.svg?branch=main - :target: https://coveralls.io/github/timmahrt/ProMo?branch=main - -.. image:: https://img.shields.io/badge/license-MIT-blue.svg? - :target: http://opensource.org/licenses/MIT - -*Questions? Comments? Feedback? Chat with us on gitter!* - -.. image:: https://badges.gitter.im/pythonProMo/Lobby.svg? - :alt: Join the chat at https://gitter.im/pythonProMo/Lobby - :target: https://gitter.im/pythonProMo/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge - ------ - -A library for manipulating pitch and duration in an algorithmic way, for -resynthesizing speech. - -This library can be used to resynthesize pitch in natural speech using pitch -contours taken from other speech samples, generated pitch contours, -or through algorithmic manipulations of the source pitch contour. - -.. sectnum:: -.. contents:: - -Documentation -============= - -Automatically generated pdocs can be found here: - -http://timmahrt.github.io/ProMo/ - - -Common Use Cases -================ - -What can you do with this library? - -Apply the pitch or duration from one speech sample to another. - -- alignment happens both in time and in hertz - - - after the morph process, the source pitch points will be at the same - absolute pitch and relative time as they are in the target file - - - time is relative to the start and stop time of the interval being - considered (e.g. the pitch value at 80% of the duration of the interval). - Relative time is used so that the source and target files don't have to - be the same length. - - - temporal morphing is a minor effect if the sampling frequency is high - but it can be significant when, for example, using a stylized pitch - contour with few pitch samples. - -- modifications can be done between entire wav files or between - corresponding intervals as specified in a textgrid or other annotation - (indicating the boundaries of words, stressed vowels, etc.) - - - the larger the file, the less useful the results are likely to be - without using a transcript of some sort - - - the transcripts do not have to match in lexical content, only in the - number of intervals (same number of words or phones, etc.) - -- modifications can be scaled (it is possible to generate a wav file with - a pitch contour that is 30% or 60% between the source and target contours). - -- can also morph the pitch range and average pitch independently. - -- resynthesis is performed by Praat. - -- pitch can be obtained from praat (such as by using praatio) - or from other sources (e.g. ESPS getF0) - -- plots of the resynthesis (such as the ones below) can be generated - - -Illustrative example -====================== - -Consider the phrase "Mary rolled the barrel". In the first recording -(examples/mary1.wav), "Mary rolled the barrel" was said in response -to a question such as "Did John roll the barrel?". On the other hand, -in the second recording (examples/mary2.wav) the utterance was said -in response to a question such as "What happened yesterday". - -"Mary" in "mary1.wav" is produced with more emphasis than in "mary2.wav". -It is longer and carries a more drammatic pitch excursion. Using -ProMo, we can make mary1.wav spoken similar to mary2.wav, even -though they were spoken in a different way and by different speakers. - -Duration and pitch carry meaning. Change these, and you can change the -meaning being conveyed. - -``Note that modifying pitch and duration too much can introduce artifacts. -Such artifacts can be heard even in pitch morphing mary1.wav to mary2.wav.`` - -Pitch morphing (examples/pitch_morph_example.py): - - The following image shows morphing of pitch from mary1.wav to mary2.wav - on a word-by-word level - in increments of 33% (33%, 66%, 100%). Note that the morph adjusts the - temporal dimension of the target signal to fit the duration of the source - signal (the source and generated contours are equally shorter - than the target contour). This occurs at the level of the file unless - the user specifies an equal number of segments to align in time - (e.g. using word-level transcriptions, as done here, or phone-level - transcriptions, etc.) - -.. image:: examples/files/mary1_mary2_f0_morph.png - :width: 500px - -With the ability to morph pitch range and average pitch, it becomes easier -to morph contours produced by different speakers: - - The following image shows four different pitch manipulations. On the - **upper left** is the raw morph. Notice that final output (black line) is - very close to the target. Differences stem from duration differences. - - However, the average pitch and pitch range are qualities of speech that - can signify differences in gender in addition to other aspects of - speaker identity. By resetting the average pitch and pitch range to - that of the source, it is possible to morph the contour while maintaining - aspects of the source speaker's identity. - - The image in the **upper right** contains a morph - followed by a reset of the average pitch to the source speaker's average - pitch. In the **bottom right** a morph followed by a reset of the speaker's - pitch range. In the **bottom right** pitch range was reset and then the - speaker's average pitch was reset. - - The longer the speech sample, the more representative the pitch range and - mean pitch will be of the speaker. In this example both are skewed higher - by the pitch accent on the first word. - - Here the average pitch of the source (a female speaker) is much higher - than the target (a male speaker) and the resulting morph sounds like it - comes from a different speaker than the source or target speakers. - The three recordings that involve resetting pitch range and/or average - pitch sound much more natural. - -.. image:: examples/files/mary1_mary2_f0_morph_compare.png - :width: 500px - -Duration morphing (examples/duration_manipulation_example.py): - - The following image shows morphing of duration from mary1.wav to mary2.wav - on a word-by-word basis in increments of 33% (33%, 66%, 100%). - This process can operate over an entire file or, similar to pitch morphing, - with annotated segments, as done in this example. - -.. image:: examples/files/mary1_mary2_dur_morph.png - :width: 500px - - -Tutorials -================ - -Tutorials for learning about prosody manipulation and how to use ProMo are available. - -`Tutorial 1.1: Intro to ProMo `_ - -`Tutorial 1.2: Pitch manipulation tutorial `_ - - -Version History -================ - -*ProMo uses semantic versioning (Major.Minor.Patch)* - -Please view `CHANGELOG.md ` for version history. - - -Requirements -============== - -``Python 3.3.*`` or above (or below, probably) - -My praatIO library is required and can be downloaded -`here `_ - -Matplotlib is required if you want to plot graphs. -`Matplotlib website `_ - -Scipy is required if you want to use interpolation--typically if you have stylized -pitch contours (in praat PitchTier format, for example) that you want to use in -your morphing). -`Scipy website `_ - -Matplotlib and SciPy are non-trivial to install, as they depends on several large -packages. You can -visit their websites for more information. **I recommend the following instructions to -install matplotlib** which uses *python wheels*. These will install all required -libraries in one fell swoop. - -On Mac, open a terminal and type: - - python -m pip install matplotlib - - python -m pip install scipy - -On Windows, open a cmd or powershell window and type: - - <> -m pip install matplotlib - - <> -m pip install scipy - - e.g. C:\\python27\\python.exe -m install matplotlib - -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:\Python27\python.exe setup.py install - -If you are using ``Python 2.x`` or ``Python < 3.7``, you can use `Promo 1.x`. - -Usage -========= - -See /examples for example usages - - -Installation -================ - -If you on Windows, you can use the installer found here (check that it is up to date though) -`Windows installer `_ - -Promo is on pypi and can be installed or upgraded from the command-line shell with pip like so:: - - python -m pip install promo --upgrade - -Otherwise, to manually install, after downloading the source from github, from a command-line shell, navigate to the directory containing setup.py and type:: - - python setup.py install - -If python is not in your path, you'll need to enter the full path e.g.:: - - C:\Python36\python.exe setup.py install - - -Citing ProMo -=============== - -If you use ProMo in your research, please cite it like so: - -Tim Mahrt. ProMo: The Prosody-Morphing Library. -https://github.com/timmahrt/ProMo, 2016. - - -Acknowledgements -================ - -Development of ProMo 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). From 6bfc22d394640fe7708f602b9dd1a6370ea1f313 Mon Sep 17 00:00:00 2001 From: Tim Mahrt Date: Sat, 15 Nov 2025 13:32:13 +0900 Subject: [PATCH 2/4] fix: remove python version not supported by github actions --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b3b1845..6e606c8 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.8", "3.9", "3.10"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} From 544eb7c45e30f94f9c00f26b8d32a1ab7f41547f Mon Sep 17 00:00:00 2001 From: Tim Mahrt Date: Sat, 15 Nov 2025 13:34:39 +0900 Subject: [PATCH 3/4] fix: rename file reference --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index eaf6eac..4bd9cc1 100644 --- a/setup.py +++ b/setup.py @@ -23,6 +23,6 @@ "Library for manipulating pitch and duration in an " "algorithmic way, for resynthesizing speech" ), - long_description=io.open("README.rst", "r", encoding="utf-8").read(), + long_description=io.open("README.md", "r", encoding="utf-8").read(), # install_requires=[], # No requirements! # requires 'from setuptools import setup' ) From 62f65dcf32ead7bf378e7f124d7137a253cc0703 Mon Sep 17 00:00:00 2001 From: Tim Mahrt Date: Sat, 15 Nov 2025 13:58:42 +0900 Subject: [PATCH 4/4] fix: add dependency --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 6e606c8..0c0fa74 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -18,7 +18,7 @@ jobs: python -m pip install --upgrade pip pip install -U pip setuptools pip install "importlib-metadata>=4.12" coveralls pytest pytest-cov - pip install matplotlib scipy + pip install matplotlib scipy praatio python setup.py install - name: Test with pytest run: |