Add sox_effects submodule and delegate sox_effects init/shutdown (#708)
There are couple of aspects of this PR that overall improves the maintainability of the code base, based on "decoupling" and "separation of concerns". First, `sox_effects` functionalities can be either available or unavailable. From the viewpoint of `torchaudio` main module, the looser the connection between the `torchaudio` module and `torchaudio.sox_effects`, the more manageable the code base become because you can change the two modules independently. This is mostly accomplished when the definitions of `initialize_sox` and `shutdown_sox` were moved from `torchaudio.__init__` to `torchaudio.sox_effects`, but the initialization of sox effects are still happening in `torchaudio.__init__`. If we move the initialization to `sox_effects` module, the responsibility of sox initialization is moved to `sox_effects` module, along with the required module availability check etc. The main `torchaudio` module can be carefree about how the `sox_effects` module should work. In addition to that, I found that `initialize_sox` and `shutdown_sox` are confusing because it sound like they are required for `libsox` based I/O. To make it clear, I renamed them to include `sox_effect` in function name. Also moving functions from the original places are BC breaking itself, therefore, these functions are re-imported in `torchaudio.__init__` and renamed to match the original names. Therefore the PR is not BC breaking.
Showing
Please register or sign in to comment