예제 #1
0
 def process(metadata: AudioClipMetadata):
     new_path = audio_folder / metadata.path.with_suffix('.wav').name
     if not new_path.exists():
         audio_data = silent_load(str(metadata.path), self.dataset.sr,
                                  self.dataset.mono)
         soundfile.write(str(new_path), audio_data, self.dataset.sr)
     metadata.path = new_path
예제 #2
0
파일: serialize.py 프로젝트: castorini/howl
 def process(metadata: AudioClipMetadata):
     new_path = (audio_folder / metadata.audio_id).with_suffix(".wav")
     # TODO:: process function should also take in sample (AudioClipExample)
     #        and use sample.audio_data when metadata.path does not exist
     if not new_path.exists():
         audio_data = silent_load(str(metadata.path), self.dataset.sr, self.dataset.mono)
         soundfile.write(str(new_path), audio_data, self.dataset.sr)
     metadata.path = new_path
예제 #3
0
 def __getitem__(self, idx) -> ClassificationClipExample:
     metadata = self.metadata_list[idx]
     audio_data = silent_load(str(metadata.path), self.sr, self.mono)
     return ClassificationClipExample(
         metadata=metadata,
         audio_data=torch.from_numpy(audio_data),
         sample_rate=self.sr,
         label=self.label_map[metadata.transcription])
예제 #4
0
 def __getitem__(self, idx) -> WakeWordClipExample:
     metadata = self.metadata_list[idx]
     audio_data = silent_load(str(metadata.path), self.sr, self.mono)
     return WakeWordClipExample(
         metadata=metadata,
         audio_data=torch.from_numpy(audio_data),
         sample_rate=self.sr,
         label_data=self.frame_labeler.compute_frame_labels(metadata))
예제 #5
0
 def __getitem__(self, idx) -> AudioClipExample:
     metadata = self.metadata_list[idx]
     audio_data = silent_load(str(metadata.path), self.sr, self.mono)
     return AudioClipExample(metadata=metadata,
                             audio_data=torch.from_numpy(audio_data),
                             sample_rate=self.sr)