Skip to content

Commit

Permalink
Merge pull request #110 from pettarin/devel
Browse files Browse the repository at this point in the history
Added cfw, disabled by default, works
  • Loading branch information
readbeyond authored Sep 21, 2016
2 parents bc26d2a + 76503da commit 6bbc7cf
Show file tree
Hide file tree
Showing 231 changed files with 36,262 additions and 44 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
recursive-include aeneas/cdtw *
recursive-include aeneas/cew *
recursive-include aeneas/cfw *
recursive-include aeneas/cint *
recursive-include aeneas/cmfcc *
recursive-include aeneas/cwave *
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**aeneas** is a Python/C library and a set of tools to automagically synchronize audio and text (aka forced alignment).

* Version: 1.6.0.0
* Date: 2016-09-??
* Date: 2016-09-26
* Developed by: [ReadBeyond](http://www.readbeyond.it/)
* Lead Developer: [Alberto Pettarin](http://www.albertopettarin.it/)
* License: the GNU Affero General Public License Version 3 (AGPL v3)
Expand Down Expand Up @@ -62,7 +62,7 @@ or raw AUD/CSV/SSV/TSV/TXT/XML for further processing.
3. [FFmpeg](https://www.ffmpeg.org/)
4. [eSpeak](http://espeak.sourceforge.net/)
5. Python packages `BeautifulSoup4`, `lxml`, and `numpy`
6. Python C headers to compile the Python C extensions (optional but strongly recommended)
6. Python headers to compile the Python C/C++ extensions (optional but strongly recommended)
7. A shell supporting UTF-8 (optional but strongly recommended)

### Supported Platforms
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ aeneas
synchronize audio and text (aka forced alignment).

- Version: 1.6.0.0
- Date: 2016-09-??
- Date: 2016-09-26
- Developed by: `ReadBeyond <http://www.readbeyond.it/>`__
- Lead Developer: `Alberto Pettarin <http://www.albertopettarin.it/>`__
- License: the GNU Affero General Public License Version 3 (AGPL v3)
Expand Down Expand Up @@ -75,7 +75,7 @@ System Requirements
3. `FFmpeg <https://www.ffmpeg.org/>`__
4. `eSpeak <http://espeak.sourceforge.net/>`__
5. Python packages ``BeautifulSoup4``, ``lxml``, and ``numpy``
6. Python C headers to compile the Python C extensions (optional but
6. Python headers to compile the Python C/C++ extensions (optional but
strongly recommended)
7. A shell supporting UTF-8 (optional but strongly recommended)

Expand Down
4 changes: 4 additions & 0 deletions aeneas/cew/100_run_driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ echo "Run 3"
echo ""

echo "Run 4"
./cew_driver en "Hello|World|My|Dear|Friend" /tmp/out.wav 2.0 0
echo ""

echo "Run 5"
./cew_driver en "Hello|World|My|Dear|Friend" /tmp/out.wav 2.0 1
echo ""

1 change: 1 addition & 0 deletions aeneas/cew/cew_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ void _usage(const char *prog) {
printf("\n");
printf("Example: %s en \"Hello|World|My|Dear|Friend\" /tmp/out.wav 0.0 0\n", prog);
printf(" %s en \"Hello|World|My|Dear|Friend\" /tmp/out.wav 0.0 1\n", prog);
printf(" %s en \"Hello|World|My|Dear|Friend\" /tmp/out.wav 2.0 0\n", prog);
printf(" %s en \"Hello|World|My|Dear|Friend\" /tmp/out.wav 2.0 1\n", prog);
printf("\n");
}
Expand Down
5 changes: 5 additions & 0 deletions aeneas/cfw/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build
__pycache__

*.so
cfw_driver
24 changes: 24 additions & 0 deletions aeneas/cfw/000_compile_driver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# aeneas is a Python/C library and a set of tools
# to automagically synchronize audio and text (aka forced alignment)
#
# Copyright (C) 2012-2013, Alberto Pettarin (www.albertopettarin.it)
# Copyright (C) 2013-2015, ReadBeyond Srl (www.readbeyond.it)
# Copyright (C) 2015-2016, Alberto Pettarin (www.albertopettarin.it)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

g++ cfw_driver.cc cfw_func.cc -Ifestival -lFestival -Ispeech_tools -lestools -lestbase -leststring -o cfw_driver -Wall -pedantic

47 changes: 47 additions & 0 deletions aeneas/cfw/100_run_driver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# aeneas is a Python/C library and a set of tools
# to automagically synchronize audio and text (aka forced alignment)
#
# Copyright (C) 2012-2013, Alberto Pettarin (www.albertopettarin.it)
# Copyright (C) 2013-2015, ReadBeyond Srl (www.readbeyond.it)
# Copyright (C) 2015-2016, Alberto Pettarin (www.albertopettarin.it)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

if [ ! -e cfw_driver ]
then
bash 000_compile_driver.sh
fi

echo "Run 1"
./cfw_driver
echo ""

echo "Run 2"
./cfw_driver "(language_english)" "Hello|World|My|Dear|Friend" /tmp/out.wav 0.0 0
echo ""

echo "Run 3"
./cfw_driver "(language_english)" "Hello|World|My|Dear|Friend" /tmp/out.wav 0.0 1
echo ""

echo "Run 4"
./cfw_driver "(language_english)" "Hello|World|My|Dear|Friend" /tmp/out.wav 2.0 0
echo ""

echo "Run 5"
./cfw_driver "(language_english)" "Hello|World|My|Dear|Friend" /tmp/out.wav 2.0 1
echo ""

25 changes: 25 additions & 0 deletions aeneas/cfw/800_compile_py.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# aeneas is a Python/C library and a set of tools
# to automagically synchronize audio and text (aka forced alignment)
#
# Copyright (C) 2012-2013, Alberto Pettarin (www.albertopettarin.it)
# Copyright (C) 2013-2015, ReadBeyond Srl (www.readbeyond.it)
# Copyright (C) 2015-2016, Alberto Pettarin (www.albertopettarin.it)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

rm -rf build *.so
python cfw_setup.py build_ext --inplace

24 changes: 24 additions & 0 deletions aeneas/cfw/900_clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# aeneas is a Python/C library and a set of tools
# to automagically synchronize audio and text (aka forced alignment)
#
# Copyright (C) 2012-2013, Alberto Pettarin (www.albertopettarin.it)
# Copyright (C) 2013-2015, ReadBeyond Srl (www.readbeyond.it)
# Copyright (C) 2015-2016, Alberto Pettarin (www.albertopettarin.it)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

rm -rf build __pycache__ *.so cfw_driver

22 changes: 22 additions & 0 deletions aeneas/cfw/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# aeneas.cfw

**aeneas.cfw** is a Python C extension to synthesize text with Festival.

## API

See the [__init__.py](__init__.py) file.

## Compiling the Python C extension locally

```bash
$ python cfw_setup.py build_ext --inplace
```

## Compiling the pure C driver program

```bash
$ bash 000_compile_driver.sh
```



59 changes: 59 additions & 0 deletions aeneas/cfw/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env python
# coding=utf-8

# aeneas is a Python/C library and a set of tools
# to automagically synchronize audio and text (aka forced alignment)
#
# Copyright (C) 2012-2013, Alberto Pettarin (www.albertopettarin.it)
# Copyright (C) 2013-2015, ReadBeyond Srl (www.readbeyond.it)
# Copyright (C) 2015-2016, Alberto Pettarin (www.albertopettarin.it)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""
aeneas.cfw is a Python C++ extension to synthesize text with Festival.
The only function provided by this module is:
.. function:: cfw.synthesize_multiple(output_file_path, quit_after, backwards, text)
Synthesize several text fragments into a single WAVE file.
The returned tuple ``(sr, synt, anchors)`` contains
the sample rate of the output WAVE file,
the number of fragments actually synthesized,
and a list of time values, each representing
the begin time in the output WAVE file
of the corresponding text fragment.
Note that if ``quit_after`` is specified,
the number ``synt`` of fragments actually synthesized
might be less than the number of fragments in ``text``.
:param string output_file_path: the path of the WAVE file to be created, UTF-8 encoded
:param float quit_after: stop synthesizing after reaching the given duration (in seconds)
:param int backwards: if nonzero, synthesize backwards, that is,
starting from the last fragment.
In any case, the fragments in the output WAVE file
will be in natural order.
This option is meaningful only if ``quit_after > 0``.
:param list text: a list of ``(voice_code, fragment_text)`` tuples
with the text to be synthesized.
The ``voice_code`` is the the Festival voice code
(e.g., ``(language_english)``, ``(language_scots_gaelic)``,
``(language_italian)``, etc.).
The ``fragment_text`` must be UTF-8 encoded.
:rtype: tuple
"""
Loading

0 comments on commit 6bbc7cf

Please sign in to comment.