Skip to content

Commit 7104f14

Browse files
committed
Merge pull request #56 from readbeyond/port3
Adding support for Python 3
2 parents 5e52569 + b399383 commit 7104f14

File tree

182 files changed

+10795
-6458
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+10795
-6458
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*.pyo
44
*.swp
55
*.so
6+
.pybuild
67
aeneas.egg-info
78
aeneas/build
89
bak

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
recursive-include aeneas/res *
22
recursive-include aeneas/tools/res *
33
include aeneas_check_setup.py
4+
recursive-include bin *
45
recursive-include docs *
56
prune docs/build
67
include LICENSE

README.md

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

33
**aeneas** is a Python library and a set of tools to automagically synchronize audio and text.
44

5-
* Version: 1.3.3
6-
* Date: 2015-12-20
5+
* Version: 1.4.0
6+
* Date: 2016-01-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)
@@ -75,10 +75,11 @@ or raw CSV/SSV/TSV/TXT/XML for further processing.
7575
1. a reasonably recent machine (recommended 4 GB RAM, 2 GHz 64bit CPU)
7676
2. `ffmpeg` and `ffprobe` executables available in your `$PATH`
7777
3. `espeak` executable available in your `$PATH`
78-
4. Python 2.7.x
79-
5. Python modules `BeautifulSoup`, `lxml`, and `numpy`
80-
6. (Optional, but strongly recommended) Python C headers to compile the Python C extensions
81-
7. (Optional, required only for downloading audio from YouTube) Python module `pafy`
78+
4. Python 2.7 (Linux, OS X, Windows) or 3.4 or later (Linux, OS X)
79+
5. Python modules `BeautifulSoup4`, `lxml`, and `numpy`
80+
6. (Optional, strongly recommended) Python C headers to compile the Python C extensions
81+
7. (Optional, strongly recommended if you plan to use the CLI tools) A shell supporting UTF-8
82+
8. (Optional, only required if you plan to download audio from YouTube) Python module `pafy`
8283

8384
Depending on the format(s) of audio files you work with,
8485
you might need to install additional audio codecs for `ffmpeg`.
@@ -87,38 +88,59 @@ for `espeak`, depending on the language(s) you work on.
8788
(Installing _all_ the codecs and _all_ the voices available
8889
might be a good idea.)
8990

90-
If installing the above dependencies proves difficult on your OS,
91-
you are strongly encouraged to use
92-
[aeneas-vagrant](https://github.com/readbeyond/aeneas-vagrant),
93-
which provides **aeneas** inside a virtualized Debian image
94-
running under [VirtualBox](https://www.virtualbox.org/)
95-
and [Vagrant](http://www.vagrantup.com/).
96-
9791
### Supported Platforms
9892

9993
**aeneas** has been developed and tested on **Debian 64bit**,
10094
which is the **only supported OS** at the moment.
95+
10196
(Do you need official support for another OS?
10297
Consider [sponsoring](#supporting) this project!)
10398

104-
However, **aeneas** has been confirmed to work
105-
on other Linux distributions (Ubuntu, Slackware),
106-
on Mac OS X 10.9 and 10.10,
107-
and on Windows Vista/7/8.1/10.
108-
109-
Whatever your OS is, make sure
110-
`ffmpeg`, `ffprobe` (which is part of `ffmpeg` distribution), and `espeak`
111-
are properly installed and
112-
callable by the `subprocess` Python module.
99+
However, **aeneas** has been confirmed to work on the following systems:
100+
101+
| OS | 32/64 bit | Python 2.7 | Python 3.4/3.5 |
102+
|----------------|-----------|------------|-----------------|
103+
| Debian | 64 | Yes | Yes |
104+
| Debian | 32 | Yes | Yes |
105+
| Ubuntu | 64 | Yes | Yes |
106+
| Gentoo | 64 | Yes | Unknown |
107+
| Slackware | 64 | Yes | Unknown |
108+
| Mac OS X 10.9 | 64 | Yes (1) | Unknown (1) |
109+
| Mac OS X 10.10 | 64 | Yes (1) | Unknown (1) |
110+
| Mac OS X 10.11 | 64 | Yes (1) | Unknown (1) |
111+
| Windows Vista | 32 | Yes (1) | Yes (1, 2) |
112+
| Windows 7 | 64 | Yes (1) | Yes (1, 2) |
113+
| Windows 8.1 | 64 | Yes (1) | Unknown (1, 2) |
114+
| Windows 10 | 64 | Yes (1) | Yes (1, 2) |
115+
116+
**Notes**
117+
(1) The ``cew`` Python C extension to speed up text synthesis
118+
is available only on Linux at the moment.
119+
(2) On Windows and Python 3.4/3.5, compiling the Python C extensions
120+
is quite complex; however, running **aeneas** in pure Python mode
121+
has been confirmed to work.
122+
123+
Anyway, **aeneas** should work on any OS, at least in pure Python mode,
124+
provided that:
125+
126+
1. the required Python modules `BeautifulSoup4`, `lxml`, and `numpy` are installed, and
127+
2. `ffmpeg`, `ffprobe` (which is part of `ffmpeg` distribution), and `espeak`
128+
are installed and callable by the `subprocess` Python module.
113129
A way to ensure the latter consists
114130
in adding these three executables to your `PATH` environment variable.
115131

132+
All strings and text files read by **aeneas** are expected to be UTF-8 encoded,
133+
and all text files written by **aeneas** are UTF-8 encoded.
134+
Therefore, it is strongly recommended to run the **aeneas** CLI tools
135+
on a shell with UTF-8 encoding and to convert any input text file to UTF-8.
136+
116137
If installing **aeneas** natively on your OS proves difficult,
117138
you are strongly encouraged to use
118139
[aeneas-vagrant](https://github.com/readbeyond/aeneas-vagrant),
119140
which provides **aeneas** inside a virtualized Debian image
120141
running under [VirtualBox](https://www.virtualbox.org/)
121-
and [Vagrant](http://www.vagrantup.com/).
142+
and [Vagrant](http://www.vagrantup.com/), which can be installed
143+
on any modern OS (Linux, Mac OS X, Windows).
122144

123145
### Installation
124146

@@ -127,7 +149,7 @@ and [Vagrant](http://www.vagrantup.com/).
127149
1. Make sure you have
128150
`ffmpeg`, `ffprobe` (usually provided by the `ffmpeg` package),
129151
and `espeak` installed and available on your command line.
130-
You also need Python 2.x and its "developer" package
152+
You also need Python and its "developer" package
131153
containing the C headers (`python-dev` or similar).
132154

133155
2. Install `aeneas` system-wise with `pip`:
@@ -160,7 +182,7 @@ you can install all the dependencies by downloading and running
160182
just make sure you have
161183
`ffmpeg`, `ffprobe` (usually provided by the `ffmpeg` package),
162184
and `espeak` installed and available on your command line.
163-
You also need Python 2.x and its "developer" package
185+
You also need Python and its "developer" package
164186
containing the C headers (`python-dev` or similar).
165187

166188
2. Clone the `aeneas` repo, install Python dependencies, and compile C extensions:
@@ -195,6 +217,10 @@ based on
195217
[these directions](https://groups.google.com/d/msg/aeneas-forced-alignment/p9cb1FA0X0I/8phzUgIqBAAJ),
196218
written by Richard Margetts.
197219

220+
Please note that on Windows it is recommended to run **aeneas**
221+
with Python 2.7, since compiling the C extensions on Python 3.4 or 3.5
222+
requires [a complex setup process](http://stackoverflow.com/questions/29909330/microsoft-visual-c-compiler-for-python-3-4).
223+
198224
#### Mac OS X
199225

200226
Feel free to jump to step 9 if you already have
@@ -282,55 +308,55 @@ Feel free to jump to step 9 if you already have
282308
1. Install `aeneas` as described above. (Only the first time!)
283309

284310
2. Open a command prompt/shell/terminal and go to the root directory
285-
of the aeneas repository, that is, the one containing the `README.md` and `VERSION` files.
286-
(This step is not needed if you installed `aeneas` with `pip`,
287-
since you will have the `aeneas` module available system-wise.)
311+
of the aeneas repository, that is, the one containing the `README.md` and `VERSION` files.
312+
(This step is not needed if you installed `aeneas` with `pip`,
313+
since you will have the `aeneas` module available system-wise.)
288314

289315
3. To compute a synchronization map `map.json` for a pair
290-
(`audio.mp3`, `text.txt` in `plain` text format), you can run:
316+
(`audio.mp3`, `text.txt` in `plain` text format), you can run:
291317

292318
```bash
293319
$ python -m aeneas.tools.execute_task audio.mp3 text.txt "task_language=en|os_task_file_format=json|is_text_type=plain" map.json
294320
```
295321

296-
The third parameter (the _configuration string_) can specify several parameters/options.
297-
See the [documentation](http://www.readbeyond.it/aeneas/docs/)
298-
or use the `-h` switch for details.
299-
300-
4. To compute a synchronization map `map.smil` for a pair
301-
(`audio.mp3`, `page.xhtml` containing fragments marked by `id` attributes like `f001`),
302-
you can run:
322+
To compute a synchronization map `map.smil` for a pair
323+
(`audio.mp3`, `page.xhtml` containing fragments marked by `id` attributes like `f001`),
324+
you can run:
303325

304326
```bash
305327
$ python -m aeneas.tools.execute_task audio.mp3 page.xhtml "task_language=en|os_task_file_format=smil|os_task_file_smil_audio_ref=audio.mp3|os_task_file_smil_page_ref=page.xhtml|is_text_type=unparsed|is_text_unparsed_id_regex=f[0-9]+|is_text_unparsed_id_sort=numeric" map.smil
306328
```
307329

308-
5. If you have several tasks to run,
309-
you can create a job container and a configuration file,
310-
and run them all at once:
330+
The third parameter (the _configuration string_) can specify several other parameters/options.
331+
See the [documentation](http://www.readbeyond.it/aeneas/docs/)
332+
or use the `-h` switch for details.
333+
334+
4. If you have several tasks to run,
335+
you can create a job container and a configuration file,
336+
and run them all at once:
311337

312338
```bash
313339
$ python -m aeneas.tools.execute_job job.zip /tmp/
314340
```
315341

316-
File `job.zip` should contain a `config.txt` or `config.xml`
317-
configuration file, providing **aeneas**
318-
with all the information needed to parse the input assets
319-
and format the output sync map files.
320-
See the [documentation](http://www.readbeyond.it/aeneas/docs/)
321-
or use the `-h` switch for details.
342+
File `job.zip` should contain a `config.txt` or `config.xml`
343+
configuration file, providing **aeneas**
344+
with all the information needed to parse the input assets
345+
and format the output sync map files.
346+
See the [documentation](http://www.readbeyond.it/aeneas/docs/)
347+
or use the `-h` switch for details.
322348

323-
You might want to run `execute_task` or `execute_job`
324-
with `-h` to get an usage message and some examples:
349+
5. You might want to run `execute_task` or `execute_job`
350+
with `-h` to get an usage message and some examples:
325351

326-
```bash
327-
$ python -m aeneas.tools.execute_task -h
328-
$ python -m aeneas.tools.execute_job -h
329-
```
352+
```bash
353+
$ python -m aeneas.tools.execute_task -h
354+
$ python -m aeneas.tools.execute_job -h
355+
```
330356

331-
See the [documentation](http://www.readbeyond.it/aeneas/docs/)
332-
for an introduction to the concepts of `task` and `job`,
333-
and for the list of all the available options.
357+
See the [documentation](http://www.readbeyond.it/aeneas/docs/)
358+
for an introduction to the concepts of `task` and `job`,
359+
and for the list of all the available options.
334360

335361

336362
## Documentation
@@ -366,28 +392,30 @@ Changelog: [http://www.readbeyond.it/aeneas/docs/changelog.html](http://www.read
366392
* Code suitable for a Web app deployment (e.g., on-demand AWS instances)
367393
* Adjustable splitting times, including a max character/second constraint for CC applications
368394
* Automated detection of audio head/tail
369-
* MFCC and DTW computed as Python C extensions to reduce the processing time
395+
* MFCC and DTW computed via Python C extensions to reduce the processing time
370396
* On Linux, `espeak` called via a Python C extension for faster audio synthesis
371397
* Output an HTML file (from `finetuneas` project) for fine tuning the sync map manually
372398

399+
373400
## Limitations and Missing Features
374401

375402
* Audio should match the text: large portions of spurious text or audio might produce a wrong sync map
376403
* Audio is assumed to be spoken: not suitable/YMMV for song captioning
377404
* No protection against memory trashing if you feed extremely long audio files
378405
* On Mac OS X and Windows, audio synthesis might be slow if you have thousands of text fragments
379406

407+
380408
## TODO List
381409

382410
* Improving robustness against music in background
383-
* Isolate non-speech intervals (music, prolonged silence)
411+
* Isolating non-speech intervals (music, prolonged silence)
384412
* Automated text fragmentation based on audio analysis
385413
* Auto-tuning DTW parameters
386414
* Reporting the alignment score
387415
* Improving (removing?) dependency from `espeak`, `ffmpeg`, `ffprobe` executables
388416
* Multilevel sync map granularity (e.g., multilevel SMIL output)
389417
* Better documentation
390-
* Testing other approaches, like HMM
418+
* Testing other approaches, like GMM/HMM/NN (e.g., using HTK or Kaldi)
391419
* Publishing the package on Debian repo
392420

393421
Would you like to see one of the above points done?
@@ -572,6 +600,9 @@ of downloading audio from YouTube
572600
for the first time available
573601
also on [PyPI](https://pypi.python.org/pypi/aeneas/)
574602

603+
**January 2016**: release of v1.4.0,
604+
supporting both Python 2.7 and 3.4 or later
605+
575606
## Acknowledgments
576607

577608
Many thanks to **Nicola Montecchio**,

0 commit comments

Comments
 (0)