Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

barWidth breaks wavform display #907

Closed
RighteousIdealizedDung opened this issue Dec 31, 2016 · 3 comments
Closed

barWidth breaks wavform display #907

RighteousIdealizedDung opened this issue Dec 31, 2016 · 3 comments
Labels

Comments

@RighteousIdealizedDung
Copy link

Adding barWidth: 3 to the Wavesurfer options removes the waveform entirely. I have created a demo at http://codepen.io/RighteousIdealizedDung/pen/BQXeod. Without the barWidth option, all appears correctly. My code is based on code from http://stackoverflow.com/questions/38918909/how-can-i-load-only-waveform-and-wait-to-user-click-play-to-download-the-audio. I am using server-generated JSON peak data. I have experimented with various combinations of options with no success. It looks like a wavesurfer bug, any suggestions as to how this can be fixed? Thanks

@katspaugh
Copy link
Owner

katspaugh commented Dec 31, 2016

Yes, definitely a bug in combination of normalize and barWidth.

As a work-around, normalize your peaks array externally: http://codepen.io/anon/pen/WReGNr

@katspaugh katspaugh added the bug label Dec 31, 2016
@RighteousIdealizedDung
Copy link
Author

Thanks for the work-around!

@chrisparton1991
Copy link
Contributor

Hi guys, I've raised #916 to fix this. The absmax calculation in drawBars() wasn't taking negative peaks into account, so in this case the max was 0. I simply used the code in drawWave(), which does take negatives into account.

We'll need to fix this in the next branch too I assume. I don't have time right now but I'll try to get a PR for that in sometime soon. Of course, it's a simple change so anyone can do it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants