mrfakename commited on
Commit
7af4264
1 Parent(s): e04b055

Upload 72 files

Browse files
melo/api.py CHANGED
@@ -8,6 +8,8 @@ import torchaudio
8
  import numpy as np
9
  import torch.nn as nn
10
  from tqdm import tqdm
 
 
11
  from . import utils
12
  from . import commons
13
  from .models import SynthesizerTrn
@@ -18,13 +20,20 @@ from .download_utils import load_or_download_config, load_or_download_model
18
  class TTS(nn.Module):
19
  def __init__(self,
20
  language,
21
- device='cuda:0'):
 
 
 
22
  super().__init__()
 
 
 
 
23
  if 'cuda' in device:
24
  assert torch.cuda.is_available()
25
 
26
  # config_path =
27
- hps = load_or_download_config(language)
28
 
29
  num_languages = hps.num_languages
30
  num_tones = hps.num_tones
@@ -47,7 +56,7 @@ class TTS(nn.Module):
47
  self.device = device
48
 
49
  # load state_dict
50
- checkpoint_dict = load_or_download_model(language, device)
51
  self.model.load_state_dict(checkpoint_dict['model'], strict=True)
52
 
53
  language = language.split('_')[0]
@@ -63,23 +72,25 @@ class TTS(nn.Module):
63
  return audio_segments
64
 
65
  @staticmethod
66
- def split_sentences_into_pieces(text, language):
67
  texts = split_sentence(text, language_str=language)
68
- # print(" > Text splitted to sentences.")
69
- # print('\n'.join(texts))
70
- # print(" > ===========================")
 
71
  return texts
72
 
73
- def tts_to_file(self, text, speaker_id, output_path=None, sdp_ratio=0.2, noise_scale=0.6, noise_scale_w=0.8, speed=1.0, pbar=None, format=None, position=None):
74
  language = self.language
75
- texts = self.split_sentences_into_pieces(text, language)
76
  audio_list = []
77
- tx = texts
78
  if pbar:
79
  tx = pbar(texts)
80
  else:
81
  if position:
82
  tx = tqdm(texts, position=position)
 
 
83
  else:
84
  tx = tqdm(texts)
85
  for t in tx:
@@ -118,4 +129,7 @@ class TTS(nn.Module):
118
  if output_path is None:
119
  return audio
120
  else:
121
- soundfile.write(output_path, audio, self.hps.data.sampling_rate, format=format)
 
 
 
 
8
  import numpy as np
9
  import torch.nn as nn
10
  from tqdm import tqdm
11
+ import torch
12
+
13
  from . import utils
14
  from . import commons
15
  from .models import SynthesizerTrn
 
20
  class TTS(nn.Module):
21
  def __init__(self,
22
  language,
23
+ device='auto',
24
+ use_hf=True,
25
+ config_path=None,
26
+ ckpt_path=None):
27
  super().__init__()
28
+ if device == 'auto':
29
+ device = 'cpu'
30
+ if torch.cuda.is_available(): device = 'cuda'
31
+ if torch.backends.mps.is_available(): device = 'mps'
32
  if 'cuda' in device:
33
  assert torch.cuda.is_available()
34
 
35
  # config_path =
36
+ hps = load_or_download_config(language, use_hf=use_hf, config_path=config_path)
37
 
38
  num_languages = hps.num_languages
39
  num_tones = hps.num_tones
 
56
  self.device = device
57
 
58
  # load state_dict
59
+ checkpoint_dict = load_or_download_model(language, device, use_hf=use_hf, ckpt_path=ckpt_path)
60
  self.model.load_state_dict(checkpoint_dict['model'], strict=True)
61
 
62
  language = language.split('_')[0]
 
72
  return audio_segments
73
 
74
  @staticmethod
75
+ def split_sentences_into_pieces(text, language, quiet=False):
76
  texts = split_sentence(text, language_str=language)
77
+ if not quiet:
78
+ print(" > Text split to sentences.")
79
+ print('\n'.join(texts))
80
+ print(" > ===========================")
81
  return texts
82
 
83
+ def tts_to_file(self, text, speaker_id, output_path=None, sdp_ratio=0.2, noise_scale=0.6, noise_scale_w=0.8, speed=1.0, pbar=None, format=None, position=None, quiet=False,):
84
  language = self.language
85
+ texts = self.split_sentences_into_pieces(text, language, quiet)
86
  audio_list = []
 
87
  if pbar:
88
  tx = pbar(texts)
89
  else:
90
  if position:
91
  tx = tqdm(texts, position=position)
92
+ elif quiet:
93
+ tx = texts
94
  else:
95
  tx = tqdm(texts)
96
  for t in tx:
 
129
  if output_path is None:
130
  return audio
131
  else:
