MCPcopy Create free account
hub / github.com/Stability-AI/stable-audio-tools / Stereo

Class Stereo

stable_audio_tools/data/utils.py:139–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137 return torch.mean(signal, dim=0, keepdims=True) if len(signal.shape) > 1 else signal
138
139class Stereo(nn.Module):
140 def __call__(self, signal):
141 signal_shape = signal.shape
142 # Check if it's mono
143 if len(signal_shape) == 1: # s -> 2, s
144 signal = signal.unsqueeze(0).repeat(2, 1)
145 elif len(signal_shape) == 2:
146 if signal_shape[0] == 1: #1, s -> 2, s
147 signal = signal.repeat(2, 1)
148 elif signal_shape[0] > 2: #?, s -> 2,s
149 signal = signal[:2, :]
150
151 return signal
152
153class VolumeNorm(nn.Module):
154 "Volume normalization and augmentation of a signal [LUFS standard]"

Callers 2

__init__Method · 0.85
wds_preprocessMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected