Preprocess LibriTTS
PreprocessLibriTTS
Preprocessing PreprocessLibriTTS audio and text data for use with a TacotronSTFT model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
preprocess_config |
PreprocessingConfig
|
The preprocessing configuration. |
required |
lang |
str
|
The language of the input text. |
'en'
|
Attributes:
Name | Type | Description |
---|---|---|
min_seconds |
float
|
The minimum duration of audio clips in seconds. |
max_seconds |
float
|
The maximum duration of audio clips in seconds. |
hop_length |
int
|
The hop length of the STFT. |
sampling_rate |
int
|
The sampling rate of the audio. |
use_audio_normalization |
bool
|
Whether to normalize the loudness of the audio. |
tacotronSTFT |
TacotronSTFT
|
The TacotronSTFT object used for computing mel spectrograms. |
min_samples |
int
|
The minimum number of audio samples in a clip. |
max_samples |
int
|
The maximum number of audio samples in a clip. |
Source code in training/preprocess/preprocess_libritts.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
|
acoustic(row)
Preprocesses audio and text data for use with a TacotronSTFT model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row |
Tuple[FloatTensor, int, str, str, int, str | int, str]
|
The input row. The row is a tuple containing the following elements: (audio, sr_actual, raw_text, normalized_text, speaker_id, chapter_id, utterance_id). |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
Union[None, PreprocessForAcousticResult]
|
A dictionary containing the preprocessed audio and text data. |
Examples:
>>> preprocess_audio = PreprocessAudio("english_only")
>>> audio = torch.randn(1, 44100)
>>> sr_actual = 44100
>>> raw_text = "Hello, world!"
>>> output = preprocess_audio(audio, sr_actual, raw_text)
>>> output.keys()
dict_keys(['wav', 'mel', 'pitch', 'phones', 'raw_text', 'normalized_text', 'speaker_id', 'chapter_id', 'utterance_id', 'pitch_is_normalized'])
Source code in training/preprocess/preprocess_libritts.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
|
beta_binomial_prior_distribution(phoneme_count, mel_count, scaling_factor=1.0)
Computes the beta-binomial prior distribution for the attention mechanism.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
phoneme_count |
int
|
Number of phonemes in the input text. |
required |
mel_count |
int
|
Number of mel frames in the input mel-spectrogram. |
required |
scaling_factor |
float
|
Scaling factor for the beta distribution. Defaults to 1.0. |
1.0
|
Returns:
Type | Description |
---|---|
Tensor
|
torch.Tensor: A 2D tensor containing the prior distribution. |
Source code in training/preprocess/preprocess_libritts.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
univnet(row)
Preprocesses audio data for use with a UnivNet model.
This method takes a row of data, extracts the audio and preprocesses it. It then selects a random segment from the preprocessed audio and its corresponding mel spectrogram.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row |
Tuple[FloatTensor, int, str, str, int, str | int, str]
|
The input row. The row is a tuple containing the following elements: (audio, sr_actual, raw_text, normalized_text, speaker_id, chapter_id, utterance_id). |
required |
Returns:
Type | Description |
---|---|
Tuple[torch.Tensor, torch.Tensor, int]: A tuple containing the selected segment of the mel spectrogram, the corresponding audio segment, and the speaker ID. |
Examples:
>>> preprocess = PreprocessLibriTTS()
>>> audio = torch.randn(1, 44100)
>>> sr_actual = 44100
>>> speaker_id = 0
>>> mel, audio_segment, speaker_id = preprocess.preprocess_univnet((audio, sr_actual, "", "", speaker_id, 0, ""))
Source code in training/preprocess/preprocess_libritts.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
|