132
+ if format:
133
+ soundfile.write(output_path, audio, self.hps.data.sampling_rate, format=format)
134
+ else:
135
+ soundfile.write(output_path, audio, self.hps.data.sampling_rate)
melo/app.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WebUI by mrfakename <X @realmrfakename / HF @mrfakename>
2
+ # Demo also available on HF Spaces: https://huggingface.co/spaces/mrfakename/MeloTTS
3
+ import gradio as gr
4
+ import os, torch, io
5
+ # os.system('python -m unidic download')
6
+ print("Make sure you've downloaded unidic (python -m unidic download) for this WebUI to work.")
7
+ from melo.api import TTS
8
+ speed = 1.0
9
+ import tempfile
10
+ import click
11
+ device = 'auto'
12
+ models = {
13
+ 'EN': TTS(language='EN', device=device),
14
+ 'ES': TTS(language='ES', device=device),
15
+ 'FR': TTS(language='FR', device=device),
16
+ 'ZH': TTS(language='ZH', device=device),
17
+ 'JP': TTS(language='JP', device=device),
18
+ 'KR': TTS(language='KR', device=device),
19
+ }
20
+ speaker_ids = models['EN'].hps.data.spk2id
21
+
22
+ default_text_dict = {
23
+ 'EN': 'The field of text-to-speech has seen rapid development recently.',
24
+ 'ES': 'El campo de la conversión de texto a voz ha experimentado un rápido desarrollo recientemente.',
25
+ 'FR': 'Le domaine de la synthèse vocale a connu un développement rapide récemment',
26
+ 'ZH': 'text-to-speech 领域近年来发展迅速',
27
+ 'JP': 'テキスト読み上げの分野は最近急速な発展を遂げています',
28
+ 'KR': '최근 텍스트 음성 변환 분야가 급속도로 발전하고 있습니다.',
29
+ }
30
+
31
+ def synthesize(speaker, text, speed, language, progress=gr.Progress()):
32
+ bio = io.BytesIO()
33
+ models[language].tts_to_file(text, models[language].hps.data.spk2id[speaker], bio, speed=speed, pbar=progress.tqdm, format='wav')
34
+ return bio.getvalue()
35
+ def load_speakers(language, text):
36
+ if text in list(default_text_dict.values()):
37
+ newtext = default_text_dict[language]
38
+ else:
39
+ newtext = text
40
+ return gr.update(value=list(models[language].hps.data.spk2id.keys())[0], choices=list(models[language].hps.data.spk2id.keys())), newtext
41
+ with gr.Blocks() as demo:
42
+ gr.Markdown('# MeloTTS WebUI\n\nA WebUI for MeloTTS.')
43
+ with gr.Group():
44
+ speaker = gr.Dropdown(speaker_ids.keys(), interactive=True, value='EN-US', label='Speaker')
45
+ language = gr.Radio(['EN', 'ES', 'FR', 'ZH', 'JP', 'KR'], label='Language', value='EN')
46
+ speed = gr.Slider(label='Speed', minimum=0.1, maximum=10.0, value=1.0, interactive=True, step=0.1)
47
+ text = gr.Textbox(label="Text to speak", value=default_text_dict['EN'])
48
+ language.input(load_speakers, inputs=[language, text], outputs=[speaker, text])
49
+ btn = gr.Button('Synthesize', variant='primary')
50
+ aud = gr.Audio(interactive=False)
51
+ btn.click(synthesize, inputs=[speaker, text, speed, language], outputs=[aud])
52
+ gr.Markdown('WebUI by [mrfakename](https://twitter.com/realmrfakename).')
53
+ @click.command()
54
+ @click.option('--share', '-s', is_flag=True, show_default=True, default=False, help="Expose a publicly-accessible shared Gradio link usable by anyone with the link. Only share the link with people you trust.")
55
+ @click.option('--host', '-h', default=None)
56
+ @click.option('--port', '-p', type=int, default=None)
57
+ def main(share, host, port):
58
+ demo.queue(api_open=False).launch(show_api=False, share=share, server_name=host, server_port=port)
59
+
60
+ if __name__ == "__main__":
61
+ main()
melo/configs/config.json ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "train": {
3
+ "log_interval": 200,
4
+ "eval_interval": 1000,
5
+ "seed": 52,
6
+ "epochs": 10000,
7
+ "learning_rate": 0.0003,
8
+ "betas": [
9
+ 0.8,
10
+ 0.99
11
+ ],
12
+ "eps": 1e-09,
13
+ "batch_size": 6,
14
+ "fp16_run": false,
15
+ "lr_decay": 0.999875,
16
+ "segment_size": 16384,
17
+ "init_lr_ratio": 1,
18
+ "warmup_epochs": 0,
19
+ "c_mel": 45,
20
+ "c_kl": 1.0,
21
+ "skip_optimizer": true
22
+ },
23
+ "data": {
24
+ "training_files": "",
25
+ "validation_files": "",
26
+ "max_wav_value": 32768.0,
27
+ "sampling_rate": 44100,
28
+ "filter_length": 2048,
29
+ "hop_length": 512,
30
+ "win_length": 2048,
31
+ "n_mel_channels": 128,
32
+ "mel_fmin": 0.0,
33
+ "mel_fmax": null,
34
+ "add_blank": true,
35
+ "n_speakers": 256,
36
+ "cleaned_text": true,
37
+ "spk2id": {}
38
+ },
39
+ "model": {
40
+ "use_spk_conditioned_encoder": true,
41
+ "use_noise_scaled_mas": true,
42
+ "use_mel_posterior_encoder": false,
43
+ "use_duration_discriminator": true,
44
+ "inter_channels": 192,
45
+ "hidden_channels": 192,
46
+ "filter_channels": 768,
47
+ "n_heads": 2,
48
+ "n_layers": 6,
49
+ "n_layers_trans_flow": 3,
50
+ "kernel_size": 3,
51
+ "p_dropout": 0.1,
52
+ "resblock": "1",
53
+ "resblock_kernel_sizes": [
54
+ 3,
55
+ 7,
56
+ 11
57
+ ],
58
+ "resblock_dilation_sizes": [
59
+ [
60
+ 1,
61
+ 3,
62
+ 5
63
+ ],
64
+ [
65
+ 1,
66
+ 3,
67
+ 5
68
+ ],
69
+ [
70
+ 1,
71
+ 3,
72
+ 5
73
+ ]
74
+ ],
75
+ "upsample_rates": [
76
+ 8,
77
+ 8,
78
+ 2,
79
+ 2,
80
+ 2
81
+ ],
82
+ "upsample_initial_channel": 512,
83
+ "upsample_kernel_sizes": [
84
+ 16,
85
+ 16,
86
+ 8,
87
+ 2,
88
+ 2
89
+ ],
90
+ "n_layers_q": 3,
91
+ "use_spectral_norm": false,
92
+ "gin_channels": 256
93
+ }
94
+ }
melo/data/example/metadata.list ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ data/example/wavs/000.wav|EN-default|EN|Well, there are always new trends and styles emerging in the fashion world, but I think some of the biggest trends at the moment include sustainability and ethical fashion, streetwear and athleisure, and oversized and deconstructed silhouettes.
2
+ data/example/wavs/001.wav|EN-default|EN|Many designers and brands are focusing on creating more environmentally-friendly and socially responsible clothing, while others are incorporating elements of sportswear and casual wear into their collections.
3
+ data/example/wavs/002.wav|EN-default|EN|And there's a growing interest in looser, more relaxed shapes and unconventional materials and finishes.
4
+ data/example/wavs/003.wav|EN-default|EN|That's really insightful.
5
+ data/example/wavs/004.wav|EN-default|EN|What do you think are some of the benefits of following fashion trends?
6
+ data/example/wavs/005.wav|EN-default|EN|Well, I think one of the main benefits of following fashion trends is that it can be a way to express your creativity, personality, and individuality.
7
+ data/example/wavs/006.wav|EN-default|EN|Fashion can be a powerful tool for self-expression and can help you feel more confident and comfortable in your own skin.
8
+ data/example/wavs/007.wav|EN-default|EN|Additionally, staying up-to-date with fashion trends can help you develop your own sense of style and learn how to put together outfits that make you look and feel great.
9
+ data/example/wavs/008.wav|EN-default|EN|That's a great point.
10
+ data/example/wavs/009.wav|EN-default|EN|Do you think it's important to stay on top of the latest fashion trends, or is it more important to focus on timeless style?
11
+ data/example/wavs/010.wav|EN-default|EN|I think it's really up to each individual to decide what approach to fashion works best for them.
12
+ data/example/wavs/011.wav|EN-default|EN|Some people prefer to stick with classic, timeless styles that never go out of fashion, while others enjoy experimenting with new and innovative trends.
13
+ data/example/wavs/012.wav|EN-default|EN|Ultimately, fashion is about personal expression and there's no right or wrong way to approach it.
14
+ data/example/wavs/013.wav|EN-default|EN|The most important thing is to wear what makes you feel good and confident.
15
+ data/example/wavs/014.wav|EN-default|EN|I completely agree.
16
+ data/example/wavs/015.wav|EN-default|EN|Some popular ones that come to mind are oversized blazers, statement sleeves, printed maxi dresses, and chunky sneakers.
17
+ data/example/wavs/016.wav|EN-default|EN|It's been really interesting chatting with you about fashion.
18
+ data/example/wavs/017.wav|EN-default|EN|That's a good point.
19
+ data/example/wavs/018.wav|EN-default|EN|What do you think are some current fashion trends that are popular right now?
20
+ data/example/wavs/019.wav|EN-default|EN|There are so many trends happening right now, it's hard to keep track of them all!
melo/data_utils.py ADDED
@@ -0,0 +1,413 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import random
3
+ import torch
4
+ import torch.utils.data
5
+ from tqdm import tqdm
6
+ from loguru import logger
7
+ import commons
8
+ from mel_processing import spectrogram_torch, mel_spectrogram_torch
9
+ from utils import load_filepaths_and_text
10
+ from utils import load_wav_to_torch_librosa as load_wav_to_torch
11
+ from text import cleaned_text_to_sequence, get_bert
12
+ import numpy as np
13
+
14
+ """Multi speaker version"""
15
+
16
+
17
+ class TextAudioSpeakerLoader(torch.utils.data.Dataset):
18
+ """
19
+ 1) loads audio, speaker_id, text pairs
20
+ 2) normalizes text and converts them to sequences of integers
21
+ 3) computes spectrograms from audio files.
22
+ """
23
+
24
+ def __init__(self, audiopaths_sid_text, hparams):
25
+ self.audiopaths_sid_text = load_filepaths_and_text(audiopaths_sid_text)
26
+ self.max_wav_value = hparams.max_wav_value
27
+ self.sampling_rate = hparams.sampling_rate
28
+ self.filter_length = hparams.filter_length
29
+ self.hop_length = hparams.hop_length
30
+ self.win_length = hparams.win_length
31
+ self.sampling_rate = hparams.sampling_rate
32
+ self.spk_map = hparams.spk2id
33
+ self.hparams = hparams
34
+ self.disable_bert = getattr(hparams, "disable_bert", False)
35
+
36
+ self.use_mel_spec_posterior = getattr(
37
+ hparams, "use_mel_posterior_encoder", False
38
+ )
39
+ if self.use_mel_spec_posterior:
40
+ self.n_mel_channels = getattr(hparams, "n_mel_channels", 80)
41
+
42
+ self.cleaned_text = getattr(hparams, "cleaned_text", False)
43
+
44
+ self.add_blank = hparams.add_blank
45
+ self.min_text_len = getattr(hparams, "min_text_len", 1)
46
+ self.max_text_len = getattr(hparams, "max_text_len", 300)
47
+
48
+ random.seed(1234)
49
+ random.shuffle(self.audiopaths_sid_text)
50
+ self._filter()
51
+
52
+
53
+ def _filter(self):
54
+ """
55
+ Filter text & store spec lengths
56
+ """
57
+ # Store spectrogram lengths for Bucketing
58
+ # wav_length ~= file_size / (wav_channels * Bytes per dim) = file_size / (1 * 2)
59
+ # spec_length = wav_length // hop_length
60
+
61
+ audiopaths_sid_text_new = []
62
+ lengths = []
63
+ skipped = 0
64
+ logger.info("Init dataset...")
65
+ for item in tqdm(
66
+ self.audiopaths_sid_text
67
+ ):
68
+ try:
69
+ _id, spk, language, text, phones, tone, word2ph = item
70
+ except:
71
+ print(item)
72
+ raise
73
+ audiopath = f"{_id}"
74
+ if self.min_text_len <= len(phones) and len(phones) <= self.max_text_len:
75
+ phones = phones.split(" ")
76
+ tone = [int(i) for i in tone.split(" ")]
77
+ word2ph = [int(i) for i in word2ph.split(" ")]
78
+ audiopaths_sid_text_new.append(
79
+ [audiopath, spk, language, text, phones, tone, word2ph]
80
+ )
81
+ lengths.append(os.path.getsize(audiopath) // (2 * self.hop_length))
82
+ else:
83
+ skipped += 1
84
+ logger.info(f'min: {min(lengths)}; max: {max(lengths)}' )
85
+ logger.info(
86
+ "skipped: "
87
+ + str(skipped)
88
+ + ", total: "
89
+ + str(len(self.audiopaths_sid_text))
90
+ )
91
+ self.audiopaths_sid_text = audiopaths_sid_text_new
92
+ self.lengths = lengths
93
+
94
+ def get_audio_text_speaker_pair(self, audiopath_sid_text):
95
+ # separate filename, speaker_id and text
96
+ audiopath, sid, language, text, phones, tone, word2ph = audiopath_sid_text
97
+
98
+ bert, ja_bert, phones, tone, language = self.get_text(
99
+ text, word2ph, phones, tone, language, audiopath
100
+ )
101
+
102
+ spec, wav = self.get_audio(audiopath)
103
+ sid = int(getattr(self.spk_map, sid, '0'))
104
+ sid = torch.LongTensor([sid])
105
+ return (phones, spec, wav, sid, tone, language, bert, ja_bert)
106
+
107
+ def get_audio(self, filename):
108
+ audio_norm, sampling_rate = load_wav_to_torch(filename, self.sampling_rate)
109
+ if sampling_rate != self.sampling_rate:
110
+ raise ValueError(
111
+ "{} {} SR doesn't match target {} SR".format(
112
+ filename, sampling_rate, self.sampling_rate
113
+ )
114
+ )
115
+ # NOTE: normalize has been achieved by torchaudio
116
+ # audio_norm = audio / self.max_wav_value
117
+ audio_norm = audio_norm.unsqueeze(0)
118
+ spec_filename = filename.replace(".wav", ".spec.pt")
119
+ if self.use_mel_spec_posterior:
120
+ spec_filename = spec_filename.replace(".spec.pt", ".mel.pt")
121
+ try:
122
+ spec = torch.load(spec_filename)
123
+ assert False
124
+ except:
125
+ if self.use_mel_spec_posterior:
126
+ spec = mel_spectrogram_torch(
127
+ audio_norm,
128
+ self.filter_length,
129
+ self.n_mel_channels,
130
+ self.sampling_rate,
131
+ self.hop_length,
132
+ self.win_length,
133
+ self.hparams.mel_fmin,
134
+ self.hparams.mel_fmax,
135
+ center=False,
136
+ )
137
+ else:
138
+ spec = spectrogram_torch(
139
+ audio_norm,
140
+ self.filter_length,
141
+ self.sampling_rate,
142
+ self.hop_length,
143
+ self.win_length,
144
+ center=False,
145
+ )
146
+ spec = torch.squeeze(spec, 0)
147
+ torch.save(spec, spec_filename)
148
+ return spec, audio_norm
149
+
150
+ def get_text(self, text, word2ph, phone, tone, language_str, wav_path):
151
+ phone, tone, language = cleaned_text_to_sequence(phone, tone, language_str)
152
+ if self.add_blank:
153
+ phone = commons.intersperse(phone, 0)
154
+ tone = commons.intersperse(tone, 0)
155
+ language = commons.intersperse(language, 0)
156
+ for i in range(len(word2ph)):
157
+ word2ph[i] = word2ph[i] * 2
158
+ word2ph[0] += 1
159
+ bert_path = wav_path.replace(".wav", ".bert.pt")
160
+ try:
161
+ bert = torch.load(bert_path)
162
+ assert bert.shape[-1] == len(phone)
163
+ except Exception as e:
164
+ print(e, wav_path, bert_path, bert.shape, len(phone))
165
+ bert = get_bert(text, word2ph, language_str)
166
+ torch.save(bert, bert_path)
167
+ assert bert.shape[-1] == len(phone), phone
168
+
169
+ if self.disable_bert:
170
+ bert = torch.zeros(1024, len(phone))
171
+ ja_bert = torch.zeros(768, len(phone))
172
+ else:
173
+ if language_str in ["ZH"]:
174
+ bert = bert
175
+ ja_bert = torch.zeros(768, len(phone))
176
+ elif language_str in ["JP", "EN", "ZH_MIX_EN", "KR", 'SP', 'ES', 'FR', 'DE', 'RU']:
177
+ ja_bert = bert
178
+ bert = torch.zeros(1024, len(phone))
179
+ else:
180
+ raise
181
+ bert = torch.zeros(1024, len(phone))
182
+ ja_bert = torch.zeros(768, len(phone))
183
+ assert bert.shape[-1] == len(phone)
184
+ phone = torch.LongTensor(phone)
185
+ tone = torch.LongTensor(tone)
186
+ language = torch.LongTensor(language)
187
+ return bert, ja_bert, phone, tone, language
188
+
189
+ def get_sid(self, sid):
190
+ sid = torch.LongTensor([int(sid)])
191
+ return sid
192
+
193
+ def __getitem__(self, index):
194
+ return self.get_audio_text_speaker_pair(self.audiopaths_sid_text[index])
195
+
196
+ def __len__(self):
197
+ return len(self.audiopaths_sid_text)
198
+
199
+
200
+ class TextAudioSpeakerCollate:
201
+ """Zero-pads model inputs and targets"""
202
+
203
+ def __init__(self, return_ids=False):
204
+ self.return_ids = return_ids
205
+
206
+ def __call__(self, batch):
207
+ """Collate's training batch from normalized text, audio and speaker identities
208
+ PARAMS
209
+ ------
210
+ batch: [text_normalized, spec_normalized, wav_normalized, sid]
211
+ """
212
+ # Right zero-pad all one-hot text sequences to max input length
213
+ _, ids_sorted_decreasing = torch.sort(
214
+ torch.LongTensor([x[1].size(1) for x in batch]), dim=0, descending=True
215
+ )
216
+
217
+ max_text_len = max([len(x[0]) for x in batch])
218
+ max_spec_len = max([x[1].size(1) for x in batch])
219
+ max_wav_len = max([x[2].size(1) for x in batch])
220
+
221
+ text_lengths = torch.LongTensor(len(batch))
222
+ spec_lengths = torch.LongTensor(len(batch))
223
+ wav_lengths = torch.LongTensor(len(batch))
224
+ sid = torch.LongTensor(len(batch))
225
+
226
+ text_padded = torch.LongTensor(len(batch), max_text_len)
227
+ tone_padded = torch.LongTensor(len(batch), max_text_len)
228
+ language_padded = torch.LongTensor(len(batch), max_text_len)
229
+ bert_padded = torch.FloatTensor(len(batch), 1024, max_text_len)
230
+ ja_bert_padded = torch.FloatTensor(len(batch), 768, max_text_len)
231
+
232
+ spec_padded = torch.FloatTensor(len(batch), batch[0][1].size(0), max_spec_len)
233
+ wav_padded = torch.FloatTensor(len(batch), 1, max_wav_len)
234
+ text_padded.zero_()
235
+ tone_padded.zero_()
236
+ language_padded.zero_()
237
+ spec_padded.zero_()
238
+ wav_padded.zero_()
239
+ bert_padded.zero_()
240
+ ja_bert_padded.zero_()
241
+ for i in range(len(ids_sorted_decreasing)):
242
+ row = batch[ids_sorted_decreasing[i]]
243
+
244
+ text = row[0]
245
+ text_padded[i, : text.size(0)] = text
246
+ text_lengths[i] = text.size(0)
247
+
248
+ spec = row[1]
249
+ spec_padded[i, :, : spec.size(1)] = spec
250
+ spec_lengths[i] = spec.size(1)
251
+
252
+ wav = row[2]
253
+ wav_padded[i, :, : wav.size(1)] = wav
254
+ wav_lengths[i] = wav.size(1)
255
+
256
+ sid[i] = row[3]
257
+
258
+ tone = row[4]
259
+ tone_padded[i, : tone.size(0)] = tone
260
+
261
+ language = row[5]
262
+ language_padded[i, : language.size(0)] = language
263
+
264
+ bert = row[6]
265
+ bert_padded[i, :, : bert.size(1)] = bert
266
+
267
+ ja_bert = row[7]
268
+ ja_bert_padded[i, :, : ja_bert.size(1)] = ja_bert
269
+
270
+ return (
271
+ text_padded,
272
+ text_lengths,
273
+ spec_padded,
274
+ spec_lengths,
275
+ wav_padded,
276
+ wav_lengths,
277
+ sid,
278
+ tone_padded,
279
+ language_padded,
280
+ bert_padded,
281
+ ja_bert_padded,
282
+ )
283
+
284
+
285
+ class DistributedBucketSampler(torch.utils.data.distributed.DistributedSampler):
286
+ """
287
+ Maintain similar input lengths in a batch.
288
+ Length groups are specified by boundaries.
289
+ Ex) boundaries = [b1, b2, b3] -> any batch is included either {x | b1 < length(x) <=b2} or {x | b2 < length(x) <= b3}.
290
+
291
+ It removes samples which are not included in the boundaries.
292
+ Ex) boundaries = [b1, b2, b3] -> any x s.t. length(x) <= b1 or length(x) > b3 are discarded.
293
+ """
294
+
295
+ def __init__(
296
+ self,
297
+ dataset,
298
+ batch_size,
299
+ boundaries,
300
+ num_replicas=None,
301
+ rank=None,
302
+ shuffle=True,
303
+ ):
304
+ super().__init__(dataset, num_replicas=num_replicas, rank=rank, shuffle=shuffle)
305
+ self.lengths = dataset.lengths
306
+ self.batch_size = batch_size
307
+ self.boundaries = boundaries
308
+
309
+ self.buckets, self.num_samples_per_bucket = self._create_buckets()
310
+ self.total_size = sum(self.num_samples_per_bucket)
311
+ self.num_samples = self.total_size // self.num_replicas
312
+ print('buckets:', self.num_samples_per_bucket)
313
+
314
+ def _create_buckets(self):
315
+ buckets = [[] for _ in range(len(self.boundaries) - 1)]
316
+ for i in range(len(self.lengths)):
317
+ length = self.lengths[i]
318
+ idx_bucket = self._bisect(length)
319
+ if idx_bucket != -1:
320
+ buckets[idx_bucket].append(i)
321
+
322
+ try:
323
+ for i in range(len(buckets) - 1, 0, -1):
324
+ if len(buckets[i]) == 0:
325
+ buckets.pop(i)
326
+ self.boundaries.pop(i + 1)
327
+ assert all(len(bucket) > 0 for bucket in buckets)
328
+ # When one bucket is not traversed
329
+ except Exception as e:
330
+ print("Bucket warning ", e)
331
+ for i in range(len(buckets) - 1, -1, -1):
332
+ if len(buckets[i]) == 0:
333
+ buckets.pop(i)
334
+ self.boundaries.pop(i + 1)
335
+
336
+ num_samples_per_bucket = []
337
+ for i in range(len(buckets)):
338
+ len_bucket = len(buckets[i])
339
+ total_batch_size = self.num_replicas * self.batch_size
340
+ rem = (
341
+ total_batch_size - (len_bucket % total_batch_size)
342
+ ) % total_batch_size
343
+ num_samples_per_bucket.append(len_bucket + rem)
344
+ return buckets, num_samples_per_bucket
345
+
346
+ def __iter__(self):
347
+ # deterministically shuffle based on epoch
348
+ g = torch.Generator()
349
+ g.manual_seed(self.epoch)
350
+
351
+ indices = []
352
+ if self.shuffle:
353
+ for bucket in self.buckets:
354
+ indices.append(torch.randperm(len(bucket), generator=g).tolist())
355
+ else:
356
+ for bucket in self.buckets:
357
+ indices.append(list(range(len(bucket))))
358
+
359
+ batches = []
360
+ for i in range(len(self.buckets)):
361
+ bucket = self.buckets[i]
362
+ len_bucket = len(bucket)
363
+ if len_bucket == 0:
364
+ continue
365
+ ids_bucket = indices[i]
366
+ num_samples_bucket = self.num_samples_per_bucket[i]
367
+
368
+ # add extra samples to make it evenly divisible
369
+ rem = num_samples_bucket - len_bucket
370
+ ids_bucket = (
371
+ ids_bucket
372
+ + ids_bucket * (rem // len_bucket)
373
+ + ids_bucket[: (rem % len_bucket)]
374
+ )
375
+
376
+ # subsample
377
+ ids_bucket = ids_bucket[self.rank :: self.num_replicas]
378
+
379
+ # batching
380
+ for j in range(len(ids_bucket) // self.batch_size):
381
+ batch = [
382
+ bucket[idx]
383
+ for idx in ids_bucket[
384
+ j * self.batch_size : (j + 1) * self.batch_size
385
+ ]
386
+ ]
387
+ batches.append(batch)
388
+
389
+ if self.shuffle:
390
+ batch_ids = torch.randperm(len(batches), generator=g).tolist()
391
+ batches = [batches[i] for i in batch_ids]
392
+ self.batches = batches
393
+
394
+ assert len(self.batches) * self.batch_size == self.num_samples
395
+ return iter(self.batches)
396
+
397
+ def _bisect(self, x, lo=0, hi=None):
398
+ if hi is None:
399
+ hi = len(self.boundaries) - 1
400
+
401
+ if hi > lo:
402
+ mid = (hi + lo) // 2
403
+ if self.boundaries[mid] < x and x <= self.boundaries[mid + 1]:
404
+ return mid
405
+ elif x <= self.boundaries[mid]:
406
+ return self._bisect(x, lo, mid)
407
+ else:
408
+ return self._bisect(x, mid + 1, hi)
409
+ else:
410
+ return -1
411
+
412
+ def __len__(self):
413
+ return self.num_samples // self.batch_size
melo/download_utils.py CHANGED
@@ -1,47 +1,67 @@
1
  import torch
2
  import os
3
  from . import utils
 
 
4
 
5
  DOWNLOAD_CKPT_URLS = {
6
- 'EN': 'https://myshell-public-repo-hosting.s3.amazonaws.com/openvoice/basespeakers/EN/checkpoint.pth',
7
- 'EN_V2': 'https://myshell-public-repo-hosting.s3.amazonaws.com/openvoice/basespeakers/EN_V2/checkpoint.pth',
8
- 'FR': 'https://myshell-public-repo-hosting.s3.amazonaws.com/openvoice/basespeakers/FR/checkpoint.pth',
9
- 'JP': 'https://myshell-public-repo-hosting.s3.amazonaws.com/openvoice/basespeakers/JP/checkpoint.pth',
10
- 'ES': 'https://myshell-public-repo-hosting.s3.amazonaws.com/openvoice/basespeakers/ES/checkpoint.pth',
11
- 'ZH': 'https://myshell-public-repo-hosting.s3.amazonaws.com/openvoice/basespeakers/ZH/checkpoint.pth',
12
- 'KR': 'https://myshell-public-repo-hosting.s3.amazonaws.com/openvoice/basespeakers/KR/checkpoint.pth',
13
  }
14
 
15
  DOWNLOAD_CONFIG_URLS = {
16
- 'EN': 'https://myshell-public-repo-hosting.s3.amazonaws.com/openvoice/basespeakers/EN/config.json',
17
- 'EN_V2': 'https://myshell-public-repo-hosting.s3.amazonaws.com/openvoice/basespeakers/EN_V2/config.json',
18
- 'FR': 'https://myshell-public-repo-hosting.s3.amazonaws.com/openvoice/basespeakers/FR/config.json',
19
- 'JP': 'https://myshell-public-repo-hosting.s3.amazonaws.com/openvoice/basespeakers/JP/config.json',
20
- 'ES': 'https://myshell-public-repo-hosting.s3.amazonaws.com/openvoice/basespeakers/ES/config.json',
21
- 'ZH': 'https://myshell-public-repo-hosting.s3.amazonaws.com/openvoice/basespeakers/ZH/config.json',
22
- 'KR': 'https://myshell-public-repo-hosting.s3.amazonaws.com/openvoice/basespeakers/KR/config.json',
23
  }
24
 
25
- def load_or_download_config(locale):
26
- language = locale.split('-')[0].upper()
27
- assert language in DOWNLOAD_CONFIG_URLS
28
- config_path = os.path.expanduser(f'~/.local/share/openvoice/basespeakers/{language}/config.json')
29
- try:
30
- return utils.get_hparams_from_file(config_path)
31
- except:
32
- # download
33
- os.makedirs(os.path.dirname(config_path), exist_ok=True)
34
- os.system(f'wget {DOWNLOAD_CONFIG_URLS[language]} -O {config_path}')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  return utils.get_hparams_from_file(config_path)
36
 
37
- def load_or_download_model(locale, device):
38
- language = locale.split('-')[0].upper()
39
- assert language in DOWNLOAD_CKPT_URLS
40
- ckpt_path = os.path.expanduser(f'~/.local/share/openvoice/basespeakers/{language}/checkpoint.pth')
41
- try:
42
- return torch.load(ckpt_path, map_location=device)
43
- except:
44
- # download
45
- os.makedirs(os.path.dirname(ckpt_path), exist_ok=True)
46
- os.system(f'wget {DOWNLOAD_CKPT_URLS[language]} -O {ckpt_path}')
47
- return torch.load(ckpt_path, map_location=device)
 
 
 
1
  import torch
2
  import os
3
  from . import utils
4
+ from cached_path import cached_path
5
+ from huggingface_hub import hf_hub_download
6
 
7
  DOWNLOAD_CKPT_URLS = {
8
+ 'EN': 'https://myshell-public-repo-host.s3.amazonaws.com/openvoice/basespeakers/EN/checkpoint.pth',
9
+ 'EN_V2': 'https://myshell-public-repo-host.s3.amazonaws.com/openvoice/basespeakers/EN_V2/checkpoint.pth',
10
+ 'FR': 'https://myshell-public-repo-host.s3.amazonaws.com/openvoice/basespeakers/FR/checkpoint.pth',
11
+ 'JP': 'https://myshell-public-repo-host.s3.amazonaws.com/openvoice/basespeakers/JP/checkpoint.pth',
12
+ 'ES': 'https://myshell-public-repo-host.s3.amazonaws.com/openvoice/basespeakers/ES/checkpoint.pth',
13
+ 'ZH': 'https://myshell-public-repo-host.s3.amazonaws.com/openvoice/basespeakers/ZH/checkpoint.pth',
14
+ 'KR': 'https://myshell-public-repo-host.s3.amazonaws.com/openvoice/basespeakers/KR/checkpoint.pth',
15
  }
16
 
17
  DOWNLOAD_CONFIG_URLS = {
18
+ 'EN': 'https://myshell-public-repo-host.s3.amazonaws.com/openvoice/basespeakers/EN/config.json',
19
+ 'EN_V2': 'https://myshell-public-repo-host.s3.amazonaws.com/openvoice/basespeakers/EN_V2/config.json',
20
+ 'FR': 'https://myshell-public-repo-host.s3.amazonaws.com/openvoice/basespeakers/FR/config.json',
21
+ 'JP': 'https://myshell-public-repo-host.s3.amazonaws.com/openvoice/basespeakers/JP/config.json',
22
+ 'ES': 'https://myshell-public-repo-host.s3.amazonaws.com/openvoice/basespeakers/ES/config.json',
23
+ 'ZH': 'https://myshell-public-repo-host.s3.amazonaws.com/openvoice/basespeakers/ZH/config.json',
24
+ 'KR': 'https://myshell-public-repo-host.s3.amazonaws.com/openvoice/basespeakers/KR/config.json',
25
  }
26
 
27
+ PRETRAINED_MODELS = {
28
+ 'G.pth': 'https://myshell-public-repo-host.s3.amazonaws.com/openvoice/basespeakers/pretrained/G.pth',
29
+ 'D.pth': 'https://myshell-public-repo-host.s3.amazonaws.com/openvoice/basespeakers/pretrained/D.pth',
30
+ 'DUR.pth': 'https://myshell-public-repo-host.s3.amazonaws.com/openvoice/basespeakers/pretrained/DUR.pth',
31
+ }
32
+
33
+ LANG_TO_HF_REPO_ID = {
34
+ 'EN': 'myshell-ai/MeloTTS-English',
35
+ 'EN_V2': 'myshell-ai/MeloTTS-English-v2',
36
+ 'EN_NEWEST': 'myshell-ai/MeloTTS-English-v3',
37
+ 'FR': 'myshell-ai/MeloTTS-French',
38
+ 'JP': 'myshell-ai/MeloTTS-Japanese',
39
+ 'ES': 'myshell-ai/MeloTTS-Spanish',
40
+ 'ZH': 'myshell-ai/MeloTTS-Chinese',
41
+ 'KR': 'myshell-ai/MeloTTS-Korean',
42
+ }
43
+
44
+ def load_or_download_config(locale, use_hf=True, config_path=None):
45
+ if config_path is None:
46
+ language = locale.split('-')[0].upper()
47
+ if use_hf:
48
+ assert language in LANG_TO_HF_REPO_ID
49
+ config_path = hf_hub_download(repo_id=LANG_TO_HF_REPO_ID[language], filename="config.json")
50
+ else:
51
+ assert language in DOWNLOAD_CONFIG_URLS
52
+ config_path = cached_path(DOWNLOAD_CONFIG_URLS[language])
53
  return utils.get_hparams_from_file(config_path)
54
 
55
+ def load_or_download_model(locale, device, use_hf=True, ckpt_path=None):
56
+ if ckpt_path is None:
57
+ language = locale.split('-')[0].upper()
58
+ if use_hf:
59
+ assert language in LANG_TO_HF_REPO_ID
60
+ ckpt_path = hf_hub_download(repo_id=LANG_TO_HF_REPO_ID[language], filename="checkpoint.pth")
61
+ else:
62
+ assert language in DOWNLOAD_CKPT_URLS
63
+ ckpt_path = cached_path(DOWNLOAD_CKPT_URLS[language])
64
+ return torch.load(ckpt_path, map_location=device)
65
+
66
+ def load_pretrain_model():
67
+ return [cached_path(url) for url in PRETRAINED_MODELS.values()]
melo/infer.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import click
3
+ from melo.api import TTS
4
+
5
+
6
+
7
+ @click.command()
8
+ @click.option('--ckpt_path', '-m', type=str, default=None, help="Path to the checkpoint file")
9
+ @click.option('--text', '-t', type=str, default=None, help="Text to speak")
10
+ @click.option('--language', '-l', type=str, default="EN", help="Language of the model")
11
+ @click.option('--output_dir', '-o', type=str, default="outputs", help="Path to the output")
12
+ def main(ckpt_path, text, language, output_dir):
13
+ if ckpt_path is None:
14
+ raise ValueError("The model_path must be specified")
15
+
16
+ config_path = os.path.join(os.path.dirname(ckpt_path), 'config.json')
17
+ model = TTS(language=language, config_path=config_path, ckpt_path=ckpt_path)
18
+
19
+ for spk_name, spk_id in model.hps.data.spk2id.items():
20
+ save_path = f'{output_dir}/{spk_name}/output.wav'
21
+ os.makedirs(os.path.dirname(save_path), exist_ok=True)
22
+ model.tts_to_file(text, spk_id, save_path)
23
+
24
+ if __name__ == "__main__":
25
+ main()
melo/init_downloads.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ if __name__ == '__main__':
4
+
5
+ from melo.api import TTS
6
+ device = 'auto'
7
+ models = {
8
+ 'EN': TTS(language='EN', device=device),
9
+ 'ES': TTS(language='ES', device=device),
10
+ 'FR': TTS(language='FR', device=device),
11
+ 'ZH': TTS(language='ZH', device=device),
12
+ 'JP': TTS(language='JP', device=device),
13
+ 'KR': TTS(language='KR', device=device),
14
+ }
melo/losses.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+
3
+
4
+ def feature_loss(fmap_r, fmap_g):
5
+ loss = 0
6
+ for dr, dg in zip(fmap_r, fmap_g):
7
+ for rl, gl in zip(dr, dg):
8
+ rl = rl.float().detach()
9
+ gl = gl.float()
10
+ loss += torch.mean(torch.abs(rl - gl))
11
+
12
+ return loss * 2
13
+
14
+
15
+ def discriminator_loss(disc_real_outputs, disc_generated_outputs):
16
+ loss = 0
17
+ r_losses = []
18
+ g_losses = []
19
+ for dr, dg in zip(disc_real_outputs, disc_generated_outputs):
20
+ dr = dr.float()
21
+ dg = dg.float()
22
+ r_loss = torch.mean((1 - dr) ** 2)
23
+ g_loss = torch.mean(dg**2)
24
+ loss += r_loss + g_loss
25
+ r_losses.append(r_loss.item())
26
+ g_losses.append(g_loss.item())
27
+
28
+ return loss, r_losses, g_losses
29
+
30
+
31
+ def generator_loss(disc_outputs):
32
+ loss = 0
33
+ gen_losses = []
34
+ for dg in disc_outputs:
35
+ dg = dg.float()
36
+ l = torch.mean((1 - dg) ** 2)
37
+ gen_losses.append(l)
38
+ loss += l
39
+
40
+ return loss, gen_losses
41
+
42
+
43
+ def kl_loss(z_p, logs_q, m_p, logs_p, z_mask):
44
+ """
45
+ z_p, logs_q: [b, h, t_t]
46
+ m_p, logs_p: [b, h, t_t]
47
+ """
48
+ z_p = z_p.float()
49
+ logs_q = logs_q.float()
50
+ m_p = m_p.float()
51
+ logs_p = logs_p.float()
52
+ z_mask = z_mask.float()
53
+
54
+ kl = logs_p - logs_q - 0.5
55
+ kl += 0.5 * ((z_p - m_p) ** 2) * torch.exp(-2.0 * logs_p)
56
+ kl = torch.sum(kl * z_mask)
57
+ l = kl / torch.sum(z_mask)
58
+ return l
melo/main.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import click
2
+ import warnings
3
+ import os
4
+
5
+
6
+ @click.command
7
+ @click.argument('text')
8
+ @click.argument('output_path')
9
+ @click.option("--file", '-f', is_flag=True, show_default=True, default=False, help="Text is a file")
10
+ @click.option('--language', '-l', default='EN', help='Language, defaults to English', type=click.Choice(['EN', 'ES', 'FR', 'ZH', 'JP', 'KR'], case_sensitive=False))
11
+ @click.option('--speaker', '-spk', default='EN-Default', help='Speaker ID, only for English, leave empty for default, ignored if not English. If English, defaults to "EN-Default"', type=click.Choice(['EN-Default', 'EN-US', 'EN-BR', 'EN_INDIA', 'EN-AU']))
12
+ @click.option('--speed', '-s', default=1.0, help='Speed, defaults to 1.0', type=float)
13
+ @click.option('--device', '-d', default='auto', help='Device, defaults to auto')
14
+ def main(text, file, output_path, language, speaker, speed, device):
15
+ if file:
16
+ if not os.path.exists(text):
17
+ raise FileNotFoundError(f'Trying to load text from file due to --file/-f flag, but file not found. Remove the --file/-f flag to pass a string.')
18
+ else:
19
+ with open(text) as f:
20
+ text = f.read().strip()
21
+ if text == '':
22
+ raise ValueError('You entered empty text or the file you passed was empty.')
23
+ language = language.upper()
24
+ if language == '': language = 'EN'
25
+ if speaker == '': speaker = None
26
+ if (not language == 'EN') and speaker:
27
+ warnings.warn('You specified a speaker but the language is English.')
28
+ from melo.api import TTS
29
+ model = TTS(language=language, device=device)
30
+ speaker_ids = model.hps.data.spk2id
31
+ if language == 'EN':
32
+ if not speaker: speaker = 'EN-Default'
33
+ spkr = speaker_ids[speaker]
34
+ else:
35
+ spkr = speaker_ids[list(speaker_ids.keys())[0]]
36
+ model.tts_to_file(text, spkr, output_path, speed=speed)
melo/models.py CHANGED
@@ -3,14 +3,15 @@ import torch
3
  from torch import nn
4
  from torch.nn import functional as F
5
 
6
- from . import commons
7
- from . import modules
8
- from . import attentions
9
 
10
  from torch.nn import Conv1d, ConvTranspose1d, Conv2d
11
  from torch.nn.utils import weight_norm, remove_weight_norm, spectral_norm
12
 
13
- from .commons import init_weights, get_padding
 
14
 
15
 
16
  class DurationDiscriminator(nn.Module): # vits2
@@ -782,7 +783,6 @@ class SynthesizerTrn(nn.Module):
782
  num_languages=None,
783
  num_tones=None,
784
  norm_refenc=False,
785
- use_se=False,
786
  **kwargs
787
  ):
788
  super().__init__()
@@ -878,16 +878,12 @@ class SynthesizerTrn(nn.Module):
878
  hidden_channels, 256, 3, 0.5, gin_channels=gin_channels
879
  )
880
 
881
- if n_speakers > 1:
882
- if use_se:
883
- emb_dim = 512
884
- self.emb_g = nn.Linear(emb_dim, gin_channels)
885
- else:
886
- self.emb_g = nn.Embedding(n_speakers, gin_channels)
887
  else:
888
  self.ref_enc = ReferenceEncoder(spec_channels, gin_channels, layernorm=norm_refenc)
889
  self.use_vc = use_vc
890
- self.use_se = use_se
891
 
892
  def forward(self, x, x_lengths, y, y_lengths, sid, tone, language, bert, ja_bert):
893
  if self.n_speakers > 0:
@@ -1024,11 +1020,7 @@ class SynthesizerTrn(nn.Module):
1024
  # print('max/min of o:', o.max(), o.min())
1025
  return o, attn, y_mask, (z, z_p, m_p, logs_p)
1026
 
1027
- def voice_conversion(self, y, y_lengths, sid_src, sid_tgt, tau=1.0):
1028
- if self.use_se:
1029
- sid_src = self.emb_g(sid_src).unsqueeze(-1)
1030
- sid_tgt = self.emb_g(sid_tgt).unsqueeze(-1)
1031
-
1032
  g_src = sid_src
1033
  g_tgt = sid_tgt
1034
  z, m_q, logs_q, y_mask = self.enc_q(y, y_lengths, g=g_src, tau=tau)
 
3
  from torch import nn
4
  from torch.nn import functional as F
5
 
6
+ from melo import commons
7
+ from melo import modules
8
+ from melo import attentions
9
 
10
  from torch.nn import Conv1d, ConvTranspose1d, Conv2d
11
  from torch.nn.utils import weight_norm, remove_weight_norm, spectral_norm
12
 
13
+ from melo.commons import init_weights, get_padding
14
+ import melo.monotonic_align as monotonic_align
15
 
16
 
17
  class DurationDiscriminator(nn.Module): # vits2
 
783
  num_languages=None,
784
  num_tones=None,
785
  norm_refenc=False,
 
786
  **kwargs
787
  ):
788
  super().__init__()
 
878
  hidden_channels, 256, 3, 0.5, gin_channels=gin_channels
879
  )
880
 
881
+ if n_speakers > 0:
882
+ self.emb_g = nn.Embedding(n_speakers, gin_channels)
 
 
 
 
883
  else:
884
  self.ref_enc = ReferenceEncoder(spec_channels, gin_channels, layernorm=norm_refenc)
885
  self.use_vc = use_vc
886
+
887
 
888
  def forward(self, x, x_lengths, y, y_lengths, sid, tone, language, bert, ja_bert):
889
  if self.n_speakers > 0:
 
1020
  # print('max/min of o:', o.max(), o.min())
1021
  return o, attn, y_mask, (z, z_p, m_p, logs_p)
1022
 
1023
+ def voice_conversion(self, y, y_lengths, sid_src, sid_tgt, tau=1.0):
 
 
 
 
1024
  g_src = sid_src
1025
  g_tgt = sid_tgt
1026
  z, m_q, logs_q, y_mask = self.enc_q(y, y_lengths, g=g_src, tau=tau)
melo/monotonic_align/__init__.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from numpy import zeros, int32, float32
2
+ from torch import from_numpy
3
+
4
+ from .core import maximum_path_jit
5
+
6
+
7
+ def maximum_path(neg_cent, mask):
8
+ device = neg_cent.device
9
+ dtype = neg_cent.dtype
10
+ neg_cent = neg_cent.data.cpu().numpy().astype(float32)
11
+ path = zeros(neg_cent.shape, dtype=int32)
12
+
13
+ t_t_max = mask.sum(1)[:, 0].data.cpu().numpy().astype(int32)
14
+ t_s_max = mask.sum(2)[:, 0].data.cpu().numpy().astype(int32)
15
+ maximum_path_jit(path, neg_cent, t_t_max, t_s_max)
16
+ return from_numpy(path).to(device=device, dtype=dtype)
melo/monotonic_align/core.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numba
2
+
3
+
4
+ @numba.jit(
5
+ numba.void(
6
+ numba.int32[:, :, ::1],
7
+ numba.float32[:, :, ::1],
8
+ numba.int32[::1],
9
+ numba.int32[::1],
10
+ ),
11
+ nopython=True,
12
+ nogil=True,
13
+ )
14
+ def maximum_path_jit(paths, values, t_ys, t_xs):
15
+ b = paths.shape[0]
16
+ max_neg_val = -1e9
17
+ for i in range(int(b)):
18
+ path = paths[i]
19
+ value = values[i]
20
+ t_y = t_ys[i]
21
+ t_x = t_xs[i]
22
+
23
+ v_prev = v_cur = 0.0
24
+ index = t_x - 1
25
+
26
+ for y in range(t_y):
27
+ for x in range(max(0, t_x + y - t_y), min(t_x, y + 1)):
28
+ if x == y:
29
+ v_cur = max_neg_val
30
+ else:
31
+ v_cur = value[y - 1, x]
32
+ if x == 0:
33
+ if y == 0:
34
+ v_prev = 0.0
35
+ else:
36
+ v_prev = max_neg_val
37
+ else:
38
+ v_prev = value[y - 1, x - 1]
39
+ value[y, x] += max(v_prev, v_cur)
40
+
41
+ for y in range(t_y - 1, -1, -1):
42
+ path[y, index] = 1
43
+ if index != 0 and (
44
+ index == y or value[y - 1, index] < value[y - 1, index - 1]
45
+ ):
46
+ index = index - 1
melo/preprocess_text.py ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ from collections import defaultdict
3
+ from random import shuffle
4
+ from typing import Optional
5
+
6
+ from tqdm import tqdm
7
+ import click
8
+ from text.cleaner import clean_text_bert
9
+ import os
10
+ import torch
11
+ from text.symbols import symbols, num_languages, num_tones
12
+
13
+ @click.command()
14
+ @click.option(
15
+ "--metadata",
16
+ default="data/example/metadata.list",
17
+ type=click.Path(exists=True, file_okay=True, dir_okay=False),
18
+ )
19
+ @click.option("--cleaned-path", default=None)
20
+ @click.option("--train-path", default=None)
21
+ @click.option("--val-path", default=None)
22
+ @click.option(
23
+ "--config_path",
24
+ default="configs/config.json",
25
+ type=click.Path(exists=True, file_okay=True, dir_okay=False),
26
+ )
27
+ @click.option("--val-per-spk", default=4)
28
+ @click.option("--max-val-total", default=8)
29
+ @click.option("--clean/--no-clean", default=True)
30
+ def main(
31
+ metadata: str,
32
+ cleaned_path: Optional[str],
33
+ train_path: str,
34
+ val_path: str,
35
+ config_path: str,
36
+ val_per_spk: int,
37
+ max_val_total: int,
38
+ clean: bool,
39
+ ):
40
+ if train_path is None:
41
+ train_path = os.path.join(os.path.dirname(metadata), 'train.list')
42
+ if val_path is None:
43
+ val_path = os.path.join(os.path.dirname(metadata), 'val.list')
44
+ out_config_path = os.path.join(os.path.dirname(metadata), 'config.json')
45
+
46
+ if cleaned_path is None:
47
+ cleaned_path = metadata + ".cleaned"
48
+
49
+ if clean:
50
+ out_file = open(cleaned_path, "w", encoding="utf-8")
51
+ new_symbols = []
52
+ for line in tqdm(open(metadata, encoding="utf-8").readlines()):
53
+ try:
54
+ utt, spk, language, text = line.strip().split("|")
55
+ norm_text, phones, tones, word2ph, bert = clean_text_bert(text, language, device='cuda:0')
56
+ for ph in phones:
57
+ if ph not in symbols and ph not in new_symbols:
58
+ new_symbols.append(ph)
59
+ print('update!, now symbols:')
60
+ print(new_symbols)
61
+ with open(f'{language}_symbol.txt', 'w') as f:
62
+ f.write(f'{new_symbols}')
63
+
64
+ assert len(phones) == len(tones)
65
+ assert len(phones) == sum(word2ph)
66
+ out_file.write(
67
+ "{}|{}|{}|{}|{}|{}|{}\n".format(
68
+ utt,
69
+ spk,
70
+ language,
71
+ norm_text,
72
+ " ".join(phones),
73
+ " ".join([str(i) for i in tones]),
74
+ " ".join([str(i) for i in word2ph]),
75
+ )
76
+ )
77
+ bert_path = utt.replace(".wav", ".bert.pt")
78
+ os.makedirs(os.path.dirname(bert_path), exist_ok=True)
79
+ torch.save(bert.cpu(), bert_path)
80
+ except Exception as error:
81
+ print("err!", line, error)
82
+
83
+ out_file.close()
84
+
85
+ metadata = cleaned_path
86
+
87
+ spk_utt_map = defaultdict(list)
88
+ spk_id_map = {}
89
+ current_sid = 0
90
+
91
+ with open(metadata, encoding="utf-8") as f:
92
+ for line in f.readlines():
93
+ utt, spk, language, text, phones, tones, word2ph = line.strip().split("|")
94
+ spk_utt_map[spk].append(line)
95
+
96
+ if spk not in spk_id_map.keys():
97
+ spk_id_map[spk] = current_sid
98
+ current_sid += 1
99
+
100
+ train_list = []
101
+ val_list = []
102
+
103
+ for spk, utts in spk_utt_map.items():
104
+ shuffle(utts)
105
+ val_list += utts[:val_per_spk]
106
+ train_list += utts[val_per_spk:]
107
+
108
+ if len(val_list) > max_val_total:
109
+ train_list += val_list[max_val_total:]
110
+ val_list = val_list[:max_val_total]
111
+
112
+ with open(train_path, "w", encoding="utf-8") as f:
113
+ for line in train_list:
114
+ f.write(line)
115
+
116
+ with open(val_path, "w", encoding="utf-8") as f:
117
+ for line in val_list:
118
+ f.write(line)
119
+
120
+ config = json.load(open(config_path, encoding="utf-8"))
121
+ config["data"]["spk2id"] = spk_id_map
122
+
123
+ config["data"]["training_files"] = train_path
124
+ config["data"]["validation_files"] = val_path
125
+ config["data"]["n_speakers"] = len(spk_id_map)
126
+ config["num_languages"] = num_languages
127
+ config["num_tones"] = num_tones
128
+ config["symbols"] = symbols
129
+
130
+ with open(out_config_path, "w", encoding="utf-8") as f:
131
+ json.dump(config, f, indent=2, ensure_ascii=False)
132
+
133
+
134
+ if __name__ == "__main__":
135
+ main()
melo/split_utils.py CHANGED
@@ -4,41 +4,24 @@ import glob
4
  import numpy as np
5
  import soundfile as sf
6
  import torchaudio
7
- from txtsplit import txtsplit
 
8
  def split_sentence(text, min_len=10, language_str='EN'):
9
- if language_str in ['EN', 'FR', 'ES', 'SP', 'DE', 'RU']:
10
  sentences = split_sentences_latin(text, min_len=min_len)
11
  else:
12
  sentences = split_sentences_zh(text, min_len=min_len)
13
  return sentences
14
 
 
15
  def split_sentences_latin(text, min_len=10):
16
  text = re.sub('[。!?;]', '.', text)
17
  text = re.sub('[,]', ',', text)
18
  text = re.sub('[“”]', '"', text)
19
  text = re.sub('[‘’]', "'", text)
20
  text = re.sub(r"[\<\>\(\)\[\]\"\«\»]+", "", text)
21
- return [item.strip() for item in txtsplit(text, 512, 512) if item.strip()]
22
- # 将文本中的换行符、空格和制表符替换为空格
23
- # text = re.sub('[\n\t ]+', ' ', text)
24
- # # 在标点符号后添加一个空格
25
- # text = re.sub('([,.!?;])', r'\1 $#!', text)
26
- # # 分隔句子并去除前后空格
27
- # sentences = [s.strip() for s in text.split('$#!')]
28
- # if len(sentences[-1]) == 0: del sentences[-1]
29
-
30
- # new_sentences = []
31
- # new_sent = []
32
- # count_len = 0
33
- # for ind, sent in enumerate(sentences):
34
- # # print(sent)
35
- # new_sent.append(sent)
36
- # count_len += len(sent.split(" "))
37
- # if count_len > min_len or ind == len(sentences) - 1:
38
- # count_len = 0
39
- # new_sentences.append(' '.join(new_sent))
40
- # new_sent = []
41
- # return merge_short_sentences_en(new_sentences)
42
 
43
  def split_sentences_zh(text, min_len=10):
44
  text = re.sub('[。!?;]', '.', text)
@@ -64,6 +47,7 @@ def split_sentences_zh(text, min_len=10):
64
  new_sent = []
65
  return merge_short_sentences_zh(new_sentences)
66
 
 
67
  def merge_short_sentences_en(sens):
68
  """Avoid short sentences by merging them with the following sentence.
69
 
@@ -89,6 +73,7 @@ def merge_short_sentences_en(sens):
89
  pass
90
  return sens_out
91
 
 
92
  def merge_short_sentences_zh(sens):
93
  # return sens
94
  """Avoid short sentences by merging them with the following sentence.
@@ -116,16 +101,74 @@ def merge_short_sentences_zh(sens):
116
  return sens_out
117
 
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  if __name__ == '__main__':
120
  zh_text = "好的,我来给你讲一个故事吧。从前有一个小姑娘,她叫做小红。小红非常喜欢在森林里玩耍,她经常会和她的小伙伴们一起去探险。有一天,小红和她的小伙伴们走到了森林深处,突然遇到了一只凶猛的野兽。小红的小伙伴们都吓得不敢动弹,但是小红并没有被吓倒,她勇敢地走向野兽,用她的智慧和勇气成功地制服了野兽,保护了她的小伙伴们。从那以后,小红变得更加勇敢和自信,成为了她小伙伴们心中的英雄。"
121
  en_text = "I didn’t know what to do. I said please kill her because it would be better than being kidnapped,” Ben, whose surname CNN is not using for security concerns, said on Wednesday. “It’s a nightmare. I said ‘please kill her, don’t take her there.’"
122
  sp_text = "¡Claro! ¿En qué tema te gustaría que te hable en español? Puedo proporcionarte información o conversar contigo sobre una amplia variedad de temas, desde cultura y comida hasta viajes y tecnología. ¿Tienes alguna preferencia en particular?"
123
  fr_text = "Bien sûr ! En quelle matière voudriez-vous que je vous parle en français ? Je peux vous fournir des informations ou discuter avec vous sur une grande variété de sujets, que ce soit la culture, la nourriture, les voyages ou la technologie. Avez-vous une préférence particulière ?"
124
- de_text = 'Es war das Wichtigste was wir sichern wollten da es keine Möglichkeit gab eine 20 Megatonnen- H- Bombe ab zu werfen von einem 30, C124.'
125
- ru_text = 'Но он был во многом, как-бы, всё равно что сын плантатора, так как являлся сыном человека, у которого было в собственности много чего.'
126
  print(split_sentence(zh_text, language_str='ZH'))
127
  print(split_sentence(en_text, language_str='EN'))
128
  print(split_sentence(sp_text, language_str='SP'))
129
  print(split_sentence(fr_text, language_str='FR'))
130
- print(split_sentence(de_text, language_str='DE'))
131
- print(split_sentence(ru_text, language_str='RU'))
 
4
  import numpy as np
5
  import soundfile as sf
6
  import torchaudio
7
+ import re
8
+
9
  def split_sentence(text, min_len=10, language_str='EN'):
10
+ if language_str in ['EN', 'FR', 'ES', 'SP']:
11
  sentences = split_sentences_latin(text, min_len=min_len)
12
  else:
13
  sentences = split_sentences_zh(text, min_len=min_len)
14
  return sentences
15
 
16
+
17
  def split_sentences_latin(text, min_len=10):
18
  text = re.sub('[。!?;]', '.', text)
19
  text = re.sub('[,]', ',', text)
20
  text = re.sub('[“”]', '"', text)
21
  text = re.sub('[‘’]', "'", text)
22
  text = re.sub(r"[\<\>\(\)\[\]\"\«\»]+", "", text)
23
+ return [item.strip() for item in txtsplit(text, 256, 512) if item.strip()]
24
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  def split_sentences_zh(text, min_len=10):
27
  text = re.sub('[。!?;]', '.', text)
 
47
  new_sent = []
48
  return merge_short_sentences_zh(new_sentences)
49
 
50
+
51
  def merge_short_sentences_en(sens):
52
  """Avoid short sentences by merging them with the following sentence.
53
 
 
73
  pass
74
  return sens_out
75
 
76
+
77
  def merge_short_sentences_zh(sens):
78
  # return sens
79
  """Avoid short sentences by merging them with the following sentence.
 
101
  return sens_out
102
 
103
 
104
+
105
+ def txtsplit(text, desired_length=100, max_length=200):
106
+ """Split text it into chunks of a desired length trying to keep sentences intact."""
107
+ text = re.sub(r'\n\n+', '\n', text)
108
+ text = re.sub(r'\s+', ' ', text)
109
+ text = re.sub(r'[""]', '"', text)
110
+ text = re.sub(r'([,.?!])', r'\1 ', text)
111
+ text = re.sub(r'\s+', ' ', text)
112
+
113
+ rv = []
114
+ in_quote = False
115
+ current = ""
116
+ split_pos = []
117
+ pos = -1
118
+ end_pos = len(text) - 1
119
+ def seek(delta):
120
+ nonlocal pos, in_quote, current
121
+ is_neg = delta < 0
122
+ for _ in range(abs(delta)):
123
+ if is_neg:
124
+ pos -= 1
125
+ current = current[:-1]
126
+ else:
127
+ pos += 1
128
+ current += text[pos]
129
+ if text[pos] == '"':
130
+ in_quote = not in_quote
131
+ return text[pos]
132
+ def peek(delta):
133
+ p = pos + delta
134
+ return text[p] if p < end_pos and p >= 0 else ""
135
+ def commit():
136
+ nonlocal rv, current, split_pos
137
+ rv.append(current)
138
+ current = ""
139
+ split_pos = []
140
+ while pos < end_pos:
141
+ c = seek(1)
142
+ if len(current) >= max_length:
143
+ if len(split_pos) > 0 and len(current) > (desired_length / 2):
144
+ d = pos - split_pos[-1]
145
+ seek(-d)
146
+ else:
147
+ while c not in '!?.\n ' and pos > 0 and len(current) > desired_length:
148
+ c = seek(-1)
149
+ commit()
150
+ elif not in_quote and (c in '!?\n' or (c in '.,' and peek(1) in '\n ')):
151
+ while pos < len(text) - 1 and len(current) < max_length and peek(1) in '!?.':
152
+ c = seek(1)
153
+ split_pos.append(pos)
154
+ if len(current) >= desired_length:
155
+ commit()
156
+ elif in_quote and peek(1) == '"' and peek(2) in '\n ':
157
+ seek(2)
158
+ split_pos.append(pos)
159
+ rv.append(current)
160
+ rv = [s.strip() for s in rv]
161
+ rv = [s for s in rv if len(s) > 0 and not re.match(r'^[\s\.,;:!?]*$', s)]
162
+ return rv
163
+
164
+
165
  if __name__ == '__main__':
166
  zh_text = "好的,我来给你讲一个故事吧。从前有一个小姑娘,她叫做小红。小红非常喜欢在森林里玩耍,她经常会和她的小伙伴们一起去探险。有一天,小红和她的小伙伴们走到了森林深处,突然遇到了一只凶猛的野兽。小红的小伙伴们都吓得不敢动弹,但是小红并没有被吓倒,她勇敢地走向野兽,用她的智慧和勇气成功地制服了野兽,保护了她的小伙伴们。从那以后,小红变得更加勇敢和自信,成为了她小伙伴们心中的英雄。"
167
  en_text = "I didn’t know what to do. I said please kill her because it would be better than being kidnapped,” Ben, whose surname CNN is not using for security concerns, said on Wednesday. “It’s a nightmare. I said ‘please kill her, don’t take her there.’"
168
  sp_text = "¡Claro! ¿En qué tema te gustaría que te hable en español? Puedo proporcionarte información o conversar contigo sobre una amplia variedad de temas, desde cultura y comida hasta viajes y tecnología. ¿Tienes alguna preferencia en particular?"
169
  fr_text = "Bien sûr ! En quelle matière voudriez-vous que je vous parle en français ? Je peux vous fournir des informations ou discuter avec vous sur une grande variété de sujets, que ce soit la culture, la nourriture, les voyages ou la technologie. Avez-vous une préférence particulière ?"
170
+
 
171
  print(split_sentence(zh_text, language_str='ZH'))
172
  print(split_sentence(en_text, language_str='EN'))
173
  print(split_sentence(sp_text, language_str='SP'))
174
  print(split_sentence(fr_text, language_str='FR'))
 
 
melo/text/es_phonemizer/example_ipa.txt ADDED
@@ -0,0 +1,400 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ kapˈitulo ˈuno de daβˈid kˌoppeɾfjˈelð o el soβɾˈino de mi tˈia de tʃˈaɾles dˌiθjˈens.
2
+ ˈesta ɡɾˌaβaθjˈon de lˌiβɾˈiβoks ˈes de domˈinjo pˈuβliko.
3
+ si dˈeβo o nˈo sˈer el ˈeɾoe de mi pɾˈopja istˈoɾja, o si ˈeste kˌometˈiðo seɾˈa dˌesempeɲˈaðo poɾ ˈotɾa peɾsˈona ke nˈo ʝˈo,
4
+ ˈeso ˈes pɾeθˈisamˈente lo ke el lektˈoɾ beɾˈa en las siɣjˈɛntes pˈaxinas.
5
+ pˌaɾa pɾˌoθeðˈeɾ kon ˈoɾðen diɾˈe ke naθˈi, seɣˈun me ˈan dˈitʃo i lo kɾˈeo, ˈun bjˈeɾnes a las dˈoθe de la nˈotʃe.
6
+ notˈaɾon ke al mˈismo tjˈempo ke dˈaβa el ɾɾelˈox su pɾimˈeɾa kˌampanˈaða, lanθˈaβa ʝˈo sˌimultˈaneamˈente mi pɾimˈeɾ kexˈiðo.
7
+ tenjˈɛndo en kˌonsiðˌeɾaθjˈon el dˈia i ˈoɾa de mi nˌaθimjˈɛnto, la ˌemfeɾmˈeɾa de la paɾˈiða i bˈaɾjas komˈaðɾes de la bˌeθindˈad,
8
+ a kjˌenes aβˈia ˌinspiɾˈaðo ˈun bˈiβo ˌinteɾˈes alɣˈunos mˈeses ˈantes de tɾaβˈaɾ kˌonoθimjˈɛnto kon ˈeʎas, dˌeklaɾˈaɾon dˈos kˈosas.
9
+ la pɾimˈeɾa, ke estˈaβa pɾˌeðestinˈaðo a sˈer dˌesɣɾaθjˈaðo, i la seɣˈunda, ke ɡˌoθaɾˈia el pɾˌiβilˈexjo de bˈeɾ espˈektɾos i espˈiɾitus,
10
+ kˈaɾɣa ˌineβitˈaβle de tˈoðas las ˌimfoɾtunˈaðas kɾiatˈuɾas de ˈambos sˈeksos ke nˈaθen en bjˈeɾnes dˌesðe las dˈoθe de la nˈotʃe ˌasta el ˌamaneθˈeɾ.
11
+ ɾɾespˈekto al pɾimˈeɾ pˈunto nˈo me ˌeksplikaɾˈe akˈi, pwˈes mi istˈoɾja dˌemostɾaɾˈa sˌufiθjˈɛntemˈente si la pɾˌeðikθjˈon fwˈe o nˈo beɾˈiðika.
12
+ en kwˌanto al seɣˈundo, bˌastˈeme deθˈiɾ ke, a mˈenos de aβˈeɾ bˈisto espˈektɾos i espˈiɾitus kwˌando estˈaβa en la kˈuna,
13
+ sˈiɣo aˈun ˌaɣwaɾðˈandolos.
14
+ nˈo se kɾˈea ke me kˌondwˈelo poɾ la pɾˌiβaθjˈon de ˈesta pˈaɾte de mi eɾˈɛnθja, i si ˈalɣjen,
15
+ poɾ kˌaswaliðˈad, ˌembiðjaɾˈe mi pwˈesto, se lo θˈeðo kon ˈalma i bˈiða.
16
+ naθˈi de pjˈes, kˌomo deθˈiɾse swˈele, i la θjuðˈad ke me djˈo el sˈer fwˈe blundeɾstoun en el kondˈaðo de sˌuffolˈu o poɾ aʎˈi θˈeɾka,
17
+ fwˈi ˈun ˈixo pˈostumo, pwˈes aβɾˈi los ˈoxos al dˈia a los sˈeɪs mˈeses de aβˈeɾ θeɾɾˈaðo mi pˈaðɾe los sˈujjos pˌaɾa sjˈempɾe.
18
+ xamˈas ˌolβiðaɾˈe la ˌindeskɾipːtˈiβle lˈastima ke se ˌapoðeɾˈo de mˈi al fˌiɣuɾˈaɾme ke mi pˈaðɾe se beˈia aʎˈi ˌaβandonˈaðo,
19
+ sˈolo, en mˈeðjo de las tinjˈeβlas de la nˈotʃe, mjˌentɾas ke nwˌestɾa biβjˈɛnda, bjˈen templˈaða i ʎˈena de lˈuθ,
20
+ le θeɾɾˈaβa kɾuˈelmˈente sus pwˈeɾtas.
21
+ la peɾsˈona mˈas ˌimpoɾtˈante de nwˌestɾa famˈilja ˈeɾa ˈuna tˈia de mi pˈaðɾe, ke dˌesempˌeɲaɾˈa ˈun ˌimpoɾtˈante papˈel en mi ɾɾelˈato.
22
+ mˈiss tɾotwˈooð o mˈiss betse, kˌomo la ʎamˈaβa mi pˈoβɾe mˈaðɾe, kˈaða bˈeθ ke loɣɾˈaβa dˌominˈaɾ el teɾɾˈoɾ ke le ˌinspiɾˈaβa el aβlˈaɾ de sˌemexˈante peɾsˈona,
23
+ kˈosa ɾɾˈaɾa ˌentɾe paɾˈentesis, mˈiss betse se aβˈia kasˈaðo kon ˈun ˈombɾe mˈas xˈoβen ke ˈeʎa,
24
+ suxˈeto mˈujj ɡwˈapo, ˌaʊnke nˈo mˈujj bwˈeno, pwˈes seɣˈun el ɾɾumˈoɾ pˈuβliko, el maɾˈiðo θuɾɾˈo mˈas de ˈuna bˈeθ a su muxˈeɾ,
25
+ amˈen de ke θjˈeɾto dˈia, a pɾopˈosito de ˈuna kwestjˈon de suβsˈiðjos, tɾatˈo de ɾɾˌespondˈeɾ a la ˌoposiθjˈon de su kˈaɾa a mitˈad tiɾˈandola poɾ la bentˈana de ˈun pˈiso seɣˈundo.
26
+ sˌemexˈantes pɾuˈeβas de ˌinkompˌatiβˌiliðˈað de kaɾˈakteɾ aβˈian ˌoβliɣˈaðo a mˈiss betse a dˌesembˌaɾaθˈaɾse de ˈel poɾ mˈeðjo de dinˈeɾo i ˈambos espˈosos se sˌepaɾˈaɾon ˌamiɣˈaβlemˈente.
27
+ el tiɾˈano maɾtʃˈo kon su kˌapitˈal a la ˈindja, dˌonde seɣˈun ˈuna tɾˌaðiθjˈon de famˈilja, le aβˈian bˈisto ˈuna bˈeθ montˈaðo en ˈun ˌelefˈante i en kˌompaɲˈia de ˈun ɡɾˈan mˈono.
28
+ nˈo aβˈia poðˈiðo ˌaβeɾiɣwˈaɾse si ˈeste ˈeɾa ˈuna makˈaka o ˈun ˌaβeˈun, pɾinθˈesa del moɣˈol, kˌonoθˈiða tambjˈen kon el nˈombɾe de ˈuna baβˈu,
29
+ ˌaʊnke ʝˈo me inklˈino poɾ ˈesto ˈultimo.
30
+ sˈea de ˈeʎo lo ke kjˈeɾa, el kˈaso ˈes ke al kˈaβo de djˈeθ ˈaɲos ʎeɣˈo a ˌiŋɡlatˈeɾɾa la notˈiθja de su fˌaʎeθimjˈɛnto,
31
+ sin ke nˈaðje supjˈeɾa kˈomo, pwˈes asˈi ke se sˌepaɾˈaɾon, ˈeʎa tomˈo su ˌapeʎˈiðo de soltˈeɾa,
32
+ kompɾˈo ˈuna kˈasa pekˈeɲa en ˈuna alðˈea a oɾˈiʎas del mˈaɾ, dˌonde se ˌinstalˈo en kˌompaɲˈia de ˈuna kɾiˈaða,
33
+ kˌomo ˈuna bˌeɾðaðˈeɾa ɾɾeklˈusa.
34
+ mi pˈaðɾe aβˈia sˈiðo su soβɾˈino pɾˌeðilˈekto, seɣˈun tˈɛŋɡo ˌentendˈiðo, pˌeɾo ˈeʎa se djˈo poɾ sˈumamˈente ˌofendˈiða a pɾopˈosito de su mˌatɾimˈonjo bˌaxo pɾetˈeksto de ke mi mˈaðɾe nˈo ˈeɾa sˈino ˈuna muɲˈeka de θˈeɾa.
35
+ ˌaʊnke nˈo aβˈia bˈisto nˈunka a mi mˈaðɾe, saβˈia ke sˈolo kontˈaβa bˈeɪnte ˈaɲos.
36
+ mi pˈaðɾe i mis betse nˈo bolβjˈeɾon a bˈeɾse.
37
+ ˈel, al kasˈaɾse kon mi mˈaðɾe, tenˈia dˈoβles ˈaɲos ke ˈeʎa, i kˌomo su salˈud ˈeɾa dˌelikˈaða,
38
+ muɾjˈo al kˈaβo de ˈun ˈaɲo, o sˈea, kˌomo ʎˈeβo dˈitʃo, sˈeɪs mˈeses ˈantes de mi benˈiða al mˈundo.
39
+ ˈe akˈi el estˈaðo de la sˌitwaθjˈon en la tˈaɾðe de akˈel dˈia del mˈes de mˈaɾθo,
40
+ ke me pˌeɾmitiɾˈe kˌalifikˈaɾ de mˌemoɾˈaβle bjˈeɾnes.
41
+ aʎˈa bˈase mi mˈaðɾe, sentˈaða θˈeɾka del fwˈeɣo, emfˈeɾma, tɾˈiste, pensˈando en el pˈoβɾe wˈeɾfano ke ˈiβa a benˈiɾ al mˈundo,
42
+ kwˌando, alθˈando la bˈista, despwˈes de aβˈeɾ ˌeŋxuɣˈaðo alɣˈunas lˈaɣɾimas, ˌapeɾθiβjˈo a tɾaβˈes de la bentˈana ˈuna muxˈeɾ dˌeskonoθˈiða ke benˈia poɾ el xaɾðˈin.
43
+ mi mˈaðɾe tˈuβo el pɾˌesentimjˈɛnto de ke ˈeɾa mis betse.
44
+ aβˈia en su tˈaʎe, en su mˈoðo de andˈaɾ, en tˈoðo o en fˈin, tˈal ɾɾˌixiðˈeθ ke a bjˈen seɣˈuɾo nˈo poðˈia sˈer ˈotɾa mˈas ke ˈeʎa.
45
+ al ˌaθeɾkˈaɾse a la kˈasa, djˈo ˈuna nwˈeβa pɾuˈeβa de su ˌiðentiðˈað.
46
+ mi pˈaðɾe aβˈia ɾɾˌepetˈiðo mˈas de ˈuna bˈeθ ke la tˈal seɲˈoɾa nˈo se kˌonduθˈia nˈunka kˌomo los demˈas.
47
+ en bˈeθ de ʎamˈaɾ, se ˌaθeɾkˈo en dˌeɾetʃˈuɾa a la bentˈana poɾ dˌonde la aβˈia bˈisto mi mˈaðɾe i peɣˈo su ɾɾˈostɾo a los kɾistˈales.
48
+ ˈesta bisˈita pɾoðˈuxo tˈal ˌimpɾesjˈon ke sjˈempɾe ˈe tenˈiðo el kˌombenθimjˈɛnto ke si naθˈi en ˈun bjˈeɾnes se lo dˈeβo a mis betse.
49
+ mi mˈaðɾe, ʎˈena de espˈanto, se lˌeβantˈo de su sˈiʎa i se ɾɾˌetiɾˈo a ˈun ɾɾinkˈon,
50
+ mjˌentɾas ke mis betse ˌeskuðɾiɲˈaβa kon ˈoxos ˌinkisitoɾjˈales tˈoða la ˌaβitaθjˈon.
51
+ nˈo taɾðˈo en dˌistiŋɡˈiɾ a su soβɾˈina i le ˈiθo ˈun xˈesto pˌaɾa ke ˌakuðjˈese a aβɾˈiɾle la pwˈeɾta,
52
+ i kˌomo el tˈal xˈesto ˈeɾa el de ˈuna peɾsˈona ˌakostumbɾˈaða a aθˈeɾse ˌoβeðeθˈeɾ, mi mˈaðɾe ˌoβeðeθjˈo.
53
+ —supˈoŋɡo ke sˈoɪs mi tɾˈes daβˈid kˌoppeɾfjˈelð —dˈixo mis betse—
54
+ su supˈoŋɡo sˌiɡnifikˈaβa ke nˈo aβˈia matˈeɾja a ˌekiβˌokaθjˈon al bˈeɾ la bestˈiða de lˈuto i ˌaβokˈaða a sˈer mˈaðɾe.
55
+ —sˈi —ɾɾˌespondjˈo mi mˈaðɾe tˈimiðamˈente—
56
+ —sˈoɪ mˈiss tɾoˌutwˈooð —dˈixo la ɾɾeθjˈen ʎeɣˈaða—i espˈeɾo ke ˈantes de aˈoɾa aβɾˈeis oˈiðo aβlˈaɾ de mˈi.
57
+ —ˈe tenˈiðo ˈese ɡˈusto—ɾɾˌespondjˈo mi mˈaðɾe—
58
+ pwˈes bjˈen, sˈoɪ ʝˈo mˈisma en peɾsˈona.
59
+ mi mˈaðɾe baxˈo la kaβˈeθa, ɾɾoɣˈando a mis betse ke entɾˈase.
60
+ sˌentˈaɾonse xˈunto a la tʃˌimenˈea i mi mˈaðɾe se etʃˈo a ʎoɾˈaɾ.
61
+ —ta, ta, ta——dˈixo mis betse kon ˌimpaθjˈɛnθja—
62
+ —mi mˈaðɾe nˈo pˈuðo kˌontenˈeɾ sus lˈaɣɾimas sˈino al kˈaβo de alɣˈunos minˈutos.
63
+ —kitˈaos el sombɾˈeɾo, ˈixa mˈia, pˌaɾa ke pwˈeða bˈeɾos—ˌaɲaðjˈo la bjˈexa.
64
+ mi mˈaðɾe la tenˈia dˌemasjˈaðo mjˈeðo pˌaɾa neɣˈaɾse.
65
+ asˈi ˈes ke se dˌespoxˈo de su sombɾˈeɾo, ˌaʊnke kon tˈal ˌaxitaθjˈon, ke sus kaβˈeʎos, ke ˈeɾan sˈumamˈente eɾmˈosos,
66
+ —ˈa, djˈos de bondˈad, sˈoɪs ˈuna tʃikˈiʎa i nˈaða mˈas.
67
+ sin dˈuða ke mi mˈaðɾe tenˈia el ˈaɪɾe sˈumamˈente ˌaliɲˈaðo, pˌeɾo la bwˈena seɲˈoɾa ˌaθepːtˈo la ˌeksklamaθjˈon kˌomo ˈun ɾɾepɾˈotʃe mˌeɾeθˈiðo,
68
+ i ɾɾˌespondjˈo ke, en efˈekto, temˈia tenˈeɾ pˈoka ˌekspeɾjˈɛnθja kˌomo bjˈuða i kˌomo mˈaðɾe.
69
+ mˈiss betse pˌaɾeθjˈo ˌamansˈaɾse, i ˌenseɣˈiða, pasˈando bɾˈuskamˈente a ˈotɾa ˌinteɾpˌelaθjˈon, ˌeksklamˈo.
70
+ —¿poɾ kˈe se ʎˈama ˈesta kˈasa ɾɾoˌojˈeɾo?
71
+ —fwˈe el nˈombɾe ke le djˈo mɾ.
72
+ kˌoppeɾfjˈelð kwˌando kompɾˈo la kˈasa—ɾɾˌeplikˈo mi mˈaðɾe.
73
+ kɾejjˈo ke aβˈia en los ˈaɾβoles mˈutʃas kˌoɾnˈexas.
74
+ en akˈel momˈɛnto, ˈuna ɾɾˈafaɣa de bjˈɛnto sˌakuðjˈo ˌasta tˈal pˈunto los ˈolmos del ekstɾˈemo del xaɾðˈin ke mi mˈaðɾe i mˈiss betse dˌiɾixjˈeɾon sus miɾˈaðas a akˈel pˈunto.
75
+ los ˈaɾβoles se ˌinklinˈaɾon ˈunos sˌoβɾe ˈotɾos, ˌasemexˈandose a ˈunos xiɣˈantes ke se kˌomfjaɾˈian ˈun sekɾˈeto.
76
+ ˌenseɣˈiða, de ɾɾepˈɛnte, kˌomo si se uβjˈese ˌentuɾβˈaðo kon sus oɾɾˈiβles komfjˈanθas, ˌaxitˈaɾon kˌombulsiβˈamente sus fˌoɾmiðˈaβles bɾˈaθos,
77
+ ˌaɾɾoxˈando a lo lˈexos los antˈiɣwos nˈiðos de kˌoɾnˈexas pˌaɾeθˈiðos a los ɾɾˈestos de ˈun naʊfɾˈaxjo ke aθˈota la tˌempestˈad.
78
+ —¿dˈonde estˈan las kˌoɾnˈexas?
79
+ —pɾˌeɣuntˈo mˈiss betse.
80
+ —las mi mˈaðɾe pensˈaβa en akˈel momˈɛnto en ˈotɾa kˈosa.
81
+ —¿kˈe se ˈan ˈetʃo las kˌoɾnˈexas?
82
+ —dˌesðe ke estˈamos akˈi nˈo las ˈemos bˈisto, ɾɾˌespondjˈo mi mˈaðɾe.
83
+ —kɾeˈiamos —mɾ.
84
+ kˌoppeɾfjˈelð kɾeˈia ke ˈuna nˌumeɾˈosa famˈilja de kˌoɾnˈexas poβlˈaβa ˈestos ��aɾβoles, pˌeɾo los nˈiðos ˈeɾan antˈiɣwos i aθˈia mˈutʃo tjˈempo ke los pˈaxaɾos los aβˈian ˌaβandonˈaðo.
85
+ ˈese detˈaʎe pˈinta ˌadmiɾˈaβlemˈente a daβˈid kˌoppeɾfjˈelð de la kaβˈeθa a los pjˈes.
86
+ ʎamˈaɾ a ˈuna kˈasa ɾɾˈukeɾˈi, kwˌando en ˈeʎa nˈo eksˈiste nˈi ˈuna kˌoɾnˈexa, sˌuponˈeɾ ke ˈaɪ pˈaxaɾos pˌoɾke eksˈisten nˈiðos.
87
+ i si aβˈeis benˈiðo pˌaɾa aβlˈaɾme mˈal de ˈel —mi pˈoβɾe mˈaðɾe, a lo ke supˈoŋɡo,
88
+ tˈuβo poɾ ˈun momˈɛnto la iðˈea de ponˈeɾ kˈoto a las ˌimpeɾtinˈɛnθjas de mi tˈia, ke nˈo ˈeɾa muxˈeɾ ke se dexˈaβa dˌominˈaɾ tˈan fˈaθilmˈente.
89
+ pˌeɾo aˈun nˈo aβˈia ˌakaβˈaðo de ˌaɾtikulˈaɾ su pɾimˈeɾa fɾˈase kwˌando el esfwˈeɾθo ˌaβasaʎˈando su balˈoɾ le pɾoðˈuxo ˈuna kɾˈisis neɾβjˈosa.
90
+ —¿kˈomo se ʎˈama bwˌestɾa kɾiˈaða?
91
+ —pɾˌeɣuntˈo mi tˈia tiɾˈando al mˈismo tjˈempo del koɾðˈon de la kˌampanˈiʎa.
92
+ —pˌeɣotj, tˌaɾtamˌuðeˈo mi mˈaðɾe.
93
+ —pˌeɣotj, dixˈisteɪs.
94
+ bˈajja ˈun nˈombɾe pˌaɾa ˈuna peɾsˈona kɾistjˈana.
95
+ —ˈes su ˌapeʎˈiðo, —ɾɾˌeplikˈo mi mˈaðɾe.
96
+ mi maɾˈiðo la ʎamˈaβa asˈi pˌoɾke su nˈombɾe de pˈila ˈeɾa lo mˈismo ke el mˈio.
97
+ la kɾiˈaða ˌapaɾeθjˈo i la tˈia le dˈixo.
98
+ —pˌeɣotj, bwˌestɾa ˈama estˈa ˈalɣo ˌindispwˈesta.
99
+ aθˈeð ˈuna tˈaθa de tˈe sin peɾðˈeɾ el tjˈempo miɾˈando las mˌusaɾˈaɲas.
100
+ aβjˈɛndo dˈaðo ˈesta ˈoɾðen, kˌomo si en la kˈasa se uβjˈese ɾɾˌekonoθˈiðo sjˈempɾe su ˌaʊtoɾiðˈað sˌoβeɾˈana,
101
+ i dexˈando a pˌeɣotj ke se fwˈese a kumplˈiɾ lo mandˈaðo, mˈiss betse bolβjˈo a ˌokupˈaɾ su pwˈesto al lˈaðo del alˈumbɾe i kɾuθˈo ˈambas mˈanos sˌoβɾe ˈuna de sus ɾɾoðˈiʎas.
102
+ —nˈo dˈuðo —dˈixo la bjˈexa, kˌomo si pɾˌosiɣjˈese ˈuna kˌombeɾsaθjˈon ˌinteɾɾumpˈiða.
103
+ —nˈo dˈuðo ke tendɾˈeis ˈuna ˈixa.
104
+ —pwˈes bjˈen, a paɾtˈiɾ del momˈɛnto de su nˌaθimjˈɛnto, ˈesa ˈixa… —kiθˈas ˈeɾa ˈun nˈiɲo.
105
+ —se ˌatɾeβjˈo a ˌinsinwˈaɾ mi mˈaðɾe.
106
+ —os dˈiɣo —ɾɾˌeplikˈo mˈiss betse—ke dˈeβe sˈer ˈuna ˈixa.
107
+ —tɾatˈad de nˈo kˌontɾaðeθˈiɾme.
108
+ asˈi ke, nˈaθka, os dˈiɣo kjˈeɾo pɾoβˈaɾle mi ˌamistˈað.
109
+ seɾˈe su maðɾˈina i la pondɾˈeis poɾ nˈombɾe betse tɾotwˈooð kˌoppeɾfjˈelð.
110
+ i nˈo tjˈene ke aβˈeɾ eŋɡˈaɲos en la bˈiða de ˈesta betse tɾotwˈooð.
111
+ nˈo se bˌuɾlaɾˈan de sus ˌafekθjˈones, nˈo, ˈixa mˈia.
112
+ se la ˌeðukaɾˈa bjˈen i saβɾˈa ke nˈo ˈes pɾeθˈiso dˈaɾ su kˌoɾaθˈon a kjen nˈo lo meɾˈeθe.
113
+ ʝˈo mˈisma me ˌenkaɾɣaɾˈe de ˈeʎo, si tˈal.
114
+ mi mˈaðɾe, dˌemasjˈaðo kˌonmoβˈiða pˌaɾa aβˈeɾ poðˈiðo ˌanaliθˈaɾ kon sˌeɣuɾiðˈad tˈoðas las ˌimfleksjˈones de bˈoθ de mi tˈia,
115
+ kɾejjˈo kˌompɾendˈeɾ, sin embˈaɾɣo, ke en akˈeʎa ˌokasjˈon ˌaluðˈia a antˈiɣwos ɾɾekwˈeɾðos pˌeɾsonˈales.
116
+ —¿i daβˈid se poɾtˈo bjˈen kon bˈos?
117
+ —pɾˌeɣuntˈo mˈiss betse despwˈes de ˈuna lixˈeɾa pˈaʊsa.
118
+ —¿biβˈisteɪs en bwˈena ˌintelixˈɛnθja?
119
+ —ˈeɾamos mˈujj felˈiθes, ɾɾˌespondjˈo mi mˈaðɾe.
120
+ mi maɾˈiðo nˈo pˈuðo sˈer mexˈoɾ pˌaɾa konmˈiɣo.
121
+ —ˈa, os mˌimaɾˈia, supˈoŋɡo, dˈixo mˈiss betse.
122
+ sˌoβɾe tˈoðo ˈoɪ ke me ˈaʎo sˈola en el mˈundo, ɾɾˌespondjˈo mi mˈaðɾe ɾɾompjˈɛndo a ʎoɾˈaɾ.
123
+ —bˈajja, nˈo ʎoɾˈeis.
124
+ bjˈen se bˈe ke os ʎeβˈaβaɪs kˌomo ˈunos ˈaŋxeles.
125
+ poɾ ˈeso os ˈe dˌiɾixˈiðo ˈesta pɾeɣˈunta.
126
+ ¿ˈeɾaɪs wˈeɾfana, beɾðˈad?
127
+ —¿e ˌinstitutɾˈiθ?
128
+ —ˈeɾa ˌinstitutɾˈiθ en ˈuna kˈasa a dˌonde solˈia ˈiɾ de bisˈita de kwˌando en kwˌando, mɾ.
129
+ tˈuβo la bondˈad de fixˈaɾ su ˌatenθjˈon en mˈi.
130
+ me aβlˈo ˌamistˈosamˈente i me pɾopˈuso kasˈaɾse konmˈiɣo.
131
+ —ˌaθepːtˈe i nos kasˈamos, ɾɾˌespondjˈo mi mˈaðɾe kon ˌiŋxenwiðˈað.
132
+ —ˈa, pˈoβɾe nˈiɲa, ˌaɲaðjˈo mˈiss betse en bˈoθ bˈaxa i miɾˈando al fwˈeɣo kon ˈaɪɾe ˌensimismˈaðo.
133
+ ¿kˈe ˈes lo ke saβˈeis?
134
+ —nˈo os kompɾˈɛndo.
135
+ kwiðˈaɾ ˈuna kˈasa, poɾ exˈemplo.
136
+ tˈemo ke nˈo sˈepa lo sˌufiθjˈɛnte, kˌomo ʝˈo kisjˈeɾa, pˌeɾo mɾ.
137
+ fˈalta le aθˈia ˌapɾendˈeɾ pɾimˈeɾo, ˌeksklamˈo mˈiss betse en fˈoɾma de paɾˈentesis.
138
+ kɾˈeo ke uβjˈeɾa ˌapɾoβetʃˈaðo, poɾ el desˈeo ke tenˈia de ˌapɾendˈeɾ i poɾ la paθjˈɛnθja kon ke me ˌinstɾuˈia,
139
+ si la desɣɾˈaθja de su mwˈeɾte al ʎeɣˈaɾ akˈi, mi mˈaðɾe pɾˌoɾɾumpjˈo de nwˈeβo ˌensoʎˈosos i nˈo pˈuðo kˌontinwˈaɾ.
140
+ —bˈajja, nˈo ʎoɾˈeis, dˈixo mˈiss betse.
141
+ os bˈaɪs a ponˈeɾ mˈala i nˈo aɾˈeis ɡɾˈan bjˈen a mi ˌixˈaða.
142
+ ˈeste ˈultimo ˌaɾɣumˈɛnto pˌaɾeθjˈo kalmˈaɾ alɣˈun tˈanto a mi mˈaðɾe.
143
+ ɾɾeɪnˈo ˈun momˈɛnto de pˈaʊsa i mi nˈoβle tˈia kˌontinwˈo kon los pjˈes en los moɾˈiʎos de la tʃˌimenˈea.
144
+ daβˈid, pɾˌosiɣjˈo, aβˈia kompɾˈaðo ˈuna ˌanwaliðˈað, seɣˈun me ˈan ˌaseɣuɾˈaðo.
145
+ —¿kˈe ˈa ˈetʃo poɾ bˈos?
146
+ kˌoppeɾfjˈelð —ɾɾˌespondjˈo la ˌinteɾpelˈaða, aθjˈɛndo ˈun pˌoðeɾˈoso esfwˈeɾθo—
147
+ ˈa sˈiðo lo bastˈante bwˈeno pˌaɾa ˌaseɣuɾˈaɾme ˈuna pˈaɾte de dˈitʃa ɾɾˈɛnta.
148
+ —kinjˈɛntas lˈiβɾas ˌesteɾlˈinas.
149
+ —uβjˈeɾa poðˈiðo aθˈeɾ mˈenos, —ˌaɲaðjˈo mˈiss betse.
150
+ al ʎeɣˈaɾ akˈi, ɾɾˌeðoβlˈaɾon los soʎˈoθos de mi mˈaðɾe.
151
+ pˌeɣotte, ke entɾˈaβa en akˈel momˈɛnto kon ˈuna tˈaθa de tˈe en ˈuna mˈano i ˈun kˌandelˈeɾo en la ˈotɾa aʎˈo tˈan mˈal a su seɲˈoɾa,
152
+ kˈosa ke uβjˈeɾa notˈaðo fˈaθilmˈente mˈiss betse a estˈaɾ mexˈoɾ ˌalumbɾˈaða a la estˈanθja, ke se ˌapɾesuɾˈo a ʎeβˈaɾla a su kˈama.
153
+ luˈeɣo, ʎamˈando a su soβɾˈino, sˈean pˌeɣotte, ke aθˈia alɣˈunos dˈias se aʎˈaβa ˌeskondˈiðo en la kˈasa sin ke lo supjˈese su mˈaðɾe,
154
+ le dˈixo, ˈið kˌoɾɾiˈɛndo en bˈuska del mˈeðiko i de la ˌemfeɾmˈeɾa.
155
+ ˈuno i ˈotɾa ˌasombɾˈaɾonse ˈun pˈoko kwˌando ʎeɣˈaɾon sˌuθesˈiβamˈente, kon alɣˈunos minˈutos de ˌinteɾβˈalo, al aʎˈaɾ ˈuna seɲˈoɾa dˌeskonoθˈiða,
156
+ de ɾɾˈostɾo ˌimponˈɛnte, sentˈaða en fɾˈɛnte del alˈumbɾe, kon ˈun sombɾˈeɾo ke kolɣˈaβa del bɾˈaθo deɾˈetʃo i ˌokupˈaða en ˌintɾoðuθˈiɾse ˌalɣoðˈon en las oɾˈexas.
157
+ kˌomo pˌeɣotte nˈo saβˈia kjˈen ˈeɾa i su mˈaðɾe nˈo deθˈia nˈaða, la dˌeskonoθˈiða se keðˈo en la sˈala sin ke nˈaðje se ˌokupˈase de ˈeʎa.
158
+ el doktˈoɾ, al bˈeɾla en el mˈismo sˈitjo kˈaða bˈeθ ke suβˈia o baxˈaβa del kwˈaɾto de la emfˈeɾma,
159
+ kɾejjˈo ke benˈia poɾ iðˈentiko motˈiβo ke ˈel i la dˌiɾixjˈo ˈuna fɾˈase de kˌoɾtesanˈia.
160
+ ˈeɾa el ˈombɾe mˈas tˈimiðo i melˈoso, ˌeskiβˈandose kontˈinwamˈente i ˌaβandonˈando su pwˈesto poɾ temˈoɾ de sˈer ˌimpoɾtˈuno.
161
+ en bˈeθ de andˈaɾ, pwˈeðe deθˈiɾse ke se ˌeskuɾɾˈia sin ɾɾuˈiðo i mˈas lˈɛntamˈente ke el espˈektɾo de amlˈet.
162
+ kon la kaβˈeθa ˌenkoxˈiða ˌentɾe los ˈombɾos, kon la ˌekspɾesjˈon de ˈuna moðˈestja ke peðˈia peɾðˈon,
163
+ poɾ nˈaða de ˈeste mˈundo uβjˈeɾa dˈitʃo ˈuna palˈaβɾa dˈuɾa i dˌesaɣɾaðˈaβle nˈi a ˈun pˈeɾɾo,
164
+ poɾ mˈas ke fwˈese ˈun pˈeɾɾo ɾɾaβjˈoso.
165
+ pensˈo ke a mi tˈia le dolˈian los oˈiðos i le pɾˌeɣuntˈo kon ˈun aθˈɛnto sˈumamˈente melˈoso si sufɾˈia de alɣˈuna ˌiɾɾitaθjˈon lokˈal.
166
+ —¿i kˈe djˈaβlo sˌiɡnifˈika ˈeso?
167
+ —ɾɾˌespondjˈo mi tˈia tˈan bɾˈuskamˈente ke el doktˈoɾ siʎˈiβ, kˌomo eɾˈiðo de mutˈismo, fwˈe a sentˈaɾse al lˈaðo del alˈumbɾe.
168
+ en bɾˈeβe fwˈe ʎamˈaðo de nwˈeβo al lˈaðo de mi mˈaðɾe, dˌonde pˌeɾmaneθjˈo alɣˈunos instˈantes.
169
+ suβjˈo, bolβjˈo a baxˈaɾ i kwˌando se ˌeskuɾɾiˈo poɾ ˈultima bˈeθ en la sˈala kɾejjˈo tenˈeɾ ˈun maɡnˈifiko pɾetˈeksto pˌaɾa ɾɾˌenoβˈaɾ la kˌombeɾsaθjˈon.
170
+ —seɲˈoɾa, tˈɛŋɡo el majjˈoɾ ɡˈusto en dˈaɾos mi ˌenoɾaβwˈena.
171
+ —se pwˈeðe saβˈeɾ poɾ kˈe, —ɾɾˌeplikˈo mi tˈia seβˈeɾamˈente.
172
+ el doktˈoɾ kɾejjˈo aβˈeɾ paɾtˈiðo de lixˈeɾo, ˌolβiðˈando la ˌintɾoðukθjˈon ˌimbaɾjˈaβle de tˈoðos sus diskˈuɾsos.
173
+ ˈantes de kˌontinwˈaɾ bolβjˈo a sˌaluðˈaɾ kon majjˈoɾ ɾɾespˈeto si kˈaβe ke la pɾimˈeɾa bˈeθ.
174
+ —seɲˈoɾa, tɾˌankilˈiθˈaos.
175
+ felˈiθ ʝˈo ke pwˈeðo dˈaɾos la ˌenoɾaβwˈena.
176
+ ʝˈa nˈo tenˈeis ke temˈeɾ nˈaða.
177
+ en ˈuna de ˈestas fɾˈases ˌenroʎˈose el doktˈoɾ i mi tˈia kˌontinwˈaβa miɾˈandole ɾɾˌepɾimjˈɛndo kon mˈutʃo tɾaβˈaxo su ˌimpaθjˈɛnθja,
178
+ ˌasta ke poɾ fˈin mɾ.
179
+ siʎˈiβ ˌeksklamˈo pˌaɾa tˌeɾminˈaɾ su diskˈuɾso.
180
+ —felˈiθ ʝˈo ke pwˈeðo deθˈiɾos.
181
+ ʝˈa se ˌakaβˈo tˈoðo, komplˈetamˈente tˈoðo.
182
+ —¿i kˈomo estˈa la mˈaðɾe?
183
+ —pɾˌeɣuntˈo mi tˈia kɾuθˈandose de bɾˈaθos i sin ˌaβandonˈaɾ el sombɾˈeɾo.
184
+ —mˈujj bjˈen, seɲˈoɾa, i espˈeɾo ke kˈaða bˈeθ sˌeɣiɾˈa mexˈoɾ.
185
+ bˈa tˈoðo lo bjˈen ke pwˈeðe ˈiɾ ˈuna xˈoβen pɾˌimeɾˈiθa en su sˌitwaθjˈon.
186
+ ¿poðˈeis bˈeɾla sin ˌinkombenjˈɛnte a niŋɡˈuno?
187
+ —pɾˌeɣuntˈo mi tˈia kon la mˈisma ˌaspeɾˈeθa.
188
+ el doktˈoɾ siʎˈiβ ˌenkoxjˈo la kaβˈeθa ˌentɾe los ˈombɾos ˈun pˈoko mˈas ke de kostˈumbɾe.
189
+ —la tʃˌikitˈina, la ɾɾeθjˈen naθˈiða, ɾɾepˈito.
190
+ —seɲˈoɾa —ɾɾˌeplikˈo el doktˈoɾ—kɾeˈia ke saβˈiaɪs ke nˈo ˈes ˈuna nˈiɲa, sˈino ˈun nˈiɲo.
191
+ mi tˈia nˈo pɾˌonunθjˈo nˈi ˈuna sˈilaβa, pˌeɾo koxjˈɛndo su sombɾˈeɾo poɾ las θˈintas a manˈeɾa de ˈuna ˈonda,
192
+ ˌamenaθˈo kon ˈel la kaβˈeθa del doktˈoɾ.
193
+ se lo ˌenkasketˈo a tɾaβˈes en la sˈujja, saljˈo i nˈo bolβjˈo mˈas.
194
+ dˌesapˌaɾeθjˈo kˌomo nˈaða ˌenoxˈaða, o kˌomo ˈuno de ˈesos espˈiɾitus ke estˈaβa pɾˌeðestinˈaðo a bˈeɾ, seɣˈun el ɾɾumˈoɾ pˌopulˈaɾ.
195
+ sann pˌeɣotj pɾˌetendˈia aβˈeɾse ˌenkontɾˈaðo kon ˈeʎa a la pwˈeɾta de la kˈasa sin poðˈeɾ kˌompɾendˈeɾ klˈaɾamˈente lo ke le pɾˌeɣuntˈaɾa mˈiss betse,
196
+ ke le ˌaplikˈo ˈun pˈaɾ de pˌeskoθˈones pˌaɾa ˌaɣuθˈaɾ su ˌintelixˈɛnθja.
197
+ la tˈia del mutʃˈatʃo ˌafiɾmˈo a la maɲˈana siɣjˈɛnte ke sann tenˈia los kaɾɾˈiʎos kˌomo ˈuna ˌamapˈola a kˌonsekwˈɛnθja de la ˌinteɾɾˌoɣaθjˈon de la bwˈena seɲˈoɾa.
198
+ mi bwˈena tˈia nˈo bolβjˈo, nˈo tˈal.
199
+ ʝˈo me ʎˈaβa en mi kˈuna i mi mˈaðɾe en su kˈama.
200
+ mˈiss betse tɾotwˈooð kˌoppeɾfjˈelð, la sˌoβɾinˈita ke mi tˈia aβˈia ˌespeɾˈaðo ˌasta las dˈoθe de la nˈotʃe,
201
+ pˌeɾmaneθjˈo en el lˈimbo, en ˈesa fˌoɾmiðˈaβle ɾɾexjˈon de dˌonde ʝˈo ʎeɣˈaβa i de dˌonde pɾˌoβenˈian tˈoðos los bjaxˈeɾos de la bˈiða.
202
+ la lˈuθ del dˈia pɾˌojjektˈo sus ɾɾˈajjos en la mansjˈon de la nˈaða, i a sus ɾɾeflˈexos mi sˈer dexˈo la inˈeɾθja i bˈino a tomˈaɾ pwˈesto ˌentɾe los moɾtˈales.
203
+ kapˈitulo dˈos de daβˈid kˌoppeɾfjˈelð o el soβɾˈino de metˈia de tʃˈaɾles dˌiθjˈens.
204
+ ˈesta ɡɾˌaβaθjˈon de lˌiβɾˈiβoks ˈes de domˈinjo pˈuβliko.
205
+ kapˈitulo dˈos.
206
+ mi mˈaðɾe i pˌeɣotte sˈon pˌaɾa mˈi los dˈos pɾimˈeɾos sˈeɾes ke ɾɾekwˈeɾðan mi memˈoɾja en ˈeste kwˈaðɾo ɾɾˌetɾospektˈiβo.
207
+ mi mˈaðɾe kon sus eɾmˈosos kaβˈeʎos i su esβˈelto tˈaʎe.
208
+ pˌeɣotte ke nˈo tenˈia tˈaʎe de niŋɡˈuna klˈase, pˌeɾo ke pˌoseˈia ˈunos ɡɾˈandes ˈoxos nˈeɣɾos, ˈunos moflˈetes mˈujj kˌoloɾˈaðos i ˈunos bɾˈaθos mˈas kˌoloɾˈaðos aˈun.
209
+ a bˈeθes me ekstɾˈaɲa kˈomo los pˈaxaɾos nˈo akˈuðen a pˌikoteˈaɾlos kon pɾˌefeɾˈɛnθja a las manθˈanas.
210
+ se me fiɣˈuɾa estˈaɾ bjˈɛndo mˈujj θˈeɾka de mˈi akˈeʎas dˈos kɾiatˈuɾas, bjˈen ˌaɣatʃˈandose pˌaɾa ke puðjˈeɾa sˌolˈito etʃˈaɾme en sus bɾˈaθos o ponjˈendose de ɾɾoðˈiʎas mjˌentɾas ke ʝˈo ˈiβa de ˈuna a ˈotɾa.
211
+ aˈun kɾˈeo sentˈiɾ la ˌimpɾesjˈon de la mˈano ke me ˌalaɾɣˈaβa pˌeɣotte, akˈeʎa mˈano ke la kostˈuɾa aβˈia bwˈelto mˈas ˈaspeɾa ke ˈuna lˈima.
212
+ kiθˈas sˈea ˈun kapɾˈitʃo de mi ˌimaxˌinaθjˈon al pensˈaɾ ke nwˌestɾa memˈoɾja pwˈeðe ˈiɾ mˈas aʎˈa de lo ke se kɾˈee xˌeneɾˈalmˈente en lo pasˈaðo,
213
+ asˈi kˌomo tambjˈen pjˈɛnso ke mˈutʃos nˈiɲos estˈan dotˈaðos de ˈuna fˌakultˈad de ˌoβseɾβaθjˈon ˈes mˈas,
214
+ nˈo se dˈeβe deθˈiɾ ke la majjˈoɾ pˈaɾte de los ˈombɾes ke sˈon notˈaβles ɾɾespˈekto a ˈeste pˌaɾtikulˈaɾ ˈan ˌadkiɾˈiðo ˈeste dˈon.
215
+ ˈantes, poɾ el kontɾˈaɾjo, ˌestaɾˈian mˈas bjˈen dispwˈestos a peɾðˈeɾlo, kon tˈanta mˈas ɾɾaθˈon kwˌanto ke ˈestos mˈismos ˈombɾes konsˈeɾβan θjˈeɾta lˌuθiðˈeθ de iðˈeas i θjˈeɾta pɾˌeðispˌosiθjˈon a sˈer felˈiθes,
216
+ ke ˈes ˈotɾa de las eɾˈɛnθjas de su imfˈanθja.
217
+ en tˈoðo kˈaso, al xuθɣˈaɾ poɾ mˈi a los demˈas, lo ˈaɣo poɾ aβˈeɾ sˈiðo kwˌando nˈiɲo sˈumamˈente ˌoβseɾβaðˈoɾ,
218
+ i ˈoɪ ke sˈoɪ ˈombɾe, ɾɾekwˈeɾðo peɾfˈektamˈente mi bˈiða de la imfˈanθja.
219
+ beˈamos de kˈe mˈas me akwˈeɾðo.
220
+ de mi kˈasa kon tˈoðos sus ˌeskondˈites.
221
+ en el pˈiso bˌaxo se ˈaʎa la koθˈina kˈujja pwˈeɾta dˈa ˈun pˈatjo.
222
+ en mˈeðjo de ˈeste pˈatjo, ˈun pˌalomˈaɾ sin palˈomas.
223
+ en ˈun ɾɾinkˈon la kasˈeta del pˈeɾɾo, poɾ supwˈesto en ˌinkilˈino.
224
+ ˌaðemˈas, ˈuna poɾθjˈon de ˈaβes de tamˈaɲo ɾɾˌespetˈaβle, ʝˈɛndo i binjˈɛndo kon ˈaɪɾe fˌosko i ˌamenˌaθaðˈoɾ.
225
+ sˌoβɾe tˈoðo ˈun ɡˈaʎo, suβˈiðo en ˈun maðˈeɾo, ke pˌaɾeθˈia fixˈaɾ tˈoða su ˌatenθjˈon en mˈi kˈaða bˈeθ ke miɾˈaβa a tɾaβˈes de la bentˈana,
226
+ kˈosa ke aˈun me ˈaθe temblˈaɾ, pwˈes el tˈal ɡˈaʎo nˈo ˈeɾa nˈaða bwˈeno.
227
+ ˈunos kwˌantos pˈaβos ke kˌaminˈaβan kon su ˈaɪɾe dˌeɾɾeŋɡˈaðo i me pˌeɾseɣˈian ˌalaɾɣˈando el peskwˈeθo.
228
+ poɾ de nˈotʃe swˈeɲo kon ˈeʎos, kˌomo el dˌomaðˈoɾ de fjˈeɾas swˈeɲa kon sus leˈones.
229
+ ˈe akˈi ˈun pasˈiʎo tˈan lˈaɾɣo ke a mˈi se me fiɣˈuɾa ke nˈo tjˈene fˈin,
230
+ i ke bˈa de la koθˈina a la pwˈeɾta de la kˈaʎe.
231
+ en ˈeste kˌoɾɾeðˈoɾ ˈaɪ ˈun kwˈaɾto oskˈuɾo ke sˈiɾβe pˌaɾa ɡwaɾðˈaɾ tɾˈastos bjˈexos.
232
+ asˈi ke ˈes de nˈotʃe, pˈaso mˈujj depɾˈisa poɾ delˈante del tˈal kwˈaɾto, pwˈes nˈo se a θjˈɛnθja θjˈeɾta lo ke ˈaɪ ˌentɾe los bjˈexos tonˈeles i las kˈaxas de tˈe,
233
+ a pesˈaɾ ke eksˈala ˈun olˈoɾ de xaβˈon, pimjˈɛnta, bˈelas de sˈeβo i kafˈe.
234
+ tambjˈen ˈaɪ dˈos sˈalas, ˈuna de ˈeʎas pekˈeɲa, dˌonde solˈemos pasˈaɾ las belˈaðas mi mˈaðɾe, pˌeɣotj i ʝˈo.
235
+ pwˈes bwˈeno ˈes deθˈiɾ ke pˌeɣotj fˈoɾma nwˌestɾa teɾtˈulja, asˈi ke ˈa ˌakaβˈaðo sus kˌeaθˈeɾes i se mˈaɾtʃa tˈoðo el mˈundo.
236
+ ˌenseɣˈiða bjˈene la sˈala pɾˌinθipˈal, en la kwˈal ɾɾˌeθiβˈimos los domˈiŋɡos.
237
+ ˌaʊnke ˈesta ˌaβitaθjˈon ˈes majjˈoɾ ke la ˈotɾa, nˈo ˈes tˈan kˈomoða, i pˌaɾa mˈi ɾɾˈeɪna en ˈeʎa ˈuna espˈeθje de lˈuɣuβɾe tɾistˈeθa,
238
+ pwˈes pˌeɣotj me ˈa kontˈaðo ke kwˌando los fˌuneɾˈales de mi pˈaðɾe se bjˈo ʎˈena kon tˈanta xˈɛnte kˌomo bˈino,
239
+ bestˈiða de lˈuto pˌaɾa ˌakompaɲˈaɾ su ˌataˈuð.
240
+ tambjˈen en ˈesta sˈala, θjˈeɾto domˈiŋɡo poɾ la nˈotʃe, mi mˈaðɾe nos leˈia a pˌeɣotj i a mˈi la ɾɾˌesuɾɾekθjˈon del ˈaxaɾo ˌentɾe los mwˈeɾtos.
241
+ nˈo konˈoθko nˈaða tˈan bˈeɾðe kˌomo el θˈesped de ˈeste θˌementˈeɾjo, nˈi ˌaɾβolˈeðas mˈas sombɾˈias ke las sˈujjas,
242
+ nˈi kˈalma iɣwˈal a la de las lˈosas de los tˈumulos.
243
+ aʎˈi se ˌapaθjˈɛnta el ɡanˈaðo, i kwˌando poɾ la mˌaɲanˈita me pˈoŋɡo de ɾɾoðˈiʎas en mi kˈama pˌaɾa bˈeɾ los koɾðˈeɾos,
244
+ distˈiŋɡo el pɾimˈeɾ ɾɾˈajjo de sˈol ke pɾojjˈekta su ɾɾeflˈexo en la esfˈeɾa solˈaɾ i me pɾeɣˈunto ¿ˌestaɾˈa alˈeɣɾe la esfˈeɾa kwˌando mˈaɾka aˈun las ˈoɾas?
245
+ mˈas aʎˈa se enkwˈɛntɾa el bˈanko de la iɣlˈesja, ˈun bˈanko kon ˈun ɾɾespˈalðo ˈalto, kˌolokˈaðo xˈunto a ˈuna de las bentˈanas bˈaxas,
246
+ dˌesðe dˌonde se pwˈeðe bˈeɾ nwˌestɾa kˈasa duɾˈante el seɾβˈiθjo, lo kwˈal eksplˈika la kostˈumbɾe de pˌeɣotj ke miɾˈaβa fɾekwˈɛntemˈente ˌaθja akˈel lˈaðo pˌaɾa ˌaθeɾkˈaɾse de ke nˈo ˈaɪ laðɾˈones nˈi fwˈeɣo.
247
+ pˌeɾo aˈun kwˌando ˈeʎa mˈiɾa a ˈuno i ˈotɾo lˈaðo, se emfˈaða si ʝˈo bwˈelβo la kaβˈeθa i me ˈaθe sˈeɲas pˌaɾa ke nˈo sepˈaɾe la bˈista del minˈistɾo ke ofˈiθja.
248
+ nˈo pwˈeðo miɾˈaɾle kontˈinwamˈente pˌoɾke le konˈoθko bastˈante kon sˌoβɾepeʎˈiθos en ˈeʎa, i de kwˌando en kwˌando me ˈetʃa ˈunas miɾˈaðas,
249
+ mˈiɾo a mi mˈaðɾe ke ˈaθe kˌomo ke nˈo me bˈe, luˈeɣo a ˈun tʃikˈiʎo ke me ˈaθe ˈuna mwˈeka,
250
+ al ˈotɾo lˈaðo del pˈoɾtiko bˈeo ˈun kaɾnˈeɾo ke paɾˈeθe keɾˈeɾ entɾˈaɾ en la iɣlˈesja i me sjˈɛnto dispwˈesto a ɡɾitˈaɾle ke se bˈajja,
251
+ pˌeɾo ¿kˈe seɾˈia de mˈi si tˈal iθjˈeɾe?
252
+ ˈun pˈoko mˈas lˈexos estˈa el pˈulpito.
253
+ aʎˈi sˈi ke poðɾˈia xˌuɣˈaɾse bjˈen.
254
+ ¡kˈe ɡˈoθo si ʝˈo me bjˈeɾa en akˈeʎa fˌoɾtalˈeθa i binjˈeɾa ˈuno de mis kˌompaɲˈeɾos a ponˈeɾme sˈitjo!
255
+ le tˌiɾaɾˈia el koxˈin de tˌeɾθjopˈelo del pɾˌeðikaðˈoɾ.
256
+ ˌinsensˈiβlemˈente, a fwˈeɾθa de miɾˈaɾ, θjˌeɾɾanse mis ˈoxos i mis oˈiðos nˈo ˈojjen a fwˈeɾθa de aθˈeɾ kˌomo ke eskˈutʃo al minˈistɾo ke kˈanta ˈun sˈalmo kon bˈoθ dˌesafinˈaða de bˌaxo pɾofˈundo.
257
+ me kˈaɪɣo del bˈanko metjˈɛndo ˈun estɾˈepito ˌimfeɾnˈal i peɣˈote me leβˈanta del swˈelo mˈas mwˈeɾto ke bˈiβo.
258
+ aˈoɾa bˈeo la fatʃˈaða de nwˌestɾa kˈasa i las bentˈanas ɾɾˌoðeˈaðas de ˈun ˌenrexˈaðo de maðˈeɾa.
259
+ distˈiŋɡo el pˌaɾteɾ, el θˈesped i los ˈaltos ˈalamos kon sus nˈiðos de kˌoɾnˈexas.
260
+ ˌatɾaβjˈeso el pasˈiʎo i la koθˈina.
261
+ me ɾɾeˈuno en la wˈeɾta kon mi mamˈa i mjˌentɾas kˈoxe la fɾˈuta maðˈuɾa de la ˌempaliθˈaða,
262
+ ɾɾˈoβo a ˌoɾtaðiʎas alɣˈuna ke ˈotɾa ɡɾosˈeʎa.
263
+ en el imbjˈeɾno xuɣˈamos en la sˈala mˈas pekˈeɲa.
264
+ kwˌando mi mˈaðɾe se kˈansa, se sjˈɛnta en la butˈaka.
265
+ alɣˈunas bˈeθes se diɾˈixe al espˈexo.
266
+ en soɾtˈixa en los dˈeðos los ɾɾˈiθos de su eɾmˈosa kˌaβeʎˈeɾa.
267
+ se axˈusta su esβˈelto tˈaʎe i bjˈen sˈe ke nˈo le emfˈaða el aʎˈaɾse sjˈempɾe bonˈita.
268
+ ˌaɲaðiɾˈe a ˈestas pɾimˈeɾas ˌimpɾesjˈones el sˌentimjˈɛnto de ˈun bˌeɾðaðˈeɾo ˌasθendjˈɛnte ke pˌeɣotj ˌexeɾθˈia sˌoβɾe mi mˈaðɾe i sˌoβɾe mˈi.
269
+ la kˌonsultˈaβamos a pɾopˈosito de tˈoðo i ˌasta le tenˈiamos θjˈeɾto mjˈeðo.
270
+ ˈun dˈia pˌeɣotj i ʝˈo nos aʎˈaβamos sentˈaðos los dˈos al lˈaðo del alˈumbɾe, pwˈes mi mˈaðɾe aβˈia ˈiðo de bisˈita a kˈasa de ˈuna beθˈina.
271
+ leˈiale ˈun kapˈitulo sˌoβɾe los kˌokoðɾˈilos i ˈun pˈoko poɾ fˈalta del lektˈoɾ i ˈotɾo pˈoko poɾ fˈalta de ˌintelixˈɛnθja.
272
+ estˈoɪ seɣˈuɾo de ke pˌeɣotj nˈo poðˈia deθˈiɾ a pˈunto fˈixo si el kˌokoðɾˈilo ˈeɾa ˈun ˌanimˈal o ˈuna leɣˈumbɾe ˌekstɾaˌoɾðinˈaɾja,
273
+ kwˌando en ˈesto se ˌapoðeɾˈo de mˈi el swˈeɲo, pˌeɾo nˈo keɾˈia ˌakostˈaɾme poɾ nˈaða de ˈeste mˈundo.
274
+ tɾatˈe de ɾɾˌesistˈiɾ al swˈeɲo miɾˈando fˈixamˈente a pˌeɣotj, kˈujjo tˈaʎe tomˈaβa kˈaða bˈeθ a mis ˈoxos majjˈoɾes pɾˌopoɾθjˈones i se me pɾˌesentˈaβa kˌomo ˈun bˌeɾðaðˈeɾo xiɣˈante.
275
+ me fɾotˈe los ˈoxos i apˈenas sˈi poðˈia aβɾˈiɾ los pˈaɾpaðos, nˈo peɾðjˈɛndo de bˈista nˈi mi kɾiˈaða nˈi el kˈaβo de θˈeɾa ke el ˈilo ʎenˈaβa de sˈuɾkos,
276
+ nˈi su θˈinta pˌaɾa meðˈiɾ, nˈi su θˈesta de kostˈuɾa, en kˈujja tˈapa aβˈia dˌiβuxˈaða la kˌateðɾˈal de sˈan pˈaβlo kon su kˈupula ˌenkaɾnˈaða,
277
+ nˈi el deðˈal de kˈoβɾe ke la ɾɾˌesɣwaɾðˈaβa de las pˌikaðˈuɾas de la aɣˈuxa.
278
+ pˌeɾo sentˈi ke pˌaɾa nˈo sˌukumbˈiɾ nˌeθesitˈaβa ˈun nwˈeβo esfwˈeɾθo i dˌiɾixˈi bɾˈuskamˈente a pˌeɣotj ˈesta sˌiŋɡulˈaɾ pɾeɣˈunta.
279
+ —¿pˌeɣotj, aβˈeis estˈaðo kasˈaða alɣˈuna bˈeθ?
280
+ djˈos de mi bˈiða, dˈime kjˈen djˈaβlos te ˈa aβlˈaðo de kˌasamjˈɛnto.
281
+ pˌeɣotj se ˌestɾemeθjˈo de tˈal mˈoðo ke ʝˈo me dˌespeɾtˈe del tˈoðo.
282
+ dexˈo de kosˈeɾ i me miɾˈo sin soltˈaɾ la aɣˈuxa de su mˈano.
283
+ —¿aβˈeis estˈaðo kasˈaða alɣˈuna bˈeθ?
284
+ —sˈoɪ ˈuna ɡwˈapa tʃˈika, ¿nˈo ˈes ˈesto?
285
+ a deθˈiɾ beɾðˈad, se me fˌiɣuɾˈaβa ke ˈeɾa ɡwˈapa, de ˈuna beʎˈeθa dˌifeɾˈɛnte a la de mi mˈaðɾe,
286
+ pˌeɾo en su xˈeneɾo nˈo aβˈia nˈaða ke peðˈiɾ.
287
+ su ˌenθendˈiðo kˈutis me pˌaɾeθˈia tˈan bɾiʎˈante kˌomo el fˈondo de ˈun tˌaβuɾˈete de tˌeɾθjopˈelo ˌenkaɾnˈaðo en ke mi mˈaðɾe aβˈia boɾðˈaðo ˈunas flˈoɾes.
288
+ tˈal bˈeθ ˈeɾa ˈun pˈoko mˈas swˈaβe el tˈakto, pˌeɾo ˈesta ˈeɾa su ˈunika dˌifeɾˈɛnθja.
289
+ —kon ke sˈoɪ eɾmˈosa, dˈixo pˌeɣotj.
290
+ —ˈo, nˈo, ˈixo mˈio, pˌeɾo ¿kjˈen djˈaβlos te ˈa aβlˈaðo de kˌasamjˈɛntos?
291
+ —nˈo sˈe, ɾɾˌeplikˈe.
292
+ dˈime si se pwˈeðe kasˈaɾ ˈuno kon bˈaɾjas peɾsˈonas a ˈun mˈismo tjˈempo.
293
+ —nˈo tˈal, ɾɾˌespondjˈo pˌeɣotj sin bˌaθilˈaɾ.
294
+ pˌeɾo kwˌando se ˈa mwˈeɾto la peɾsˈona kon kjen ˈuno se ˈa kasˈaðo, pwˈeðe el ke sˌoβɾeβˈiβe kasˈaɾse ˈotɾa bˈeθ.
295
+ —se pwˈeðe, si se kjˈeɾe, ɾɾˌeplikˈo la xˈoβen.
296
+ ˈeso depˈɛnde de la ˌopinjˈon de kˈaða ˈuno.
297
+ —¿i kwˈal ˈes bwˌestɾa ˌopinjˈon?
298
+ ˌaɲaðˈi kon tˈanta majjˈoɾ kˌuɾjosiðˈad kwˌanto ke ˈeʎa me ˌeksaminˈaβa kon ɡɾˈan ˌatenθjˈon.
299
+ pˌeɣotj dexˈo de fixˈaɾ sus nˈeɣɾos ˈoxos en los mˈios, pˈusˈose a kosˈeɾ i ˌeksklamˈo despwˈes de tˌituβeˈaɾ ˈun pˈoko.
300
+ —tˈoðo lo ke pwˈeðo deθˈiɾ ˈes ke nˈunka ˈe estˈaðo kasˈaða i ke xamˈas me kˌasaɾˈe.
301
+ —bˈeo ke estˈais de mˈal umˈoɾ, pˌeɣotj.
302
+ le dˈixe i ɡwaɾðˈe silˈɛnθjo, kɾejjˈɛndo en efˈekto ke la aβˈia kˌontɾaɾjˈaðo.
303
+ pˌeɾo me ˌeŋɡaɲˈaβa, pˌoɾke duɾˈante alɣˈunos minˈutos tɾatˈo de tɾˌaβaxˈaɾ i nˈo kˌonsiɣjˈɛndˈolo ˌaβɾiˈo de ɾɾepˈɛnte sus bɾˈaθos,
304
+ i me atɾˈaxo a ˈeʎos besˈando ɾɾˌepetˈiðas bˈeθes mi ɾɾiθˈaða kˌaβeʎˈeɾa.
305
+ ˌapeɾθiβˈime de la ˌeneɾxˈia de sus kaɾˈiθjas al bˈeɾ ke saltˈaβan dˈos botˈones de su bestˈiðo,
306
+ pwˈes kˌomo nˈo aβˈia wˈeko poɾ niŋɡˈun lˈaðo, kwalkjˈeɾ ˌexeɾθˈiθjo le ˌeksponˈia sˌemexˈante ˌinkombenjˈɛnte.
307
+ —bˈamos, ˌeksklamˈo.
308
+ siɣˈamos la istˈoɾja de los kˌokoðɾˈilos.
309
+ nˈo pˈuðe kˌompɾendˈeɾ poɾ kˈe pˌeɣotj mostɾˈaβa tˈanta tˌuɾβaθjˈon i dˌeseˈaβa bolβˈeɾ a los kˌokoðɾˈilos, seɣˈun ˈeʎa los ʎamˈaβa.
310
+ nˈo oβstˈante, seɣˈimos lejjˈɛndo la istˈoɾja de ˈestos mˈonstɾuos, o mexˈoɾ dˈitʃo, biβˈimos en su kˌompaɲˈia poɾ espˈaθjo de mˈeðja ˈoɾa.
311
+ dexˈamos sus wˈeβos en la aɾˈena pˌaɾa ke el sˈol puðjˈeɾa ˌempoʎˈaɾlos.
312
+ nos bˈimos pˌeɾseɣˈiðos poɾ el pˈaðɾe i la mˈaðɾe, kˈujja kˈoleɾa buɾlˈamos dˈando bwˈeltas, kˈosa ke nˈo poðˈian aθˈeɾ kˌomo nosˈotɾos a kˈaʊsa de la pˌesaðˈeθ de sus mˌoβimjˈɛntos.
313
+ ˌenseɣˈiða les pˌeɾseɣˈimos a nwˌestɾa bˈeθ en el ˈaɣwa kon los kˌaθaðˈoɾes indˈixenas.
314
+ les ˌintɾoðuθˈimos a buθˈaðos pˈintʃos en la bˈoka.
315
+ en ˈuna palˈaβɾa, nˈo taɾðˈamos en ˌapɾendˈeɾ de memˈoɾja tˈoða la istˈoɾja de los kˌokoðɾˈilos, al mˈenos ʝˈo,
316
+ pwˈes en kwˌanto a pˌeɣotj se me fˌiɣuɾˈaβa ke poɾ momˈɛntos pˌaðeθˈia alɣˈunas dˌistɾakθjˈones i se pikˈaβa los dˈeðos kon la aɣˈuxa.
317
+ ˌiβamos a kˌontinwˈaɾ nwˌestɾa lektˈuɾa kwˌando ʎamˈaɾon a la pwˈeɾta.
318
+ la ke ʎeɣˈaβa ˈeɾa mi mˈaðɾe i benˈia ˌakompaɲˈaða de ˈun kˌaβaʎˈeɾo de pˌatiʎas nˈeɣɾas, ke ɾɾˌekonoθˈi poɾ aβˈeɾnos ˌakompaɲˈaðo ʝˈa el domˈiŋɡo ˌanteɾjˈoɾ dˌesðe la iɣlˈesja ˌasta nwˌestɾa kˈasa.
319
+ kwˌando mi mamˈa en el dintˈel de la pwˈeɾta me koxjˈo en sus bɾˈaθos i me besˈo,
320
+ el kˌaβaʎˈeɾo dˈixo ke ʝˈo ˈeɾa mˈas felˈiθ poɾ mi pɾˌiβilˈexjo ke ˈun monˈaɾka o ˈuna kˈosa pˌaɾeθˈiða,
321
+ pwˈes dˈeβo kˌomfesˈaɾ ke a mi memˈoɾja bjˈene a ˌajjuðˈaɾ mi ˌekspeɾjˈɛnθja sˌuβsiɣjˈɛnte.
322
+ kˈiso, poɾ su pˈaɾte, ˌakaɾiθjˈaɾme poɾ enθˈima del ˈombɾo de mi mˈaðɾe, pˌeɾo malðˈita la sˌimpatˈia ke sentˈi ˌaθja ˈel i poɾ su ˈaspeɾa bˈoθ.
323
+ tˈuβe θˈelos al notˈaɾ ke su mˈano ɾɾoθˈaβa a mi mˈaðɾe i la sˌepaɾˈe kwˌanto me fwˈe posˈiβle.
324
+ ¿kˈomo se entjˈɛnde, daβˈid?
325
+ dˈixo mi mˈaðɾe kon ˈaɪɾe de ɾɾepɾˈotʃe.
326
+ keɾˈiðo nˈiɲo, ˌeksklamˈo el kˌaβaʎˈeɾo, nˈo pwˈeðo ˌenoxˈaɾme de su θˌelofilˈeal.
327
+ xamˈas aβˈia bˈisto ˈun kaɾmˈin tˈan suβˈiðo en las mexˈiʎas de mi mˈaðɾe.
328
+ ɾɾiɲˈo me kˌaɾiɲˈosamˈente i, al mˈismo tjˈempo ke me ˌestɾetʃˈaβa kˈontɾa su kˌoɾaθˈon, djˈo las ɡɾˈaθjas a akˈel seɲˈoɾ poɾ la molˈestja de aβˈeɾla ˌakompaɲˈaðo.
329
+ —ˈes pɾeθˈiso ke nos dˈemos las bwˈenas nˈotʃes, ˈixo mˈio—dˈixo el kˌaβaʎˈeɾo, ke a su bˈeθ koxjˈo la mˈano de mi mˈaðɾe i besˈo el ɡwˈante ke la kuβɾˈia.
330
+ —bwˈenas nˈotʃes—le ɾɾˌespondˈi.
331
+ —bˈamos, seˈamos bwˈenos amˈiɣos—ɾɾˌepitjˈo el kˌaβaʎˈeɾo ɾɾiɲˈando—bˈɛŋɡa la mˈano.
332
+ ʝˈo tenˈia mi mˈano deɾˈetʃa ˌentɾe las mˈanos de mi mˈaðɾe, asˈi fwˈe ke la ˌalaɾɣˈe la ˈotɾa.
333
+ —nˈo ˈes ˈesta la bwˈena, daβˈid—ˌoβseɾβˈo el kˌaβaʎˈeɾo sin dexˈaɾ de ɾɾeˈiɾ.
334
+ mi mˈaðɾe kˈiso aθˈeɾme dˈaɾ la mˈano deɾˈetʃa, pˌeɾo, kˌomo me aʎˈaβa bjˈen dˌeθiðˈiðo a nˈo dˈaɾ sˈino la iθkjˈeɾða,
335
+ el kˌaβaʎˈeɾo ˌakaβˈo poɾ ˌestɾetʃˈaɾla koɾðjˈalmˈente.
336
+ ˌenseɣˈiða ɾɾˌepitjˈo ke ʝˈo ˈeɾa ˈuna kɾiatˈuɾa ˌeksθelˈɛnte i se ɾɾˌetiɾˈo.
337
+ bˈi ke ɾɾˌeβolβˈia la ˈultima ˌaβenˈiða del xaɾðˈin i ke nos embjˈaβa ˈuna miɾˈaða de dˌespeðˈiða kon sus nˈeɣɾos ˈoxos de mˌalaɣˈeɾo.
338
+ la pwˈeɾta, ˈuna bˈeθ θeɾɾˈaða, peɣˈo tˈik ke nˈo aβˈia aβlˈaðo nˈi ˈuna sˈola palˈaβɾa, sˌuxetˈo el bˈaɾɾo de jˈeɾɾo i los tɾˈes entɾˈamos en el salˈon.
339
+ aʎˈi, kˈontɾa su kostˈumbɾe, mi mˈaðɾe, en bˈeθ de sentˈaɾse en su butˈaka, al lˈaðo de la lˈumbɾe,
340
+ pˌeɾmaneθjˈo al ˈotɾo ekstɾˈemo de la ˌaβitaθjˈon ˌinstalˈandose en ˈuna sˈiʎa i tˌaɾaɾeˈando.
341
+ mjˌentɾas ke aθˈia ɡˌoɾɣoɾˈitos, ˌempeθˈe a doɾmˈiɾme, pˌeɾo mi swˈeɲo fwˈe bastˈante lixˈeɾo pˌaɾa poðˈeɾ oˈiɾ a pˌeɣotj ke,
342
+ de pjˈe e inmˈoβil en mˈeðjo del salˈon, kon ˈun kˌandelˈeɾo en la mˈano, deθˈia a mi mˈaðɾe.
343
+ —¿os aβˈeis dˌiβeɾtˈiðo ˈesta nˈotʃe, seɲˈoɾa?
344
+ —sˈi, ɡɾˈaθjas, pˌeɣotj, bastˈante.
345
+ me ˌaβentˈuɾo a ˌaɲaðˈiɾ ke aβˈeis pasˈaðo ˈuna swaɣe ke nˈo uβjˈeɾa kˌomplaθˈiðo mˈutʃo a mɾ.
346
+ —ˌeksklamˈo mi mˈaðɾe—me bˌolβeɾˈeis lˈoka.
347
+ nˈo ˈaɪ ˈuna muxˈeɾ en el mˈundo ke se bˈea peˈoɾ tɾatˈaða poɾ su kɾiˈaða ke ʝˈo.
348
+ nˈo θˈeso de pɾˌeɣuntˈaɾme si sˈoɪ ˈuna tʃikˈiʎa o ˈuna muxˈeɾ bjˈuða.
349
+ —nˈaðje iɡnˈoɾa ke aβˈeis sˈiðo kasˈaða, seɲˈoɾa, —ɾɾˌeplikˈo pˌeɣotj—
350
+ —en ˈeste kˈaso, ¿kˈomo os ˌatɾeβˈeis?
351
+ o, mexˈoɾ dˈitʃo, ¿kˈomo tenˈeis balˈoɾ pˌaɾa aθˈeɾme tˈan dˌesɣɾaθjˈaða i ˌatoɾmentˈaɾme asˈi kwˌando saβˈeis ke nˈo tˈɛŋɡo nˈi ˈuna sˈola amˈiɣa?
352
+ —ɾɾaθˈon de mˈas pˌaɾa sˈer mˈas pɾˌekaβˈiða, —dˈixo pˌeɣotj—
353
+ —pwˈeðo ˌimpeðˈiɾ, —ˌaɲaðjˈo mi mˈaðɾe—ke sˈean fˈinos i atˈɛntos konmˈiɣo.
354
+ ˈes pɾeθˈiso ke me kˈambje, ke me eskˈalðe el ɾɾˈostɾo.
355
+ kwalkjˈeɾa diɾˈia ke nˈo dˌeseˈaβaɪs ˈotɾa kˈosa, —ˌaɲaðjˈo mi mˈaðɾe ɾɾompjˈɛndo a ʎoɾˈaɾ i ʝˈɛndo a sentˈaɾse en la butˈaka pˌaɾa ˌakaɾiθjˈaɾme.
356
+ ˈa, mi keɾˈiðo daβˈid, pˈoβɾe ˈixo mˈio, tambjˈen seɾˈeis kapˈaθ de deθˈiɾ ke nˈo kjˈeɾo ˈeste tesˈoɾo kwˌando nˈo ˈaɪ kɾiatˈuɾa en el mˈundo mˈas amˈaða.
357
+ nˈaðje ˈa dˈitʃo tˈal kˈosa, seɲˈoɾa, —ˌeksklamˈo pˌeɣotj, ˌempeθˈando kon moβˈeɾse—
358
+ —lo aβˈeis dˈitʃo, o a lo mˈenos ˈesa ˈa sˈiðo bwˌestɾa ˌintenθjˈon, —pɾˌosiɣjˈo mi mˈaðɾe sin dexˈaɾ de ʎoɾˈaɾ—
359
+ pˌeɾo mi ˈixo sˈaβe ke le kjˈeɾo.
360
+ daβˈid ɾɾespˈonde, —¿sˈoɪ ˈuna mˈala mˈaðɾe?—
361
+ me pɾˌeɣuntˈo al bˈeɾ ke sus kaɾˈiθjas me aβˈian dˌespeɾtˈaðo.
362
+ —ˈaβla, ˈixo mˈio, —sˈoɪ ˈuna mˈaðɾe ˌeɣoˈista i kɾuˈel.
363
+ a ˈesto los tɾˈes nos pusˈimos a sˌoʎoθˈaɾ, ʝˈo mˈutʃo mˈas fwˈeɾte ke mi mˈaðɾe i pˌeɣotj,
364
+ ˌaʊnke estˈoɪ seɣˈuɾo ke nwˌestɾas lˈaɣɾimas ˈeɾan iɣwˈalmˈente sinθˈeɾas.
365
+ asˈi ke uβˈimos ʎoɾˈaðo lo bastˈante nos fwˈimos a ˌakostˈaɾ.
366
+ nˈo bjˈen me aβˈia doɾmˈiðo kwˌando mis ˌoleˈoθos bolβjˈeɾon a dˌespeɾtˈaɾme, i bˈi a mi mˈaðɾe sentˈaða al lˈaðo de mi kˈama.
367
+ me koxjˈo en sus bɾˈaθos i akˈeʎa bˈeθ me doɾmˈi de bˈeɾas ˌasta la maɲˈana siɣjˈɛnte.
368
+ nˈo pwˈeðo deθˈiɾ si fwˈe el domˈiŋɡo siɣjˈɛnte u ˈotɾo ke bolβˈi a bˈeɾ al kˌaβaʎˈeɾo de las paðˈiʎas nˈeɣɾas.
369
+ nˈo ˌaseɣˈuɾo la ˌeksaktitˈuð de mis fˈetʃas, pˌeɾo el kˈaso ˈes ke tˈoðos los domˈiŋɡos le aʎˈaβamos en la iɣlˈesja i nos ˌakompaɲˈaβa a kˈasa.
370
+ ˈuna bˈeθ nos ˈiθo ˈuna bisˈita bˌaxo el pɾetˈeksto de bˈeɾ ˈun xeɾˈanjo ke estˈaβa al balkˈon.
371
+ se me fˌiɣuɾˈo ke nˈo ɾɾˌepaɾˈaβa mˈutʃo en el xeɾˈanjo, pˌeɾo ˈantes de ˈiɾse sˌuplikˈo a mi mˈaðɾe ke le djˈeɾa ˈuna mˌatˈita.
372
+ ɾɾˌespondjˈole ke poðˈia koxˈeɾla ˈel mˈismo, a lo kwˈal se neɣˈo, ˌinsistjˈɛndo pˌaɾa ke se la djˈese de su mˈano.
373
+ mi mˈaðɾe ˌakθeðjˈo i el kˌaβaʎˈeɾo dˈixo ke la kˌonseɾβaɾˈia etˈeɾnamˈente, lo kwˈal me ˈiθo sˌospetʃˈaɾ ke nˈo ˈeɾan ɡɾˈandes sus kˌonoθimjˈɛntos,
374
+ pwˈesto ke ˌiɡnoɾˈaβa ke la flˈoɾ sˌepaɾˈaða de su tˈaʎo se mˌaɾtʃitaɾˈia al kˈaβo de ˈuno o dˈos dˈias.
375
+ pˌeɣotj nˈo pasˈaβa kon tˈanta fɾekwˈɛnθja las nˈotʃes en nwˌestɾa kˌompaɲˈia.
376
+ mi mˈaðɾe la miɾˈaβa kon ɡɾˈan dˌefeɾˈɛnθja, aˈun mˈas ke ˈantes, seɣˈun notˈe, i los tɾˈes kˌontinwˈaβamos sjˈɛndo los mexˈoɾes amˈiɣos del mˈundo.
377
+ sin embˈaɾɣo, ˌeksistˈia θjˈeɾta dˌifeɾˈɛnθja, ˈuna espˈeθje de kˌoɾteðˈad ˌindefinˈiβle.
378
+ alɣˈunas bˈeθes pˌeɣotj pˌaɾeθˈia ke ɾɾˌepɾotʃˈaβa a mi mˈaðɾe el ke se pusjˈese tˈoðos los lˈindos tɾˈaxes ke ʎenˈaβan sus aɾmˈaɾjos o el ke fwˈese de bisˈita kon fɾekwˈɛnθja a kˈasa de la beθˈina,
379
+ pˌeɾo tˈoðo ˈesto me lo ˌeksplikˈaβa ʝˈo ˌimpeɾfˈektamˈente.
380
+ pˈoko a pˈoko me ˌakostumbɾˈe a bˈeɾ al kˌaβaʎˈeɾo de las pˌatiʎas nˈeɣɾas, sin keɾˈeɾle poɾ ˈeso mˈas,
381
+ sin dexˈaɾ de tenˈeɾ los mˈismos θˈelos, pˌeɾo nˈo me saβˈia dˈaɾ kwˈɛnta de akˈeʎos sˌentimjˈɛntos pˈuɾamˈente ˌinstintˈiβos.
382
+ akˈeʎo sˌoβɾepasˈaβa a mi ɾɾˌaθonamjˈɛnto de nˈiɲo.
383
+ ˈuna ˌeɾmosˈisima maɲˈana de otˈoɲo me aʎˈaβa en nwˌestɾo paɾtˈeɾɾe kon mi mˈaðɾe, kwˌando mɾ.
384
+ muɾston, ke ˈeɾa su nˈombɾe, ʎeɣˈo a kaβˈaʎo.
385
+ sˌaluðˈo a mi mˈaðɾe, dˌixˈole ke se dˌiɾixˈia a lˌoˈustoˈe a bˈeɾ a ˈunos amˈiɣos ke le ˌespeɾˈaβan kon su ʝaɣ,
386
+ i pɾopˈuso ʎeβˈaɾme si akˈel pasˈeo poðˈia sˈer de mi aɣɾˈaðo.
387
+ el ˈaɪɾe ˈeɾa tˈan swˈaβe i el kaβˈaʎo pjafˈaβa tˈan nˈoβlemˈente a la pwˈeɾta del xaɾðˈin ke me dexˈe sˌeðuθˈiɾ.
388
+ fwˈi en bˈuska de pˌeɣotj pˌaɾa ke me bistjˈeɾa.
389
+ ˌentɾetˈanto, mɾ.
390
+ muɾston etʃˈo pjˈe a tjˈeɾɾa, se etʃˈo las ɾɾiˈɛndas al bɾˈaθo i siɣjˈo la ˌempaliθˈaða ke mi mˈaðɾe,
391
+ pˌaɾa aθˈeɾle kˌompaɲˈia, seɣˈia tambjˈen poɾ la pˈaɾte de aðˈɛntɾo.
392
+ me akwˈeɾðo ke pˌeɣotj i ʝˈo miɾˈaβamos de kwˌando en kwˌando poɾ la bentˈana, i los dˈos ke se pˌaseˈaβan pˌaɾeθˈian ˌeksaminˈaɾ el espˈino mˈujj de θˈeɾka.
393
+ de ɾɾepˈɛnte, pˌeɣotj, ke estˈaβa de mˈujj bwˈen umˈoɾ, ˌekspeɾˌimentˈo θjˈeɾta kˌontɾaɾjeðˈad i me peɪnˈo kon fwˈeɾθa,
394
+ kˈosa ke me ˌoβliɣˈo a aθˈeɾ ˈun xˈesto.
395
+ muɾston i ʝˈo nˈo taɾðˈamos en ˌalexˈaɾnos tɾotˈando poɾ la kˌaɾɾetˈeɾa.
396
+ me ʎeβˈaβa delˈante de su sˈiʎa, koxˈiðo kon ˈuno de sus bɾˈaθos, i nˈo poðˈia mˈenos dˌeβolβˈeɾ de kwˌando en kwˌando la kaβˈeθa pˌaɾa miɾˈaɾ su ɾɾˈostɾo.
397
+ tenˈia ˈuna espˈeθje de ˈoxos nˈeɣɾos de aβˈismo.
398
+ nˈo konˈoθko ˈotɾa ˌekspɾesjˈon ke pwˈeða dˌefinˈiɾ ˈun ˈoxo kˈujja pɾˌofundiðˈad ˈes ˌimpenetɾˈaβle, ke en ˈuna lixˈeɾa dˌistɾakθjˈon paɾˈeθen de ɾɾepˈɛnte belˈaɾse o ˌapaɣˈaɾse.
399
+ ˌeksaminˈe akˈeʎa kˈaɾa kon θjˈeɾto espˈanto, i me pɾˌeɣuntˈe kˈe seɾˈia lo ke asˈi pɾˌeokupˈaβa su ˌimaxˌinaθjˈon.
400
+ nˈo dexˈe de ˌadmiɾˈaɾ sus nˈeɣɾas pˌatiʎas i su bjˈen ˌafeɪtˈaða bˈaɾβa ke nˈo mostɾˈaβa sˈino los pˈuntos nˈeɣɾos ke tambjˈen imˈitan la bˈaɾβa en ˈuna fiɣˈuɾa de θˈeɾa.
melo/text/fr_phonemizer/example_ipa.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8cf7852f6caf514451f2bc3e85e437a683fb725f4568d5877649b0d9bed0a4bd
3
+ size 11784078
melo/text/japanese.py CHANGED
@@ -566,7 +566,7 @@ def distribute_phone(n_phone, n_word):
566
 
567
  # tokenizer = AutoTokenizer.from_pretrained('cl-tohoku/bert-base-japanese-v3')
568
 
569
- model_id = 'cl-tohoku/bert-base-japanese-v3'
570
  tokenizer = AutoTokenizer.from_pretrained(model_id)
571
  def g2p(norm_text):
572
 
@@ -644,4 +644,4 @@ if __name__ == "__main__":
644
  # conv = kakasi.getConverter()
645
  # katakana_text = conv.do('ええ、僕はおきなと申します。こちらの小さいわらべは杏子。ご挨拶が遅れてしまいすみません。あなたの名は?') # Replace with your Chinese text
646
 
647
- # print(katakana_text) # Output: ニーハオセカイ
 
566
 
567
  # tokenizer = AutoTokenizer.from_pretrained('cl-tohoku/bert-base-japanese-v3')
568
 
569
+ model_id = 'tohoku-nlp/bert-base-japanese-v3'
570
  tokenizer = AutoTokenizer.from_pretrained(model_id)
571
  def g2p(norm_text):
572
 
 
644
  # conv = kakasi.getConverter()
645
  # katakana_text = conv.do('ええ、僕はおきなと申します。こちらの小さいわらべは杏子。ご挨拶が遅れてしまいすみません。あなたの名は?') # Replace with your Chinese text
