Skip to content

BUG: smooth function produces negative numbers because of overflow #19

Open

Description

@NickleDave

Just spotted a bug when working with a modified version of the smooth function for vocalpy.
I spotted it because I added an assertion checking that all values were positive after smoothing. They are not.

This happens because cbins are int16, and when we square, we get overflow for some values (any whose square are larger than np.iinfo('>i2') (or whatever the dtype is on your platform)). Not sure yet if this bug holds in the original evsonganaly or whether Matlab does something different to deal with this.

Not sure how to handle but we shouldn't keep failing silently. For purposes of this package we want to replicate what evsonganaly does--if that's overflowing, then we should just maintain that but probably issue a warning so it's not happening silently at least. Maybe include a URL to this issue in the warning.

Another option would be to just build in functionality to convert to float values / .wav -- basically what I do in the bfsongrepo dataset. I think this is not an issue once the audio signal is float since you can't get overflow in the same way then

I think that counterintuitively the bug might not matter too much because of how smoothing + time-frequency transforms work, but still this is not great

  • determine whether this is a bug in evsonganaly too or it's some mistake I made
  • add assertion that tests that all values are positive after running smooth

Activity

  1. added
    bug
    on May 6, 2023
  2. changed the title [-]smooth function produces negative numbers because of overflow[/-] [+]BUG: smooth function produces negative numbers because of overflow[/+] on May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions