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

width and height with .json #114

Open
SaadArdati opened this issue May 12, 2020 · 7 comments
Open

width and height with .json #114

SaadArdati opened this issue May 12, 2020 · 7 comments

Comments

@SaadArdati
Copy link

SaadArdati commented May 12, 2020

It seems the .json output is the same with or without a width and height, is this intentional?

@chrisn
Copy link
Member

chrisn commented May 12, 2020

Yes, the --width and --height options only apply when creating PNG images. For JSON output you'll need to set the --zoom option (or --pixels-per-second).

@SaadArdati
Copy link
Author

@chrisn I suppose the only way to do this is to average chunks of the data together to get 1 pair of channels to equal x amount of pixels for a specific width? That's disappointing. I'll close this issue and do that i suppose.

@chrisn
Copy link
Member

chrisn commented May 12, 2020

The calculation you need to obtain the --zoom value for a given image width and audio duration is here. Rounding errors mean the resulting JSON isn't exactly the length you requested, but it'll be close.

@SaadArdati
Copy link
Author

Thank you.

@SaadArdati
Copy link
Author

@chrisn I was successful in using what you linked, however I actually do need it to be pixel perfect. What can I do?

@chrisn
Copy link
Member

chrisn commented May 13, 2020

At the moment, only solution is to either truncate or pad the data to the desired length. You're not the first person to request this, see also #41, #104, #108.

@SaadArdati
Copy link
Author

very odd. it should be the exact same formula as the png command but without the drawing part.. Hm..

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

No branches or pull requests

2 participants