646
 
647
+ # print(katakana_text) # Output: ニーハオセカイ
melo/text/japanese_bert.py CHANGED
@@ -3,13 +3,9 @@ from transformers import AutoTokenizer, AutoModelForMaskedLM
3
  import sys
4
 
5
 
6
-
7
- # model = None
8
- # model_id = 'cl-tohoku/bert-base-japanese-v3'
9
- # tokenizer = AutoTokenizer.from_pretrained(model_id)
10
  models = {}
11
  tokenizers = {}
12
- def get_bert_feature(text, word2ph, device=None, model_id='cl-tohoku/bert-base-japanese-v3'):
13
  global model
14
  global tokenizer
15
 
 
3
  import sys
4
 
5
 
 
 
 
 
6
  models = {}
7
  tokenizers = {}
8
+ def get_bert_feature(text, word2ph, device=None, model_id='tohoku-nlp/bert-base-japanese-v3'):
9
  global model
10
  global tokenizer
11
 
melo/train.py ADDED
@@ -0,0 +1,635 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # flake8: noqa: E402
2
+
3
+ import os
4
+ import torch
5
+ from torch.nn import functional as F
6
+ from torch.utils.data import DataLoader
7
+ from torch.utils.tensorboard import SummaryWriter
8
+ import torch.distributed as dist
9
+ from torch.nn.parallel import DistributedDataParallel as DDP
10
+ from torch.cuda.amp import autocast, GradScaler
11
+ from tqdm import tqdm
12
+ import logging
13
+
14
+ logging.getLogger("numba").setLevel(logging.WARNING)
15
+ import commons
16
+ import utils
17
+ from data_utils import (
18
+ TextAudioSpeakerLoader,
19
+ TextAudioSpeakerCollate,
20
+ DistributedBucketSampler,
21
+ )
22
+ from models import (
23
+ SynthesizerTrn,
24
+ MultiPeriodDiscriminator,
25
+ DurationDiscriminator,
26
+ )
27
+ from losses import generator_loss, discriminator_loss, feature_loss, kl_loss
28
+ from mel_processing import mel_spectrogram_torch, spec_to_mel_torch
29
+ from text.symbols import symbols
30
+ from melo.download_utils import load_pretrain_model
31
+
32
+ torch.backends.cuda.matmul.allow_tf32 = True
33
+ torch.backends.cudnn.allow_tf32 = (
34
+ True # If encontered training problem,please try to disable TF32.
35
+ )
36
+ torch.set_float32_matmul_precision("medium")
37
+
38
+
39
+ torch.backends.cudnn.benchmark = True
40
+ torch.backends.cuda.sdp_kernel("flash")
41
+ torch.backends.cuda.enable_flash_sdp(True)
42
+ # torch.backends.cuda.enable_mem_efficient_sdp(
43
+ # True
44
+ # ) # Not available if torch version is lower than 2.0
45
+ torch.backends.cuda.enable_math_sdp(True)
46
+ global_step = 0
47
+
48
+
49
+ def run():
50
+ hps = utils.get_hparams()
51
+ local_rank = int(os.environ["LOCAL_RANK"])
52
+ dist.init_process_group(
53
+ backend="gloo",
54
+ init_method="env://", # Due to some training problem,we proposed to use gloo instead of nccl.
55
+ rank=local_rank,
56
+ ) # Use torchrun instead of mp.spawn
57
+ rank = dist.get_rank()
58
+ n_gpus = dist.get_world_size()
59
+
60
+ torch.manual_seed(hps.train.seed)
61
+ torch.cuda.set_device(rank)
62
+ global global_step
63
+ if rank == 0:
64
+ logger = utils.get_logger(hps.model_dir)
65
+ logger.info(hps)
66
+ utils.check_git_hash(hps.model_dir)
67
+ writer = SummaryWriter(log_dir=hps.model_dir)
68
+ writer_eval = SummaryWriter(log_dir=os.path.join(hps.model_dir, "eval"))
69
+ train_dataset = TextAudioSpeakerLoader(hps.data.training_files, hps.data)
70
+ train_sampler = DistributedBucketSampler(
71
+ train_dataset,
72
+ hps.train.batch_size,
73
+ [32, 300, 400, 500, 600, 700, 800, 900, 1000],
74
+ num_replicas=n_gpus,
75
+ rank=rank,
76
+ shuffle=True,
77
+ )
78
+ collate_fn = TextAudioSpeakerCollate()
79
+ train_loader = DataLoader(
80
+ train_dataset,
81
+ num_workers=16,
82
+ shuffle=False,
83
+ pin_memory=True,
84
+ collate_fn=collate_fn,
85
+ batch_sampler=train_sampler,
86
+ persistent_workers=True,
87
+ prefetch_factor=4,
88
+ ) # DataLoader config could be adjusted.
89
+ if rank == 0:
90
+ eval_dataset = TextAudioSpeakerLoader(hps.data.validation_files, hps.data)
91
+ eval_loader = DataLoader(
92
+ eval_dataset,
93
+ num_workers=0,
94
+ shuffle=False,
95
+ batch_size=1,
96
+ pin_memory=True,
97
+ drop_last=False,
98
+ collate_fn=collate_fn,
99
+ )
100
+ if (
101
+ "use_noise_scaled_mas" in hps.model.keys()
102
+ and hps.model.use_noise_scaled_mas is True
103
+ ):
104
+ print("Using noise scaled MAS for VITS2")
105
+ mas_noise_scale_initial = 0.01
106
+ noise_scale_delta = 2e-6
107
+ else:
108
+ print("Using normal MAS for VITS1")
109
+ mas_noise_scale_initial = 0.0
110
+ noise_scale_delta = 0.0
111
+ if (
112
+ "use_duration_discriminator" in hps.model.keys()
113
+ and hps.model.use_duration_discriminator is True
114
+ ):
115
+ print("Using duration discriminator for VITS2")
116
+ net_dur_disc = DurationDiscriminator(
117
+ hps.model.hidden_channels,
118
+ hps.model.hidden_channels,
119
+ 3,
120
+ 0.1,
121
+ gin_channels=hps.model.gin_channels if hps.data.n_speakers != 0 else 0,
122
+ ).cuda(rank)
123
+ if (
124
+ "use_spk_conditioned_encoder" in hps.model.keys()
125
+ and hps.model.use_spk_conditioned_encoder is True
126
+ ):
127
+ if hps.data.n_speakers == 0:
128
+ raise ValueError(
129
+ "n_speakers must be > 0 when using spk conditioned encoder to train multi-speaker model"
130
+ )
131
+ else:
132
+ print("Using normal encoder for VITS1")
133
+
134
+ net_g = SynthesizerTrn(
135
+ len(symbols),
136
+ hps.data.filter_length // 2 + 1,
137
+ hps.train.segment_size // hps.data.hop_length,
138
+ n_speakers=hps.data.n_speakers,
139
+ mas_noise_scale_initial=mas_noise_scale_initial,
140
+ noise_scale_delta=noise_scale_delta,
141
+ **hps.model,
142
+ ).cuda(rank)
143
+
144
+ net_d = MultiPeriodDiscriminator(hps.model.use_spectral_norm).cuda(rank)
145
+ optim_g = torch.optim.AdamW(
146
+ filter(lambda p: p.requires_grad, net_g.parameters()),
147
+ hps.train.learning_rate,
148
+ betas=hps.train.betas,
149
+ eps=hps.train.eps,
150
+ )
151
+ optim_d = torch.optim.AdamW(
152
+ net_d.parameters(),
153
+ hps.train.learning_rate,
154
+ betas=hps.train.betas,
155
+ eps=hps.train.eps,
156
+ )
157
+ if net_dur_disc is not None:
158
+ optim_dur_disc = torch.optim.AdamW(
159
+ net_dur_disc.parameters(),
160
+ hps.train.learning_rate,
161
+ betas=hps.train.betas,
162
+ eps=hps.train.eps,
163
+ )
164
+ else:
165
+ optim_dur_disc = None
166
+ net_g = DDP(net_g, device_ids=[rank], find_unused_parameters=True)
167
+ net_d = DDP(net_d, device_ids=[rank], find_unused_parameters=True)
168
+
169
+ pretrain_G, pretrain_D, pretrain_dur = load_pretrain_model()
170
+ hps.pretrain_G = hps.pretrain_G or pretrain_G
171
+ hps.pretrain_D = hps.pretrain_D or pretrain_D
172
+ hps.pretrain_dur = hps.pretrain_dur or pretrain_dur
173
+
174
+ if hps.pretrain_G:
175
+ utils.load_checkpoint(
176
+ hps.pretrain_G,
177
+ net_g,
178
+ None,
179
+ skip_optimizer=True
180
+ )
181
+ if hps.pretrain_D:
182
+ utils.load_checkpoint(
183
+ hps.pretrain_D,
184
+ net_d,
185
+ None,
186
+ skip_optimizer=True
187
+ )
188
+
189
+
190
+ if net_dur_disc is not None:
191
+ net_dur_disc = DDP(net_dur_disc, device_ids=[rank], find_unused_parameters=True)
192
+ if hps.pretrain_dur:
193
+ utils.load_checkpoint(
194
+ hps.pretrain_dur,
195
+ net_dur_disc,
196
+ None,
197
+ skip_optimizer=True
198
+ )
199
+
200
+ try:
201
+ if net_dur_disc is not None:
202
+ _, _, dur_resume_lr, epoch_str = utils.load_checkpoint(
203
+ utils.latest_checkpoint_path(hps.model_dir, "DUR_*.pth"),
204
+ net_dur_disc,
205
+ optim_dur_disc,
206
+ skip_optimizer=hps.train.skip_optimizer
207
+ if "skip_optimizer" in hps.train
208
+ else True,
209
+ )
210
+ _, optim_g, g_resume_lr, epoch_str = utils.load_checkpoint(
211
+ utils.latest_checkpoint_path(hps.model_dir, "G_*.pth"),
212
+ net_g,
213
+ optim_g,
214
+ skip_optimizer=hps.train.skip_optimizer
215
+ if "skip_optimizer" in hps.train
216
+ else True,
217
+ )
218
+ _, optim_d, d_resume_lr, epoch_str = utils.load_checkpoint(
219
+ utils.latest_checkpoint_path(hps.model_dir, "D_*.pth"),
220
+ net_d,
221
+ optim_d,
222
+ skip_optimizer=hps.train.skip_optimizer
223
+ if "skip_optimizer" in hps.train
224
+ else True,
225
+ )
226
+ if not optim_g.param_groups[0].get("initial_lr"):
227
+ optim_g.param_groups[0]["initial_lr"] = g_resume_lr
228
+ if not optim_d.param_groups[0].get("initial_lr"):
229
+ optim_d.param_groups[0]["initial_lr"] = d_resume_lr
230
+ if not optim_dur_disc.param_groups[0].get("initial_lr"):
231
+ optim_dur_disc.param_groups[0]["initial_lr"] = dur_resume_lr
232
+
233
+ epoch_str = max(epoch_str, 1)
234
+ global_step = (epoch_str - 1) * len(train_loader)
235
+ except Exception as e:
236
+ print(e)
237
+ epoch_str = 1
238
+ global_step = 0
239
+
240
+ scheduler_g = torch.optim.lr_scheduler.ExponentialLR(
241
+ optim_g, gamma=hps.train.lr_decay, last_epoch=epoch_str - 2
242
+ )
243
+ scheduler_d = torch.optim.lr_scheduler.ExponentialLR(
244
+ optim_d, gamma=hps.train.lr_decay, last_epoch=epoch_str - 2
245
+ )
246
+ if net_dur_disc is not None:
247
+ scheduler_dur_disc = torch.optim.lr_scheduler.ExponentialLR(
248
+ optim_dur_disc, gamma=hps.train.lr_decay, last_epoch=epoch_str - 2
249
+ )
250
+ else:
251
+ scheduler_dur_disc = None
252
+ scaler = GradScaler(enabled=hps.train.fp16_run)
253
+
254
+ for epoch in range(epoch_str, hps.train.epochs + 1):
255
+ try:
256
+ if rank == 0:
257
+ train_and_evaluate(
258
+ rank,
259
+ epoch,
260
+ hps,
261
+ [net_g, net_d, net_dur_disc],
262
+ [optim_g, optim_d, optim_dur_disc],
263
+ [scheduler_g, scheduler_d, scheduler_dur_disc],
264
+ scaler,
265
+ [train_loader, eval_loader],
266
+ logger,
267
+ [writer, writer_eval],
268
+ )
269
+ else:
270
+ train_and_evaluate(
271
+ rank,
272
+ epoch,
273
+ hps,
274
+ [net_g, net_d, net_dur_disc],
275
+ [optim_g, optim_d, optim_dur_disc],
276
+ [scheduler_g, scheduler_d, scheduler_dur_disc],
277
+ scaler,
278
+ [train_loader, None],
279
+ None,
280
+ None,
281
+ )
282
+ except Exception as e:
283
+ print(e)
284
+ torch.cuda.empty_cache()
285
+ scheduler_g.step()
286
+ scheduler_d.step()
287
+ if net_dur_disc is not None:
288
+ scheduler_dur_disc.step()
289
+
290
+
291
+ def train_and_evaluate(
292
+ rank, epoch, hps, nets, optims, schedulers, scaler, loaders, logger, writers
293
+ ):
294
+ net_g, net_d, net_dur_disc = nets
295
+ optim_g, optim_d, optim_dur_disc = optims
296
+ scheduler_g, scheduler_d, scheduler_dur_disc = schedulers
297
+ train_loader, eval_loader = loaders
298
+ if writers is not None:
299
+ writer, writer_eval = writers
300
+
301
+ train_loader.batch_sampler.set_epoch(epoch)
302
+ global global_step
303
+
304
+ net_g.train()
305
+ net_d.train()
306
+ if net_dur_disc is not None:
307
+ net_dur_disc.train()
308
+ for batch_idx, (
309
+ x,
310
+ x_lengths,
311
+ spec,
312
+ spec_lengths,
313
+ y,
314
+ y_lengths,
315
+ speakers,
316
+ tone,
317
+ language,
318
+ bert,
319
+ ja_bert,
320
+ ) in enumerate(tqdm(train_loader)):
321
+ if net_g.module.use_noise_scaled_mas:
322
+ current_mas_noise_scale = (
323
+ net_g.module.mas_noise_scale_initial
324
+ - net_g.module.noise_scale_delta * global_step
325
+ )
326
+ net_g.module.current_mas_noise_scale = max(current_mas_noise_scale, 0.0)
327
+ x, x_lengths = x.cuda(rank, non_blocking=True), x_lengths.cuda(
328
+ rank, non_blocking=True
329
+ )
330
+ spec, spec_lengths = spec.cuda(rank, non_blocking=True), spec_lengths.cuda(
331
+ rank, non_blocking=True
332
+ )
333
+ y, y_lengths = y.cuda(rank, non_blocking=True), y_lengths.cuda(
334
+ rank, non_blocking=True
335
+ )
336
+ speakers = speakers.cuda(rank, non_blocking=True)
337
+ tone = tone.cuda(rank, non_blocking=True)
338
+ language = language.cuda(rank, non_blocking=True)
339
+ bert = bert.cuda(rank, non_blocking=True)
340
+ ja_bert = ja_bert.cuda(rank, non_blocking=True)
341
+
342
+ with autocast(enabled=hps.train.fp16_run):
343
+ (
344
+ y_hat,
345
+ l_length,
346
+ attn,
347
+ ids_slice,
348
+ x_mask,
349
+ z_mask,
350
+ (z, z_p, m_p, logs_p, m_q, logs_q),
351
+ (hidden_x, logw, logw_),
352
+ ) = net_g(
353
+ x,
354
+ x_lengths,
355
+ spec,
356
+ spec_lengths,
357
+ speakers,
358
+ tone,
359
+ language,
360
+ bert,
361
+ ja_bert,
362
+ )
363
+ mel = spec_to_mel_torch(
364
+ spec,
365
+ hps.data.filter_length,
366
+ hps.data.n_mel_channels,
367
+ hps.data.sampling_rate,
368
+ hps.data.mel_fmin,
369
+ hps.data.mel_fmax,
370
+ )
371
+ y_mel = commons.slice_segments(
372
+ mel, ids_slice, hps.train.segment_size // hps.data.hop_length
373
+ )
374
+ y_hat_mel = mel_spectrogram_torch(
375
+ y_hat.squeeze(1),
376
+ hps.data.filter_length,
377
+ hps.data.n_mel_channels,
378
+ hps.data.sampling_rate,
379
+ hps.data.hop_length,
380
+ hps.data.win_length,
381
+ hps.data.mel_fmin,
382
+ hps.data.mel_fmax,
383
+ )
384
+
385
+ y = commons.slice_segments(
386
+ y, ids_slice * hps.data.hop_length, hps.train.segment_size
387
+ ) # slice
388
+
389
+ # Discriminator
390
+ y_d_hat_r, y_d_hat_g, _, _ = net_d(y, y_hat.detach())
391
+ with autocast(enabled=False):
392
+ loss_disc, losses_disc_r, losses_disc_g = discriminator_loss(
393
+ y_d_hat_r, y_d_hat_g
394
+ )
395
+ loss_disc_all = loss_disc
396
+ if net_dur_disc is not None:
397
+ y_dur_hat_r, y_dur_hat_g = net_dur_disc(
398
+ hidden_x.detach(), x_mask.detach(), logw.detach(), logw_.detach()
399
+ )
400
+ with autocast(enabled=False):
401
+ # TODO: I think need to mean using the mask, but for now, just mean all
402
+ (
403
+ loss_dur_disc,
404
+ losses_dur_disc_r,
405
+ losses_dur_disc_g,
406
+ ) = discriminator_loss(y_dur_hat_r, y_dur_hat_g)
407
+ loss_dur_disc_all = loss_dur_disc
408
+ optim_dur_disc.zero_grad()
409
+ scaler.scale(loss_dur_disc_all).backward()
410
+ scaler.unscale_(optim_dur_disc)
411
+ commons.clip_grad_value_(net_dur_disc.parameters(), None)
412
+ scaler.step(optim_dur_disc)
413
+
414
+ optim_d.zero_grad()
415
+ scaler.scale(loss_disc_all).backward()
416
+ scaler.unscale_(optim_d)
417
+ grad_norm_d = commons.clip_grad_value_(net_d.parameters(), None)
418
+ scaler.step(optim_d)
419
+
420
+ with autocast(enabled=hps.train.fp16_run):
421
+ # Generator
422
+ y_d_hat_r, y_d_hat_g, fmap_r, fmap_g = net_d(y, y_hat)
423
+ if net_dur_disc is not None:
424
+ y_dur_hat_r, y_dur_hat_g = net_dur_disc(hidden_x, x_mask, logw, logw_)
425
+ with autocast(enabled=False):
426
+ loss_dur = torch.sum(l_length.float())
427
+ loss_mel = F.l1_loss(y_mel, y_hat_mel) * hps.train.c_mel
428
+ loss_kl = kl_loss(z_p, logs_q, m_p, logs_p, z_mask) * hps.train.c_kl
429
+
430
+ loss_fm = feature_loss(fmap_r, fmap_g)
431
+ loss_gen, losses_gen = generator_loss(y_d_hat_g)
432
+ loss_gen_all = loss_gen + loss_fm + loss_mel + loss_dur + loss_kl
433
+ if net_dur_disc is not None:
434
+ loss_dur_gen, losses_dur_gen = generator_loss(y_dur_hat_g)
435
+ loss_gen_all += loss_dur_gen
436
+ optim_g.zero_grad()
437
+ scaler.scale(loss_gen_all).backward()
438
+ scaler.unscale_(optim_g)
439
+ grad_norm_g = commons.clip_grad_value_(net_g.parameters(), None)
440
+ scaler.step(optim_g)
441
+ scaler.update()
442
+
443
+ if rank == 0:
444
+ if global_step % hps.train.log_interval == 0:
445
+ lr = optim_g.param_groups[0]["lr"]
446
+ losses = [loss_disc, loss_gen, loss_fm, loss_mel, loss_dur, loss_kl]
447
+ logger.info(
448
+ "Train Epoch: {} [{:.0f}%]".format(
449
+ epoch, 100.0 * batch_idx / len(train_loader)
450
+ )
451
+ )
452
+ logger.info([x.item() for x in losses] + [global_step, lr])
453
+
454
+ scalar_dict = {
455
+ "loss/g/total": loss_gen_all,
456
+ "loss/d/total": loss_disc_all,
457
+ "learning_rate": lr,
458
+ "grad_norm_d": grad_norm_d,
459
+ "grad_norm_g": grad_norm_g,
460
+ }
461
+ scalar_dict.update(
462
+ {
463
+ "loss/g/fm": loss_fm,
464
+ "loss/g/mel": loss_mel,
465
+ "loss/g/dur": loss_dur,
466
+ "loss/g/kl": loss_kl,
467
+ }
468
+ )
469
+ scalar_dict.update(
470
+ {"loss/g/{}".format(i): v for i, v in enumerate(losses_gen)}
471
+ )
472
+ scalar_dict.update(
473
+ {"loss/d_r/{}".format(i): v for i, v in enumerate(losses_disc_r)}
474
+ )
475
+ scalar_dict.update(
476
+ {"loss/d_g/{}".format(i): v for i, v in enumerate(losses_disc_g)}
477
+ )
478
+
479
+ image_dict = {
480
+ "slice/mel_org": utils.plot_spectrogram_to_numpy(
481
+ y_mel[0].data.cpu().numpy()
482
+ ),
483
+ "slice/mel_gen": utils.plot_spectrogram_to_numpy(
484
+ y_hat_mel[0].data.cpu().numpy()
485
+ ),
486
+ "all/mel": utils.plot_spectrogram_to_numpy(
487
+ mel[0].data.cpu().numpy()
488
+ ),
489
+ "all/attn": utils.plot_alignment_to_numpy(
490
+ attn[0, 0].data.cpu().numpy()
491
+ ),
492
+ }
493
+ utils.summarize(
494
+ writer=writer,
495
+ global_step=global_step,
496
+ images=image_dict,
497
+ scalars=scalar_dict,
498
+ )
499
+
500
+ if global_step % hps.train.eval_interval == 0:
501
+ evaluate(hps, net_g, eval_loader, writer_eval)
502
+ utils.save_checkpoint(
503
+ net_g,
504
+ optim_g,
505
+ hps.train.learning_rate,
506
+ epoch,
507
+ os.path.join(hps.model_dir, "G_{}.pth".format(global_step)),
508
+ )
509
+ utils.save_checkpoint(
510
+ net_d,
511
+ optim_d,
512
+ hps.train.learning_rate,
513
+ epoch,
514
+ os.path.join(hps.model_dir, "D_{}.pth".format(global_step)),
515
+ )
516
+ if net_dur_disc is not None:
517
+ utils.save_checkpoint(
518
+ net_dur_disc,
519
+ optim_dur_disc,
520
+ hps.train.learning_rate,
521
+ epoch,
522
+ os.path.join(hps.model_dir, "DUR_{}.pth".format(global_step)),
523
+ )
524
+ keep_ckpts = getattr(hps.train, "keep_ckpts", 5)
525
+ if keep_ckpts > 0:
526
+ utils.clean_checkpoints(
527
+ path_to_models=hps.model_dir,
528
+ n_ckpts_to_keep=keep_ckpts,
529
+ sort_by_time=True,
530
+ )
531
+
532
+ global_step += 1
533
+
534
+ if rank == 0:
535
+ logger.info("====> Epoch: {}".format(epoch))
536
+ torch.cuda.empty_cache()
537
+
538
+
539
+ def evaluate(hps, generator, eval_loader, writer_eval):
540
+ generator.eval()
541
+ image_dict = {}
542
+ audio_dict = {}
543
+ print("Evaluating ...")
544
+ with torch.no_grad():
545
+ for batch_idx, (
546
+ x,
547
+ x_lengths,
548
+ spec,
549
+ spec_lengths,
550
+ y,
551
+ y_lengths,
552
+ speakers,
553
+ tone,
554
+ language,
555
+ bert,
556
+ ja_bert,
557
+ ) in enumerate(eval_loader):
558
+ x, x_lengths = x.cuda(), x_lengths.cuda()
559
+ spec, spec_lengths = spec.cuda(), spec_lengths.cuda()
560
+ y, y_lengths = y.cuda(), y_lengths.cuda()
561
+ speakers = speakers.cuda()
562
+ bert = bert.cuda()
563
+ ja_bert = ja_bert.cuda()
564
+ tone = tone.cuda()
565
+ language = language.cuda()
566
+ for use_sdp in [True, False]:
567
+ y_hat, attn, mask, *_ = generator.module.infer(
568
+ x,
569
+ x_lengths,
570
+ speakers,
571
+ tone,
572
+ language,
573
+ bert,
574
+ ja_bert,
575
+ y=spec,
576
+ max_len=1000,
577
+ sdp_ratio=0.0 if not use_sdp else 1.0,
578
+ )
579
+ y_hat_lengths = mask.sum([1, 2]).long() * hps.data.hop_length
580
+
581
+ mel = spec_to_mel_torch(
582
+ spec,
583
+ hps.data.filter_length,
584
+ hps.data.n_mel_channels,
585
+ hps.data.sampling_rate,
586
+ hps.data.mel_fmin,
587
+ hps.data.mel_fmax,
588
+ )
589
+ y_hat_mel = mel_spectrogram_torch(
590
+ y_hat.squeeze(1).float(),
591
+ hps.data.filter_length,
592
+ hps.data.n_mel_channels,
593
+ hps.data.sampling_rate,
594
+ hps.data.hop_length,
595
+ hps.data.win_length,
596
+ hps.data.mel_fmin,
597
+ hps.data.mel_fmax,
598
+ )
599
+ image_dict.update(
600
+ {
601
+ f"gen/mel_{batch_idx}": utils.plot_spectrogram_to_numpy(
602
+ y_hat_mel[0].cpu().numpy()
603
+ )
604
+ }
605
+ )
606
+ audio_dict.update(
607
+ {
608
+ f"gen/audio_{batch_idx}_{use_sdp}": y_hat[
609
+ 0, :, : y_hat_lengths[0]
610
+ ]
611
+ }
612
+ )
613
+ image_dict.update(
614
+ {
615
+ f"gt/mel_{batch_idx}": utils.plot_spectrogram_to_numpy(
616
+ mel[0].cpu().numpy()
617
+ )
618
+ }
619
+ )
620
+ audio_dict.update({f"gt/audio_{batch_idx}": y[0, :, : y_lengths[0]]})
621
+
622
+ utils.summarize(
623
+ writer=writer_eval,
624
+ global_step=global_step,
625
+ images=image_dict,
626
+ audios=audio_dict,
627
+ audio_sampling_rate=hps.data.sampling_rate,
628
+ )
629
+ generator.train()
630
+ print('Evauate done')
631
+ torch.cuda.empty_cache()
632
+
633
+
634
+ if __name__ == "__main__":
635
+ run()
melo/train.sh ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ CONFIG=$1
2
+ GPUS=$2
3
+ MODEL_NAME=$(basename "$(dirname $CONFIG)")
4
+
5
+ PORT=10902
6
+
7
+ while : # auto-resume: the code sometimes crash due to bug of gloo on some gpus
8
+ do
9
+ torchrun --nproc_per_node=$GPUS \
10
+ --master_port=$PORT \
11
+ train.py --c $CONFIG --model $MODEL_NAME
12
+
13
+ for PID in $(ps -aux | grep $CONFIG | grep python | awk '{print $2}')
14
+ do
15
+ echo $PID
16
+ kill -9 $PID
17
+ done
18
+ sleep 30
19
+ done
melo/utils.py CHANGED
@@ -9,9 +9,9 @@ from scipy.io.wavfile import read
9
  import torch
10
  import torchaudio
11
  import librosa
12
- from .text import cleaned_text_to_sequence, get_bert
13
- from .text.cleaner import clean_text
14
- from . import commons
15
 
16
  MATPLOTLIB_FLAG = False
17
 
@@ -60,8 +60,8 @@ def get_text_for_tts_infer(text, language_str, hps, device, symbol_to_id=None):
60
  def load_checkpoint(checkpoint_path, model, optimizer=None, skip_optimizer=False):
61
  assert os.path.isfile(checkpoint_path)
62
  checkpoint_dict = torch.load(checkpoint_path, map_location="cpu")
63
- iteration = checkpoint_dict["iteration"]
64
- learning_rate = checkpoint_dict["learning_rate"]
65
  if (
66
  optimizer is not None
67
  and not skip_optimizer
@@ -92,6 +92,7 @@ def load_checkpoint(checkpoint_path, model, optimizer=None, skip_optimizer=False
92
  v.shape,
93
  )
94
  except Exception as e:
 
95
  # For upgrading from the old version
96
  if "ja_bert_proj" in k:
97
  v = torch.zeros_like(v)
@@ -249,7 +250,9 @@ def get_hparams(init=True):
249
  default="./configs/base.json",
250
  help="JSON file for configuration",
251
  )
