def audio_to_label(audio, bits):
    """Normalized audio data tensor to digit array

    Args:
        audio (tensor): audio data
        bits (int): data bits

    Returns:
        array<int>: digit array of audio data
    """
    classes = 2**bits
    # initialize an increasing array with values from -1 to 1
    bins = np.linspace(-1, 1, classes)
    # change value in audio tensor to digits
    quant = np.digitize(audio, bins) - 1
    return quant
Normalized audio data tensor to digit array

Args:
audio (tensor): audio data
bits (int): data bits

Returns:
array<int>: digit array of audio data
utils/dsp.py