bastibe / python-soundfile

SoundFile is an audio library based on libsndfile, CFFI, and NumPy
BSD 3-Clause "New" or "Revised" License
717 stars 111 forks source link

Add functions to change compression level and bitrate mode. #447

Open ytya opened 1 week ago

ytya commented 1 week ago

Added interface to change compression level and bitrate mode as described in #390. I was able to test it on Windows, but not on other platforms.

bastibe commented 4 days ago

Very cool, thank you very much! But I think the write function is the wrong place for this.

ytya commented 3 days ago

Thank you for the review. I've moved them to parameter of SoundFile. Is that what you meant?

sammlapp commented 2 days ago

ah I had just finally started implementing the bitrate in a branch myself, glad to see this is already nearing completion

sammlapp commented 2 days ago

also, I tested with OPUS as well as MP3 and am happy to see that setting the compression level in this way works across formats. This will resolve my request in #252 for writing OPUS with variable bit rates as well as resolving #390

ytya commented 4 hours ago

@bastibe I followed your advice and changed the code. As for __repr__, i thought there was no problem with the operation as None was entered before the change, but we modified it from the point of view of not displaying extra information. Please feel free to point out if this is not what you intended.

@sammlapp Thanks for testing. I also tested opus and flac and it worked.