Skip to content

Commit

Permalink
Merge pull request #171 from readbeyond/devel
Browse files Browse the repository at this point in the history
Fix bug #168
  • Loading branch information
readbeyond authored Mar 16, 2017
2 parents fb1e315 + 66948d9 commit 9d95535
Show file tree
Hide file tree
Showing 35 changed files with 107 additions and 35 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

**aeneas** is a Python/C library and a set of tools to automagically synchronize audio and text (aka forced alignment).

* Version: 1.7.2
* Date: 2017-03-03
* Version: 1.7.3
* Date: 2017-03-15
* 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 @@ -316,7 +316,7 @@ No copy rights were harmed in the making of this project.
* **April 2016**: the Fruch Foundation kindly sponsored the development and documentation of v1.5.0
* **December 2016**: the [Centro Internazionale Del Libro Parlato "Adriano Sernagiotto"](http://www.libroparlato.org/) (Feltre, Italy) partially sponsored the development of v1.7.0, v1.7.1, and v1.7.2
* **December 2016**: the [Centro Internazionale Del Libro Parlato "Adriano Sernagiotto"](http://www.libroparlato.org/) (Feltre, Italy) partially sponsored the development of the v1.7 series
### Supporting
Expand Down
7 changes: 3 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ aeneas
**aeneas** is a Python/C library and a set of tools to automagically
synchronize audio and text (aka forced alignment).

- Version: 1.7.2
- Date: 2017-03-03
- Version: 1.7.3
- Date: 2017-03-15
- 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 @@ -359,8 +359,7 @@ Sponsors

- **December 2016**: the `Centro Internazionale Del Libro Parlato
"Adriano Sernagiotto" <http://www.libroparlato.org/>`__ (Feltre,
Italy) partially sponsored the development of v1.7.0, v1.7.1, and
v1.7.2
Italy) partially sponsored the development of the v1.7 series

Supporting
~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.7.2
1.7.3
2 changes: 1 addition & 1 deletion aeneas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
"""
__license__ = "GNU AGPL v3"
__status__ = "Production"
__version__ = "1.7.2"
__version__ = "1.7.3"
10 changes: 8 additions & 2 deletions aeneas/audiofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,12 @@ def __init__(self, file_path=None, file_format=None, rconf=None, logger=None):
self.__samples = None

def __unicode__(self):
fmt = self.file_format
if isinstance(fmt, tuple):
fmt = u"%s %d %d" % fmt
msg = [
u"File path: %s" % self.file_path,
u"File format: %s" % self.file_format,
u"File format: %s" % fmt,
u"File size (bytes): %s" % gf.safe_int(self.file_size),
u"Audio length (s): %s" % gf.safe_float(self.audio_length),
u"Audio format: %s" % self.audio_format,
Expand Down Expand Up @@ -644,4 +647,7 @@ def _update_length(self):
This function fails silently if one of the two is ``None``.
"""
if (self.audio_sample_rate is not None) and (self.__samples is not None):
self.audio_length = TimeValue(self.__samples_length / self.audio_sample_rate)
# NOTE computing TimeValue (... / ...) yields wrong results,
# see issue #168
# self.audio_length = TimeValue(self.__samples_length / self.audio_sample_rate)
self.audio_length = TimeValue(self.__samples_length) / TimeValue(self.audio_sample_rate)
2 changes: 1 addition & 1 deletion aeneas/cdtw/cdtw_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

setup(
name="cdtw",
version="1.7.2",
version="1.7.3",
description="Python C Extension for computing the DTW as fast as your bare metal allows.",
ext_modules=[CMODULE],
include_dirs=[misc_util.get_numpy_include_dirs()]
Expand Down
2 changes: 1 addition & 1 deletion aeneas/cew/cew_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

setup(
name="cew",
version="1.7.2",
version="1.7.3",
description="Python C Extension for synthesizing text with eSpeak.",
ext_modules=[CMODULE]
)
Expand Down
2 changes: 1 addition & 1 deletion aeneas/cfw/cfw_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

setup(
name="cfw",
version="1.7.2",
version="1.7.3",
description="Python C Extension for synthesizing text with Festival.",
ext_modules=[CMODULE]
)
Expand Down
2 changes: 1 addition & 1 deletion aeneas/cmfcc/cmfcc_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

setup(
name="cmfcc",
version="1.7.2",
version="1.7.3",
description="Python C Extension for computing the MFCCs as fast as your bare metal allows.",
ext_modules=[CMODULE],
include_dirs=[misc_util.get_numpy_include_dirs()]
Expand Down
2 changes: 1 addition & 1 deletion aeneas/cwave/cwave_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

setup(
name="cwave",
version="1.7.2",
version="1.7.3",
description="Python C Extension for for reading WAVE files.",
ext_modules=[CMODULE],
include_dirs=[misc_util.get_numpy_include_dirs()]
Expand Down
8 changes: 8 additions & 0 deletions aeneas/tests/long_test_task_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,14 @@ def test_exec_os_task_file_levels_123(self):
("out", "sonnet.json")
], 0)

def test_exec_exact_5600_16000_munparsed_issue_168(self):
self.execute([
("in", "../tests/res/audioformats/exact.5600.16000.wav"),
("in", "../tests/res/inputtext/exact.5600.16000.munparsed.xhtml"),
("", "task_language=eng|is_text_type=munparsed|os_task_file_format=json|is_text_munparsed_l1_id_regex=p[0-9]+|is_text_munparsed_l2_id_regex=p[0-9]+s[0-9]+|is_text_munparsed_l3_id_regex=p[0-9]+s[0-9]+w[0-9]+"),
("out", "sonnet.json")
], 0)


if __name__ == "__main__":
unittest.main()
Binary file not shown.
32 changes: 32 additions & 0 deletions aeneas/tests/res/inputtext/exact.5600.16000.munparsed.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" lang="en" xml:lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=768,height=1024"/>
<link rel="stylesheet" href="../Styles/style.css" type="text/css"/>
<title>Sonnet I</title>
</head>
<body>
<div id="divSonnet">
<p class="stanza" id="p000002">
<span id="p000002s000001">
<span id="p000002s000001w000000">1</span>
<span id="p000002s000001w000001">From</span>
<span id="p000002s000001w000002">fairest</span>
<span id="p000002s000001w000003">creatures</span>
<span id="p000002s000001w000004">we</span>
<span id="p000002s000001w000005">desire</span>
<span id="p000002s000001w000006">increase,</span>
<span id="p000002s000001w000007">That</span>
<span id="p000002s000001w000008">thereby</span>
<span id="p000002s000001w000009">beauty’s</span>
<span id="p000002s000001w000010">rose</span>
<span id="p000002s000001w000011">might</span>
<span id="p000002s000001w000012">never</span>
<span id="p000002s000001w000013">die,</span>
</span>
</p>
</div>
</body>
</html>

6 changes: 6 additions & 0 deletions aeneas/tests/test_audiofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class TestAudioFile(unittest.TestCase):
AUDIO_FILE_WAVE = "res/audioformats/mono.16000.wav"
AUDIO_FILE_EMPTY = "res/audioformats/p001.empty"
AUDIO_FILE_NOT_WAVE = "res/audioformats/p001.mp3"
AUDIO_FILE_EXACT = "res/audioformats/exact.5600.16000.wav"
NOT_EXISTING_FILE = "res/audioformats/x/y/z/not_existing.wav"
FILES = [
{
Expand Down Expand Up @@ -163,6 +164,11 @@ def test_length(self):
audiofile.clear_data()
self.assertAlmostEqual(audiofile.audio_length, TimeValue("53.3"), places=1) # 53.266

def test_length_exact(self):
audiofile = self.load(self.AUDIO_FILE_EXACT, rs=True)
audiofile.clear_data()
self.assertAlmostEqual(audiofile.audio_length, TimeValue("5.600"), places=3) # 5.600

def test_add_samples_file(self):
audiofile = self.load(self.AUDIO_FILE_WAVE, rs=True)
data = audiofile.audio_samples
Expand Down
12 changes: 12 additions & 0 deletions aeneas/tests/tool_test_read_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,23 @@ def test_read_audio(self):
("in", "../tools/res/audio.wav")
], 0)

def test_read_audio_full(self):
self.execute([
("in", "../tools/res/audio.wav"),
("", "-f")
], 0)

def test_read_audio_mp3(self):
self.execute([
("in", "../tools/res/audio.mp3")
], 0)

def test_read_audio_mp3_full(self):
self.execute([
("in", "../tools/res/audio.mp3"),
("", "-f")
], 0)

def test_read_audio_path(self):
path = os.path.expanduser("~")
path = os.path.join(path, ".bin/myffprobe")
Expand Down
3 changes: 3 additions & 0 deletions aeneas/tools/read_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class ReadAudioCLI(AbstractCLIProgram):
(u"AUDIO_FILE", True)
],
"options": [
u"-f, --full : load samples from file, possibly converting to WAVE"
],
"parameters": [
],
Expand All @@ -72,6 +73,8 @@ def perform_command(self):
try:
audiofile = AudioFile(audio_file_path, rconf=self.rconf, logger=self.logger)
audiofile.read_properties()
if self.has_option([u"-f", u"--full"]):
audiofile.read_samples_from_file()
self.print_generic(audiofile.__unicode__())
return self.NO_ERROR_EXIT_CODE
except OSError:
Expand Down
2 changes: 1 addition & 1 deletion aeneas_check_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"""
__license__ = "GNU AGPL 3"
__status__ = "Production"
__version__ = "1.7.2"
__version__ = "1.7.3"

ANSI_ERROR = u"\033[91m"
ANSI_OK = u"\033[92m"
Expand Down
2 changes: 1 addition & 1 deletion bin/aeneas_check_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"""
__license__ = "GNU AGPL 3"
__status__ = "Production"
__version__ = "1.7.2"
__version__ = "1.7.3"

ANSI_ERROR = u"\033[91m"
ANSI_OK = u"\033[92m"
Expand Down
2 changes: 1 addition & 1 deletion bin/aeneas_convert_syncmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"""
__license__ = "GNU AGPL 3"
__status__ = "Production"
__version__ = "1.7.2"
__version__ = "1.7.3"


def main():
Expand Down
2 changes: 1 addition & 1 deletion bin/aeneas_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"""
__license__ = "GNU AGPL 3"
__status__ = "Production"
__version__ = "1.7.2"
__version__ = "1.7.3"


def main():
Expand Down
2 changes: 1 addition & 1 deletion bin/aeneas_execute_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"""
__license__ = "GNU AGPL 3"
__status__ = "Production"
__version__ = "1.7.2"
__version__ = "1.7.3"


def main():
Expand Down
2 changes: 1 addition & 1 deletion bin/aeneas_execute_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"""
__license__ = "GNU AGPL 3"
__status__ = "Production"
__version__ = "1.7.2"
__version__ = "1.7.3"


def main():
Expand Down
2 changes: 1 addition & 1 deletion bin/aeneas_plot_waveform.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"""
__license__ = "GNU AGPL 3"
__status__ = "Production"
__version__ = "1.7.2"
__version__ = "1.7.3"


def main():
Expand Down
2 changes: 1 addition & 1 deletion bin/aeneas_synthesize_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"""
__license__ = "GNU AGPL 3"
__status__ = "Production"
__version__ = "1.7.2"
__version__ = "1.7.3"


def main():
Expand Down
2 changes: 1 addition & 1 deletion bin/aeneas_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"""
__license__ = "GNU AGPL 3"
__status__ = "Production"
__version__ = "1.7.2"
__version__ = "1.7.3"


def main():
Expand Down
2 changes: 1 addition & 1 deletion check_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"""
__license__ = "GNU AGPL 3"
__status__ = "Production"
__version__ = "1.7.2"
__version__ = "1.7.3"

ANSI_ERROR = u"\033[91m"
ANSI_OK = u"\033[92m"
Expand Down
6 changes: 6 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

v1.7.3 (2017-03-15)
-------------------

#. Fixed bug #168 and added a regression test for it
#. Added option ``-f, --full`` to ``aeneas.tools.read_audio`` and tests for it

v1.7.2 (2017-03-03)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
# The short X.Y version.
version = '1.7'
# The full version, including alpha/beta/rc tags.
release = '1.7.2'
release = '1.7.3'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright 2015-2017, Alberto Pettarin (www.albertopettarin.it)
# """
# __license__ = "GNU AGPL 3"
# __version__ = "1.7.2"
# __version__ = "1.7.3"
# __email__ = "[email protected]"
# __status__ = "Production"

Expand Down
2 changes: 1 addition & 1 deletion pyinstaller-aeneas-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"""
__license__ = "GNU AGPL 3"
__status__ = "Production"
__version__ = "1.7.2"
__version__ = "1.7.3"


def main():
Expand Down
2 changes: 1 addition & 1 deletion pyinstaller-onedir.spec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#"""
#__license__ = "GNU AGPL 3"
#__status__ = "Production"
#__version__ = "1.7.2"
#__version__ = "1.7.3"

datas = [
# required
Expand Down
2 changes: 1 addition & 1 deletion pyinstaller-onefile.spec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#"""
#__license__ = "GNU AGPL 3"
#__status__ = "Production"
#__version__ = "1.7.2"
#__version__ = "1.7.3"

datas = [
# required
Expand Down
2 changes: 1 addition & 1 deletion run_all_unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"""
__license__ = "GNU AGPL 3"
__status__ = "Production"
__version__ = "1.7.2"
__version__ = "1.7.3"

TEST_DIRECTORY = "aeneas/tests"
MAP = {
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"""
__license__ = "GNU AGPL 3"
__status__ = "Production"
__version__ = "1.7.2"
__version__ = "1.7.3"


##############################################################################
Expand Down
Loading

0 comments on commit 9d95535

Please sign in to comment.