bmcfee / resampy

Efficient sample rate conversion in python
https://resampy.readthedocs.io
ISC License
253 stars 36 forks source link

force floating point math for shape calculations #115

Closed bmcfee closed 2 years ago

bmcfee commented 2 years ago

This PR force-casts sampling rates to be floating point values when calculating the output shape of the resampled array.

This is designed to circumvent numerical overflows that arise when sr_new is a fixed-precision integer (eg np.int16) for some reason. This didn't arise in our tests here, but did pop up over in https://github.com/librosa/librosa/issues/1569

codecov-commenter commented 2 years ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 75.22%. Comparing base (9c9fa90) to head (69e42e8). Report is 30 commits behind head on main.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #115 +/- ## ======================================= Coverage 75.22% 75.22% ======================================= Files 4 4 Lines 113 113 ======================================= Hits 85 85 Misses 28 28 ``` | [Flag](https://app.codecov.io/gh/bmcfee/resampy/pull/115/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brian+McFee) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/bmcfee/resampy/pull/115/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brian+McFee) | `75.22% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brian+McFee#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.