Skip to content

Commit

Permalink
Merge pull request #82 from readbeyond/devel
Browse files Browse the repository at this point in the history
Fixing the index issue in dtw
  • Loading branch information
readbeyond committed Apr 9, 2016
2 parents d8666b8 + 426590b commit d997639
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

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

* Version: 1.5.0
* Date: 2016-04-02
* Version: 1.5.0.2
* Date: 2016-04-09
* 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)
* Contact: [aeneas@readbeyond.it](mailto:aeneas@readbeyond.it)
* Quick Links: [Home](http://www.readbeyond.it/aeneas/) - [GitHub](https://github.com/readbeyond/aeneas/) - [PyPI](https://pypi.python.org/pypi/aeneas/) - [Docs](http://www.readbeyond.it/aeneas/docs/) - [Tutorial](http://www.readbeyond.it/aeneas/docs/clitutorial.html) - [Mailing List](https://groups.google.com/d/forum/aeneas-forced-alignment) - [Web App](http://aeneasweb.org)
* Quick Links: [Home](http://www.readbeyond.it/aeneas/) - [GitHub](https://github.com/readbeyond/aeneas/) - [PyPI](https://pypi.python.org/pypi/aeneas/) - [Docs](http://www.readbeyond.it/aeneas/docs/) - [Tutorial](http://www.readbeyond.it/aeneas/docs/clitutorial.html) - [Benchmark](https://readbeyond.github.io/aeneas-benchmark/) - [Mailing List](https://groups.google.com/d/forum/aeneas-forced-alignment) - [Web App](http://aeneasweb.org)


## Goal
Expand Down Expand Up @@ -206,10 +206,12 @@ which explains how to use the built-in command line tools.
[https://groups.google.com/d/forum/aeneas-forced-alignment](https://groups.google.com/d/forum/aeneas-forced-alignment)
* Changelog:
[http://www.readbeyond.it/aeneas/docs/changelog.html](http://www.readbeyond.it/aeneas/docs/changelog.html)
* High level description of how **aeneas** works:
* High level description of how aeneas works:
[HOWITWORKS](https://github.com/readbeyond/aeneas/blob/master/wiki/HOWITWORKS.md)
* Development history:
[HISTORY](https://github.com/readbeyond/aeneas/blob/master/wiki/HISTORY.md)
* Benchmark suite:
[https://readbeyond.github.io/aeneas-benchmark/](https://readbeyond.github.io/aeneas-benchmark/)
## Supported Features
Expand Down
10 changes: 6 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.5.0
- Date: 2016-04-02
- Version: 1.5.0.2
- Date: 2016-04-09
- 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 All @@ -15,7 +15,8 @@ synchronize audio and text (aka forced alignment).
`PyPI <https://pypi.python.org/pypi/aeneas/>`__ -
`Docs <http://www.readbeyond.it/aeneas/docs/>`__ -
`Tutorial <http://www.readbeyond.it/aeneas/docs/clitutorial.html>`__
- `Mailing
- `Benchmark <https://readbeyond.github.io/aeneas-benchmark/>`__ -
`Mailing
List <https://groups.google.com/d/forum/aeneas-forced-alignment>`__ -
`Web App <http://aeneasweb.org>`__

Expand Down Expand Up @@ -208,10 +209,11 @@ Documentation and Support
- Mailing list:
https://groups.google.com/d/forum/aeneas-forced-alignment
- Changelog: http://www.readbeyond.it/aeneas/docs/changelog.html
- High level description of how **aeneas** works:
- High level description of how aeneas works:
`HOWITWORKS <https://github.com/readbeyond/aeneas/blob/master/wiki/HOWITWORKS.md>`__
- Development history:
`HISTORY <https://github.com/readbeyond/aeneas/blob/master/wiki/HISTORY.md>`__
- Benchmark suite: https://readbeyond.github.io/aeneas-benchmark/

Supported Features
------------------
Expand Down
13 changes: 12 additions & 1 deletion aeneas/dtw.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,22 @@ def compute_boundaries(self, synt_anchors):
# synt_anchors as in seconds, convert them in MFCC indices
mws = self.rconf.mws
anchor_indices = numpy.array([int(a[0] / mws) for a in synt_anchors])
#
# right side sets the split point at the very beginning of "next" fragment
begin_indices = numpy.searchsorted(synt_indices, anchor_indices, side="right")
#
# NOTE clip() is needed since searchsorted() with side="right" might return
# an index == len(synt_indices) == len(real_indices)
# when the insertion point is past the last element of synt_indices
# causing the fancy indexing real_indices[...] below might fail
begin_indices = numpy.clip(numpy.searchsorted(synt_indices, anchor_indices, side="right"), 0, len(synt_indices)-1)
# first split must occur at zero
begin_indices[0] = 0
#
# map onto real indices, obtaining "default" boundary indices
#
# NOTE since len(synt_indices) == len(real_indices)
# and because the numpy.clip() above, the fancy indexing is always valid
#
boundary_indices = numpy.append(real_indices[begin_indices], self.real_wave_mfcc.tail_begin)
self.log([u"Boundary indices: %d", len(boundary_indices)])
self.log(u"Computing boundary indices... done")
Expand Down
10 changes: 10 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Changelog
=========

v1.5.0.2 (2016-04-09)
---------------------

#. Fix an issue in ``dtw`` with ``numpy.searchsorted`` returning an invalid index

v1.5.0.1 (2016-04-03)
---------------------

#. Fix an issue with compiling C extensions on Windows

v1.5.0 (2016-04-02)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"aeneas.extra": ["*.md"],
"aeneas.tools": ["res/*", "*.md"]
},
version="1.5.0.1",
version="1.5.0.2",
description=SHORT_DESCRIPTION,
author="Alberto Pettarin",
author_email="alberto@albertopettarin.it",
Expand Down

0 comments on commit d997639

Please sign in to comment.