MCPcopy
hub / github.com/descriptinc/descript-audio-codec / preprocess

Method preprocess

dac/model/dac.py:198–207  ·  view source on GitHub ↗
(self, audio_data, sample_rate)

Source from the content-addressed store, hash-verified

196 self.delay = self.get_delay()
197
198 def preprocess(self, audio_data, sample_rate):
199 if sample_rate is None:
200 sample_rate = self.sample_rate
201 assert sample_rate == self.sample_rate
202
203 length = audio_data.shape[-1]
204 right_pad = math.ceil(length / self.hop_length) * self.hop_length - length
205 audio_data = nn.functional.pad(audio_data, (0, right_pad))
206
207 return audio_data
208
209 def encode(
210 self,

Callers 2

forwardMethod · 0.95
compressMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected