Skip to content

Commit 9d95535

Browse files
authored
Merge pull request #171 from readbeyond/devel
Fix bug #168
2 parents fb1e315 + 66948d9 commit 9d95535

35 files changed

+107
-35
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

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

5-
* Version: 1.7.2
6-
* Date: 2017-03-03
5+
* Version: 1.7.3
6+
* Date: 2017-03-15
77
* Developed by: [ReadBeyond](http://www.readbeyond.it/)
88
* Lead Developer: [Alberto Pettarin](http://www.albertopettarin.it/)
99
* License: the GNU Affero General Public License Version 3 (AGPL v3)
@@ -316,7 +316,7 @@ No copy rights were harmed in the making of this project.
316316
317317
* **April 2016**: the Fruch Foundation kindly sponsored the development and documentation of v1.5.0
318318
319-
* **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
319+
* **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
320320
321321
### Supporting
322322

README.rst

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ aeneas
44
**aeneas** is a Python/C library and a set of tools to automagically
55
synchronize audio and text (aka forced alignment).
66

7-
- Version: 1.7.2
8-
- Date: 2017-03-03
7+
- Version: 1.7.3
8+
- Date: 2017-03-15
99
- Developed by: `ReadBeyond <http://www.readbeyond.it/>`__
1010
- Lead Developer: `Alberto Pettarin <http://www.albertopettarin.it/>`__
1111
- License: the GNU Affero General Public License Version 3 (AGPL v3)
@@ -359,8 +359,7 @@ Sponsors
359359

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

365364
Supporting
366365
~~~~~~~~~~

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.7.2
1+
1.7.3

aeneas/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@
3535
"""
3636
__license__ = "GNU AGPL v3"
3737
__status__ = "Production"
38-
__version__ = "1.7.2"
38+
__version__ = "1.7.3"

aeneas/audiofile.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,12 @@ def __init__(self, file_path=None, file_format=None, rconf=None, logger=None):
209209
self.__samples = None
210210

211211
def __unicode__(self):
212+
fmt = self.file_format
213+
if isinstance(fmt, tuple):
214+
fmt = u"%s %d %d" % fmt
212215
msg = [
213216
u"File path: %s" % self.file_path,
214-
u"File format: %s" % self.file_format,
217+
u"File format: %s" % fmt,
215218
u"File size (bytes): %s" % gf.safe_int(self.file_size),
216219
u"Audio length (s): %s" % gf.safe_float(self.audio_length),
217220
u"Audio format: %s" % self.audio_format,
@@ -644,4 +647,7 @@ def _update_length(self):
644647
This function fails silently if one of the two is ``None``.
645648
"""
646649
if (self.audio_sample_rate is not None) and (self.__samples is not None):
647-
self.audio_length = TimeValue(self.__samples_length / self.audio_sample_rate)
650+
# NOTE computing TimeValue (... / ...) yields wrong results,
651+
# see issue #168
652+
# self.audio_length = TimeValue(self.__samples_length / self.audio_sample_rate)
653+
self.audio_length = TimeValue(self.__samples_length) / TimeValue(self.audio_sample_rate)

aeneas/cdtw/cdtw_setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
setup(
5151
name="cdtw",
52-
version="1.7.2",
52+
version="1.7.3",
5353
description="Python C Extension for computing the DTW as fast as your bare metal allows.",
5454
ext_modules=[CMODULE],
5555
include_dirs=[misc_util.get_numpy_include_dirs()]

aeneas/cew/cew_setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
setup(
4949
name="cew",
50-
version="1.7.2",
50+
version="1.7.3",
5151
description="Python C Extension for synthesizing text with eSpeak.",
5252
ext_modules=[CMODULE]
5353
)

aeneas/cfw/cfw_setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
setup(
5656
name="cfw",
57-
version="1.7.2",
57+
version="1.7.3",
5858
description="Python C Extension for synthesizing text with Festival.",
5959
ext_modules=[CMODULE]
6060
)

aeneas/cmfcc/cmfcc_setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
setup(
5252
name="cmfcc",
53-
version="1.7.2",
53+
version="1.7.3",
5454
description="Python C Extension for computing the MFCCs as fast as your bare metal allows.",
5555
ext_modules=[CMODULE],
5656
include_dirs=[misc_util.get_numpy_include_dirs()]

aeneas/cwave/cwave_setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
setup(
5151
name="cwave",
52-
version="1.7.2",
52+
version="1.7.3",
5353
description="Python C Extension for for reading WAVE files.",
5454
ext_modules=[CMODULE],
5555
include_dirs=[misc_util.get_numpy_include_dirs()]

aeneas/tests/long_test_task_parameters.py

+8
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,14 @@ def test_exec_os_task_file_levels_123(self):
354354
("out", "sonnet.json")
355355
], 0)
356356

357+
def test_exec_exact_5600_16000_munparsed_issue_168(self):
358+
self.execute([
359+
("in", "../tests/res/audioformats/exact.5600.16000.wav"),
360+
("in", "../tests/res/inputtext/exact.5600.16000.munparsed.xhtml"),
361+
("", "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]+"),
362+
("out", "sonnet.json")
363+
], 0)
364+
357365

358366
if __name__ == "__main__":
359367
unittest.main()
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" lang="en" xml:lang="en">
3+
<head>
4+
<meta charset="utf-8"/>
5+
<meta name="viewport" content="width=768,height=1024"/>
6+
<link rel="stylesheet" href="../Styles/style.css" type="text/css"/>
7+
<title>Sonnet I</title>
8+
</head>
9+
<body>
10+
<div id="divSonnet">
11+
<p class="stanza" id="p000002">
12+
<span id="p000002s000001">
13+
<span id="p000002s000001w000000">1</span>
14+
<span id="p000002s000001w000001">From</span>
15+
<span id="p000002s000001w000002">fairest</span>
16+
<span id="p000002s000001w000003">creatures</span>
17+
<span id="p000002s000001w000004">we</span>
18+
<span id="p000002s000001w000005">desire</span>
19+
<span id="p000002s000001w000006">increase,</span>
20+
<span id="p000002s000001w000007">That</span>
21+
<span id="p000002s000001w000008">thereby</span>
22+
<span id="p000002s000001w000009">beauty’s</span>
23+
<span id="p000002s000001w000010">rose</span>
24+
<span id="p000002s000001w000011">might</span>
25+
<span id="p000002s000001w000012">never</span>
26+
<span id="p000002s000001w000013">die,</span>
27+
</span>
28+
</p>
29+
</div>
30+
</body>
31+
</html>
32+

aeneas/tests/test_audiofile.py

+6
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class TestAudioFile(unittest.TestCase):
3636
AUDIO_FILE_WAVE = "res/audioformats/mono.16000.wav"
3737
AUDIO_FILE_EMPTY = "res/audioformats/p001.empty"
3838
AUDIO_FILE_NOT_WAVE = "res/audioformats/p001.mp3"
39+
AUDIO_FILE_EXACT = "res/audioformats/exact.5600.16000.wav"
3940
NOT_EXISTING_FILE = "res/audioformats/x/y/z/not_existing.wav"
4041
FILES = [
4142
{
@@ -163,6 +164,11 @@ def test_length(self):
163164
audiofile.clear_data()
164165
self.assertAlmostEqual(audiofile.audio_length, TimeValue("53.3"), places=1) # 53.266
165166

167+
def test_length_exact(self):
168+
audiofile = self.load(self.AUDIO_FILE_EXACT, rs=True)
169+
audiofile.clear_data()
170+
self.assertAlmostEqual(audiofile.audio_length, TimeValue("5.600"), places=3) # 5.600
171+
166172
def test_add_samples_file(self):
167173
audiofile = self.load(self.AUDIO_FILE_WAVE, rs=True)
168174
data = audiofile.audio_samples

aeneas/tests/tool_test_read_audio.py

+12
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,23 @@ def test_read_audio(self):
5656
("in", "../tools/res/audio.wav")
5757
], 0)
5858

59+
def test_read_audio_full(self):
60+
self.execute([
61+
("in", "../tools/res/audio.wav"),
62+
("", "-f")
63+
], 0)
64+
5965
def test_read_audio_mp3(self):
6066
self.execute([
6167
("in", "../tools/res/audio.mp3")
6268
], 0)
6369

70+
def test_read_audio_mp3_full(self):
71+
self.execute([
72+
("in", "../tools/res/audio.mp3"),
73+
("", "-f")
74+
], 0)
75+
6476
def test_read_audio_path(self):
6577
path = os.path.expanduser("~")
6678
path = os.path.join(path, ".bin/myffprobe")

aeneas/tools/read_audio.py

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class ReadAudioCLI(AbstractCLIProgram):
5151
(u"AUDIO_FILE", True)
5252
],
5353
"options": [
54+
u"-f, --full : load samples from file, possibly converting to WAVE"
5455
],
5556
"parameters": [
5657
],
@@ -72,6 +73,8 @@ def perform_command(self):
7273
try:
7374
audiofile = AudioFile(audio_file_path, rconf=self.rconf, logger=self.logger)
7475
audiofile.read_properties()
76+
if self.has_option([u"-f", u"--full"]):
77+
audiofile.read_samples_from_file()
7578
self.print_generic(audiofile.__unicode__())
7679
return self.NO_ERROR_EXIT_CODE
7780
except OSError:

aeneas_check_setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"""
4545
__license__ = "GNU AGPL 3"
4646
__status__ = "Production"
47-
__version__ = "1.7.2"
47+
__version__ = "1.7.3"
4848

4949
ANSI_ERROR = u"\033[91m"
5050
ANSI_OK = u"\033[92m"

bin/aeneas_check_setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"""
4545
__license__ = "GNU AGPL 3"
4646
__status__ = "Production"
47-
__version__ = "1.7.2"
47+
__version__ = "1.7.3"
4848

4949
ANSI_ERROR = u"\033[91m"
5050
ANSI_OK = u"\033[92m"

bin/aeneas_convert_syncmap.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"""
4141
__license__ = "GNU AGPL 3"
4242
__status__ = "Production"
43-
__version__ = "1.7.2"
43+
__version__ = "1.7.3"
4444

4545

4646
def main():

bin/aeneas_download.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"""
4141
__license__ = "GNU AGPL 3"
4242
__status__ = "Production"
43-
__version__ = "1.7.2"
43+
__version__ = "1.7.3"
4444

4545

4646
def main():

bin/aeneas_execute_job.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"""
4343
__license__ = "GNU AGPL 3"
4444
__status__ = "Production"
45-
__version__ = "1.7.2"
45+
__version__ = "1.7.3"
4646

4747

4848
def main():

bin/aeneas_execute_task.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"""
4242
__license__ = "GNU AGPL 3"
4343
__status__ = "Production"
44-
__version__ = "1.7.2"
44+
__version__ = "1.7.3"
4545

4646

4747
def main():

bin/aeneas_plot_waveform.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"""
4141
__license__ = "GNU AGPL 3"
4242
__status__ = "Production"
43-
__version__ = "1.7.2"
43+
__version__ = "1.7.3"
4444

4545

4646
def main():

bin/aeneas_synthesize_text.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"""
4242
__license__ = "GNU AGPL 3"
4343
__status__ = "Production"
44-
__version__ = "1.7.2"
44+
__version__ = "1.7.3"
4545

4646

4747
def main():

bin/aeneas_validate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"""
4848
__license__ = "GNU AGPL 3"
4949
__status__ = "Production"
50-
__version__ = "1.7.2"
50+
__version__ = "1.7.3"
5151

5252

5353
def main():

check_dependencies.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"""
4545
__license__ = "GNU AGPL 3"
4646
__status__ = "Production"
47-
__version__ = "1.7.2"
47+
__version__ = "1.7.3"
4848

4949
ANSI_ERROR = u"\033[91m"
5050
ANSI_OK = u"\033[92m"

docs/source/changelog.rst

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changelog
22
=========
33

4+
v1.7.3 (2017-03-15)
5+
-------------------
6+
7+
#. Fixed bug #168 and added a regression test for it
8+
#. Added option ``-f, --full`` to ``aeneas.tools.read_audio`` and tests for it
9+
410
v1.7.2 (2017-03-03)
511
-------------------
612

docs/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
# The short X.Y version.
6161
version = '1.7'
6262
# The full version, including alpha/beta/rc tags.
63-
release = '1.7.2'
63+
release = '1.7.3'
6464

6565
# The language for content autogenerated by Sphinx. Refer to documentation
6666
# for a list of supported languages.

install_dependencies.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# Copyright 2015-2017, Alberto Pettarin (www.albertopettarin.it)
88
# """
99
# __license__ = "GNU AGPL 3"
10-
# __version__ = "1.7.2"
10+
# __version__ = "1.7.3"
1111
# __email__ = "[email protected]"
1212
# __status__ = "Production"
1313

pyinstaller-aeneas-cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"""
4343
__license__ = "GNU AGPL 3"
4444
__status__ = "Production"
45-
__version__ = "1.7.2"
45+
__version__ = "1.7.3"
4646

4747

4848
def main():

pyinstaller-onedir.spec

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#"""
1010
#__license__ = "GNU AGPL 3"
1111
#__status__ = "Production"
12-
#__version__ = "1.7.2"
12+
#__version__ = "1.7.3"
1313

1414
datas = [
1515
# required

pyinstaller-onefile.spec

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#"""
1010
#__license__ = "GNU AGPL 3"
1111
#__status__ = "Production"
12-
#__version__ = "1.7.2"
12+
#__version__ = "1.7.3"
1313

1414
datas = [
1515
# required

run_all_unit_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"""
4242
__license__ = "GNU AGPL 3"
4343
__status__ = "Production"
44-
__version__ = "1.7.2"
44+
__version__ = "1.7.3"
4545

4646
TEST_DIRECTORY = "aeneas/tests"
4747
MAP = {

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"""
5858
__license__ = "GNU AGPL 3"
5959
__status__ = "Production"
60-
__version__ = "1.7.2"
60+
__version__ = "1.7.3"
6161

6262

6363
##############################################################################

0 commit comments

Comments
 (0)