Comments (4)
Thanks a lot, this looks much better :)
from resampy.
I think this is probably expected behavior given how short your input signals are, but I will look into it. (Your code example does reproduce the reported behavior on my environment.)
To get high quality reconstruction, the default filter (kaiser_best
) uses a very long window to approximate a sinc filter. When you get to the end of the signal, the filter gets adaptively shortened to avoid running off the end of the input buffer, which results in the attenuation behavior that you reported above. You can see this by switching from kaiser_best
to kaiser_fast
, in which case the results look like:
(note that the edge effects occupy a much smaller portion of the signal). If you want even more control over this, you can call resampy(... filter='sinc_window', num_zeros=16)
; the num_zeros
parameter controls the effective precision of the resampling filter, with larger values producing longer filters and better fidelity.
For typical audio signals, these edge effects should be negligible. ~100 samples at 22050 Hz would not be audible. Still, it's a bit strange that the beginning of the resampled signal does not exhibit these artifacts, since the filter is time-symmetric, so I'll look into it.
from resampy.
Update: this does indeed seem to be a bug, due to this line subtracting off the left-hand array bound when calculating the right-hand array bound. Removing that subtraction brings the boundary effects down to where I would expect them:
At this point though, I'm wondering if it makes more sense to calculate a symmetric array bound for time t
so that each output sample always has an equal contributions from the left- and right- wings of the filter. I'll experiment with this and report back. Otherwise, I've flagged this issue for fixing in 0.2.1, which I hope to push in the next few days.
Thanks @bolau for reporting this!
from resampy.
Fix is merged, I'll push the bugfix release later today and it should appear on conda-forge shortly thereafter.
The fix as implemented is, I think, the correct thing to do if we assume the input signal is zero outside of the observations. More generally, I could imagine it being useful to support other edge modes, which might be useful depending on the assumptions you're willing to make about your signals. I've created a new issue #64 for that. I probably won't have time to implement that in the immediate future, but I'm happy to help any newcomers that want to work on it.
from resampy.
Related Issues (20)
- v0.3.0 produces other results than v0.2.2 HOT 3
- Resampy 0.3.0 is slow for multi-dimensional input HOT 5
- Issues with Numba 0.55.2 HOT 4
- Resampy 0.3.1 slows down other libraries HOT 43
- Use parallel=True by default can be problematic in multiprocessing applications HOT 8
- Bringing import time back down
- Edge Case, rounding error in length calculation HOT 3
- Missing argument in guvectorize decorator ? HOT 2
- Quality issues? HOT 5
- resampling to the same hz HOT 1
- Incompatible with latest numba HOT 3
- Best quality resampling?
- PyPI status HOT 2
- Add linting CI
- Add pypi packaging workflow HOT 1
- Drop legacy python support
- Fix documentation builds HOT 1
- Update README badges
- Improve default filters and make the whole process reproducible HOT 14
- Cache filters on load
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from resampy.