You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
converted_audio_dir (str): The directory to store the resampled audio files.
38
+
input_file_key (str): The field in the dataset representing the path to the input video or audio files.
39
+
output_file_key (str): The field in the dataset representing the path to the resampled audio files with ``output_format``. If ``id_key`` is None, the output file path will be ``<resampled_audio_dir>/<input file name without extension>.wav``.
40
+
id_key (str): (Optional) The field in the dataset representing the unique ID or identifier for each entry. If ``id_key`` is not None, the output file path will be ``<resampled_audio_dir>/<id_key>.wav``. Defaults to None.
41
+
output_format (str): (Optional) Format of the output audio files. Defaults to `wav`.
42
+
target_samplerate (int): (Optional) The target sampling rate for the resampled audio. Defaults to 16000.
43
+
target_nchannels (int): (Optional) The target number of channels for the resampled audio. Defaults to 1.
44
+
**kwargs: Additional keyword arguments to be passed to the base class `BaseParallelProcessor`.
45
+
46
+
"""
47
+
48
+
def__init__(
49
+
self,
50
+
converted_audio_dir: str,
51
+
input_file_key: str,
52
+
output_file_key: str,
53
+
id_key: str=None,
54
+
output_format: str="wav",
55
+
base_dir: str=None,
56
+
target_samplerate: int=16000,
57
+
target_nchannels: int=1,
58
+
**kwargs,
59
+
):
60
+
super().__init__(**kwargs)
61
+
self.converted_audio_dir=converted_audio_dir
62
+
self.input_file_key=input_file_key
63
+
self.output_file_key=output_file_key
64
+
self.output_format=output_format
65
+
self.id_key=id_key
66
+
self.base_dir=base_dir
67
+
self.target_samplerate=target_samplerate
68
+
self.target_nchannels=target_nchannels
69
+
70
+
defprepare(self):
71
+
assertself.output_format=="wav", "Currently only wav format is supported"
0 commit comments