File size: 617 Bytes
c6dfc69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import numpy


class Augmentation(object):
    """Audio pre-step used by training/inference: int16 waveform -> float in [-1, 1].

    The previous audiomentations-based transforms were commented out and never applied;
    behavior is unchanged: only scaling by 1/32768.
    """

    def __init__(self, mono=True):
        self.mono = mono

    def train_aug(self, x_, sr_):
        x_ = x_ / 32768.0
        return x_

    def test_process(self, x_):
        x_ = x_ / 32768.0
        return x_

    def __call__(self, x, sr, split):
        return self.train_aug(x, sr) if split == "train" else self.test_process(x)