Skip to content

Fix incorrect error message in Istft layer validation#15

Open
Nepomuk5665 wants to merge 1 commit into
spotify:mainfrom
Nepomuk5665:fix-istft-error-message
Open

Fix incorrect error message in Istft layer validation#15
Nepomuk5665 wants to merge 1 commit into
spotify:mainfrom
Nepomuk5665:fix-istft-error-message

Conversation

@Nepomuk5665

Copy link
Copy Markdown

Summary

Fixes an incorrect error message in the Istft layer's __init__ validation that was stating the opposite of the actual requirement.

The Bug

In realbook/layers/signal.py:184-186:

if self.fft_length <= self.hop_length:
    # If this is true then the inverse window function will contain a nan in some cases.
    raise ValueError("FFT Length must be less than or equal to hop length or else nans will appear.")

The error message says "FFT Length must be less than or equal to hop length" but the condition raises an error when fft_length <= hop_length. This means the actual requirement is fft_length > hop_length.

The Fix

Changed the error message to accurately describe the constraint:

raise ValueError("FFT length must be greater than hop length or else nans will appear.")

This matches:

  1. The condition being checked (fft_length <= hop_length triggers the error)
  2. The inline comment ("If this is true then the inverse window function will contain a nan")
  3. Standard ISTFT behavior where FFT length should be greater than hop length for proper overlap-add reconstruction

The error message stated 'FFT Length must be less than or equal to hop length'
but the condition raises when fft_length <= hop_length, meaning the
requirement is for fft_length > hop_length. Corrected the message to
accurately describe the constraint.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant