-
Notifications
You must be signed in to change notification settings - Fork 243
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
Add wave bars customization options #187
Conversation
Thanks! I'll try this out |
I needed to fix a couple of issues to get this to compile, and couldn't push to your branch, so here's my branch: https://github.com/bbc/audiowaveform/tree/bar-customisation-for-png Here's an example, using these options:
I'm wondering if the bar heights should be such that the image is symmetrical? |
I didn't even see it at first but now I do as well. I'll fix it so that it is symmetrical. Regarding the fact that it wasn't compiling, strangely enough it was for me on my Mac using the Xcode compiler. I'll merge your changes. |
In addition to PNGs, audiowaveform also generates .json or .dat files containing the raw waveform data. So I'm thinking whether it should be possible to save the raw data so that you can render the image using some other software. This would mean moving the calculation of the data points outside |
In all honesty, I'm no serious c++ developer, I've done some like 25 years ago. Nevertheless I'm still keen to help out with this feature. As to the current state of the PR, I've simply copied the previous bar PR request and fiddled my way to make some tweaks and managed to monkey my way around adding the CLI params (options). What you're suggesting here seems like a great idea, but I would need help or serious guidance 😅 Also, after looking at the actual Let me know what you think, meanwhile, I can fix the bar on the horizontal axis. |
The image was being created twice
Having thought a bit more, the approach in this PR seems good. I pushed couple more changes to my branch. One thing I noticed is that the bar width is actually one pixel too big, so if you specify |
This is true, and I don't want to change that, as it gives a more accurate representation of the waveform. See this example. |
Bars were one pixel too wide
I'm working on a solution... |
I guess we could update the logic to be different here, when using bar-style we draw them to be symmetrical, what do you think? |
@chrisn I pushed some changes which fix the bar width as well has the radius issues Only the symmetrical issue remains if that is something we wish to address of course |
Honestly, I have no idea what causes this, surely it's a bug related to the sampling of the data prior to rendering. |
Could you enable the "Allow edits from maintainers" option on your pull request please? I just fixed the test cases to get the code to compile so would like to update this PR with that change. I also notice lots of compiler warnings about float to int conversion, e.g:
|
It's because the code assumes a bar should start at the first pixel in the image, which may not be the case if the start time is not zero. |
I found this documentation from GitHub but couldn't find the proper interface. I have no idea if it's related to where I saved my fork (my business GitHub company) You have any idea? True, I'll create variables to prevent the conversion warnings |
From this discussion, it seems it's not possible from an organization account. I didn't realise. |
I'm not sure what the right thing to do here is. If you're using the I'm happy write the code to try out both alternatives to see how well each works. |
If that's fine with you, you can still push to your branch and I'll rebase from your branch and you do the same. |
Looking forward to it |
@chrisn I just pushed the 2 things we discussed namely fix the implicit conversion warnings and center the bars for waveform bar style Two things that could be upgraded:
|
Thanks! I agree with your suggestions, using string values is more flexible. |
0dda0de
to
856d6ca
Compare
I couldn't figure it out quickly so I went with the path of least resistance hahaha Is this something you could work out? Or at least tell me how to implement string params the most effective way? |
The |
@YannickGagnon I have added this feature to the master branch. Please try it out and let me know what you think. |
Thanks @chrisn for moving forward with this PR, I've been busy with something else meanwhile. There's a small typo in the help, it states that Also, I'm seeing some differences in the output though and I don't know if it's expected or not 🤔 Here's are the different outputs from my PR and then from Master using the same input file and arguments |
Thanks. I'll fix the typo. I also need to add some test cases, and maybe update how the parameter validation is done. I'll check your branch again, but here's a test that compares the current 1.7.1 release with the latest code on
|
The problem seems to appear when you set the width and height parameter, can you confirm? |
I think the
|
You're right, if I set -z auto, it works thanks |
@chrisn Any idea when this gets released? Assuming it will be available in upcoming version 1.7.2? |
Yes, it'll be a new version, probably 1.8.0. The only thing remaining is to add some more test cases. I can't promise exactly when it'll be ready to release (this is all in my personal time) ... but shouldn't be long. |
I have now released 1.8.0, see https://github.com/bbc/audiowaveform/releases/tag/1.8.0. Many thanks for your help! I suggest that we close this PR and please raise issues if anything needs improvement or fixing. |
Thanks to you, wonderful work you've been doing there ✨ |
Addressing issue 111
FYI: I did not implement
waveform-style
, it's simply determined by the bar width option./audiowaveform -i ./path/to/audio.mp3 -o ./path/to/audio.png -w 896 -h 184 --no-axis-labels --background-color "00000000" --waveform-color EF5350FF --bar-width 8 --bar-gap 4 --bar-style-rounded true --pixels-per-second 5
Output