MCPcopy
hub / github.com/babysor/MockingBird / load_from_browser

Method load_from_browser

toolbox/__init__.py:146–173  ·  view source on GitHub ↗
(self, fpath=None)

Source from the content-addressed store, hash-verified

144 self.ui.populate_gen_options(seed, self.trim_silences)
145
146 def load_from_browser(self, fpath=None):
147 if fpath is None:
148 fpath = Path(self.datasets_root,
149 self.ui.current_dataset_name,
150 self.ui.current_speaker_name,
151 self.ui.current_utterance_name)
152 name = str(fpath.relative_to(self.datasets_root))
153 speaker_name = self.ui.current_dataset_name + '_' + self.ui.current_speaker_name
154
155 # Select the next utterance
156 if self.ui.auto_next_checkbox.isChecked():
157 self.ui.browser_select_next()
158 elif fpath == "":
159 return
160 else:
161 name = fpath.name
162 speaker_name = fpath.parent.name
163
164 if fpath.suffix.lower() == ".mp3" and self.no_mp3_support:
165 self.ui.log("Error: No mp3 file argument was passed but an mp3 file was used")
166 return
167
168 # Get the wav from the disk. We take the wav with the vocoder/synthesizer format for
169 # playback, so as to have a fair comparison with the generated audio
170 wav = Synthesizer.load_preprocess_wav(fpath)
171 self.ui.log("Loaded %s" % name)
172
173 self.add_real_utterance(wav, name, speaker_name)
174
175 def record(self):
176 wav = self.ui.record_one(encoder.sampling_rate, 5)

Callers 1

setup_eventsMethod · 0.95

Calls 4

add_real_utteranceMethod · 0.95
browser_select_nextMethod · 0.80
load_preprocess_wavMethod · 0.80
logMethod · 0.45

Tested by

no test coverage detected