|
12 | 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | 13 | # See the License for the specific language governing permissions and |
14 | 14 | # limitations under the License. |
| 15 | +""" |
| 16 | +Create a duplicate dataset with added noise |
| 17 | +
|
| 18 | +:folder str |
| 19 | + Folder containing source dataset |
| 20 | +
|
| 21 | +:-tg --tags-file str - |
| 22 | + Tags file to optionally load from |
| 23 | +
|
| 24 | +:noise_folder str |
| 25 | + Folder with wav files containing noise to be added |
| 26 | +
|
| 27 | +:output_folder str |
| 28 | + Folder to write the duplicate generated dataset |
| 29 | +
|
| 30 | +:-if --inflation-factor int 1 |
| 31 | + The number of noisy samples generated per single source sample |
| 32 | +
|
| 33 | +:-nl --noise-ratio-low float 0.0 |
| 34 | + Minimum random ratio of noise to sample. 1.0 is all noise, no sample sound |
| 35 | +
|
| 36 | +:-nh --noise-ratio-high float 0.4 |
| 37 | + Maximum random ratio of noise to sample. 1.0 is all noise, no sample sound |
| 38 | +""" |
15 | 39 | from math import sqrt |
16 | 40 |
|
17 | 41 | import numpy as np |
@@ -68,30 +92,7 @@ def noised_audio(self, audio: np.ndarray, noise_ratio: float) -> np.ndarray: |
68 | 92 |
|
69 | 93 | class AddNoiseScript(BaseScript): |
70 | 94 | usage = Usage( |
71 | | - """ |
72 | | - Create a duplicate dataset with added noise |
73 | | -
|
74 | | - :folder str |
75 | | - Folder containing source dataset |
76 | | -
|
77 | | - :-tg --tags-file str - |
78 | | - Tags file to optionally load from |
79 | | -
|
80 | | - :noise_folder str |
81 | | - Folder with wav files containing noise to be added |
82 | | -
|
83 | | - :output_folder str |
84 | | - Folder to write the duplicate generated dataset |
85 | | -
|
86 | | - :-if --inflation-factor int 1 |
87 | | - The number of noisy samples generated per single source sample |
88 | | -
|
89 | | - :-nl --noise-ratio-low float 0.0 |
90 | | - Minimum random ratio of noise to sample. 1.0 is all noise, no sample sound |
91 | | -
|
92 | | - :-nh --noise-ratio-high float 0.4 |
93 | | - Maximum random ratio of noise to sample. 1.0 is all noise, no sample sound |
94 | | - """, |
| 95 | + __doc__, |
95 | 96 | tags_file=lambda args: abspath(args.tags_file) if args.tags_file else None, |
96 | 97 | folder=lambda args: abspath(args.folder), |
97 | 98 | output_folder=lambda args: abspath(args.output_folder) |
|
0 commit comments