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

Question: Easy way to convert file_info.encoding into encoding input format ? #86

Closed
poofyteddy opened this issue Nov 20, 2018 · 2 comments
Labels

Comments

@poofyteddy
Copy link

Hello,
i'm trying to do thing right for my combiner and fill all the value in my set.input.format with data from the file itself
I know the data is implicitly fed if set to NONE, but i still wanted to do it.

The issue i am having is that sox.file_info.encoding("/some/path/to/file.wav") return a string like 'Signed Integer PCM', witch can't be used as an argument for my sox.combiner().set_input_format(encoding = ##) who expect signed-integer

So, i have looked a bit around without finding something who do the conversion/give me a value i can just put in, and before doing an ugly switch case list of elif, i was wondering if i missed anything.

Thank's for the time and work, this wrapper saved my butt ^^'

@poofyteddy poofyteddy changed the title Question: Easy way to convert file_info.encoding into encdoing input format ? Question: Easy way to convert file_info.encoding into encoding input format ? Nov 20, 2018
@rabitt
Copy link
Collaborator

rabitt commented Nov 26, 2018

Hi @poofyteddy . I suspect you're wanting to set the input format because of the annoying warning sox is putting (see #85 )?

The short answer to your question is, no there isn't an easy way to convert between the output of file_info.encoding to the expected input format of Combiner.set_input_format. I haven't had a use case for this functionality before (since sox is internally doing what you propose), but if you have one I'm happy to look at a pull request!

@poofyteddy
Copy link
Author

This was in did my start point, after seeing that you could specified the files informations, i thought that it was a better/proper way to do it anyway. I don't have a real need for it, it only "feel" better than letting it figure it out (event if in the end i ask him the data to give back....)

If there is nothing in place, it's ok. But i don't have a real usecase, and feel like adding a "switch case" method to convert one type of data to the other would be ok for a script, not for the library (being only a wrapper, sox could change there output.)

Thank's for your time answering !

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

2 participants