252
- parser.add_argument('--local-rank', type=int, default=0)
 
 
253
  parser.add_argument("-m", "--model", type=str, required=True, help="Model name")
254
  parser.add_argument('--pretrain_G', type=str, default=None,
255
  help='pretrain model')
@@ -280,6 +283,7 @@ def get_hparams(init=True):
280
  hparams.pretrain_G = args.pretrain_G
281
  hparams.pretrain_D = args.pretrain_D
282
  hparams.pretrain_dur = args.pretrain_dur
 
283
  return hparams
284
 
285
 
 
9
  import torch
10
  import torchaudio
11
  import librosa
12
+ from melo.text import cleaned_text_to_sequence, get_bert
13
+ from melo.text.cleaner import clean_text
14
+ from melo import commons
15
 
16
  MATPLOTLIB_FLAG = False
17
 
 
60
  def load_checkpoint(checkpoint_path, model, optimizer=None, skip_optimizer=False):
61
  assert os.path.isfile(checkpoint_path)
62
  checkpoint_dict = torch.load(checkpoint_path, map_location="cpu")
63
+ iteration = checkpoint_dict.get("iteration", 0)
64
+ learning_rate = checkpoint_dict.get("learning_rate", 0.)
65
  if (
66
  optimizer is not None
67
  and not skip_optimizer
 
92
  v.shape,
93
  )
94
  except Exception as e:
95
+ print(e)
96
  # For upgrading from the old version
97
  if "ja_bert_proj" in k:
98
  v = torch.zeros_like(v)
 
250
  default="./configs/base.json",
251
  help="JSON file for configuration",
252
  )
253
+ parser.add_argument('--local_rank', type=int, default=0)
254
+ parser.add_argument('--world-size', type=int, default=1)
255
+ parser.add_argument('--port', type=int, default=10000)
256
  parser.add_argument("-m", "--model", type=str, required=True, help="Model name")
257
  parser.add_argument('--pretrain_G', type=str, default=None,
258
  help='pretrain model')
 
283
  hparams.pretrain_G = args.pretrain_G
284
  hparams.pretrain_D = args.pretrain_D
285
  hparams.pretrain_dur = args.pretrain_dur
286
+ hparams.port = args.port
287
  return hparams
288
 
289