MCPcopy Create free account
hub / github.com/espnet/espnet / _convolve_rir

Method _convolve_rir

espnet2/train/preprocessor.py:2127–2144  ·  view source on GitHub ↗
(self, speech, rirs)

Source from the content-addressed store, hash-verified

2125 return data
2126
2127 def _convolve_rir(self, speech, rirs):
2128 rir_path = np.random.choice(rirs)
2129 rir = None
2130 if rir_path is not None:
2131 rir, _ = soundfile.read(rir_path, dtype=np.float64, always_2d=True)
2132
2133 # rir: (Nmic, Time)
2134 rir = rir.T
2135
2136 # normalize rir
2137 rir = rir / np.sqrt(np.sum(rir**2))
2138
2139 # speech: (Nmic, Time)
2140 # Note that this operation doesn't change the signal length
2141 speech = scipy.signal.convolve(speech, rir, mode="full")[
2142 :, : speech.shape[1]
2143 ]
2144 return speech, rir
2145
2146 def _load_noise(self, speech, speech_db, noises, noise_db_low, noise_db_high):
2147 nsamples = speech.shape[1]

Callers 2

_speech_processMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected