-
Notifications
You must be signed in to change notification settings - Fork 743
Add sox_effects submodule and delegate sox_effects initialization #708
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| from torchaudio._internal import module_utils as _mod_utils | ||
| from .sox_effects import ( | ||
| init_sox_effects, | ||
| shutdown_sox_effects, | ||
| effect_names, | ||
| SoxEffect, | ||
| SoxEffectsChain, | ||
| ) | ||
|
|
||
|
|
||
| if _mod_utils.is_module_available('torchaudio._torchaudio'): | ||
| init_sox_effects() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ | |
| from typing import Any, Callable, List, Optional, Tuple, Union | ||
|
|
||
| import torch | ||
| import torchaudio | ||
| from torch import Tensor | ||
|
|
||
| from torchaudio._internal import ( | ||
|
|
@@ -11,7 +10,7 @@ | |
| ) | ||
|
|
||
| if _mod_utils.is_module_available('torchaudio._torchaudio'): | ||
| from . import _torchaudio | ||
| from torchaudio import _torchaudio | ||
|
|
||
|
|
||
| _SOX_INITIALIZED: Optional[bool] = False | ||
|
|
@@ -26,7 +25,7 @@ | |
|
|
||
|
|
||
| @_mod_utils.requires_module('torchaudio._torchaudio') | ||
| def initialize_sox() -> int: | ||
| def init_sox_effects() -> int: | ||
| """Initialize sox for use with effects chains. | ||
|
|
||
| You only need to call this function once to use SoX effects chains multiple times. | ||
|
|
@@ -48,13 +47,13 @@ def initialize_sox() -> int: | |
| code = _torchaudio.initialize_sox() | ||
| if code == _SOX_SUCCESS_CODE: | ||
| _SOX_INITIALIZED = True | ||
| atexit.register(shutdown_sox) | ||
| atexit.register(shutdown_sox_effects) | ||
| return code | ||
| return _SOX_SUCCESS_CODE | ||
|
|
||
|
|
||
| @_mod_utils.requires_module("torchaudio._torchaudio") | ||
| def shutdown_sox() -> int: | ||
| def shutdown_sox_effects() -> int: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's BC breaking, no?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I saw that
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah if the user adopts
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh right, since it wasn't part of a release, we don't need to worry about this then. |
||
| """Showdown sox for effects chain. | ||
|
|
||
| You do not need to call this function as it will be called automatically | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: that's a separate issue :)