Skip to content

Commit

Permalink
Input reference length instead of reference ndarray in align_delayed_…
Browse files Browse the repository at this point in the history
…signal_with_reference
  • Loading branch information
iver56 committed May 11, 2024
1 parent a6a4c75 commit 28fd0d3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions fast_align_audio/alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,15 @@ def find_best_alignment_offset(


def align_delayed_signal_with_reference(
reference_signal: NDArray[np.float32],
reference_length: int,
delayed_signal: NDArray[np.float32],
offset: int,
) -> Tuple[NDArray[np.float32], List[Tuple[int, int]]]:
"""
Align delayed_signal with the reference signal, given the offset.
The offset denotes the amount of samples the delayed_signal is delayed compared to
the reference_signal.
the reference signal.
The start or end is filled with `offset` amount of zeros.
Expand All @@ -172,7 +172,9 @@ def align_delayed_signal_with_reference(
the edges.
"""
assert type(offset) == int, "offset must be an int"
placeholder = np.zeros_like(reference_signal)
placeholder_shape = list(delayed_signal.shape)
placeholder_shape[-1] = reference_length
placeholder = np.zeros(shape=placeholder_shape, dtype=delayed_signal.dtype)
gaps = []
if offset < 0:
abs_offset = -offset
Expand Down

0 comments on commit 28fd0d3

Please sign in to comment.