def compression_apply(signal, gain):
    """Applies a predetermined gain function to the input signal. `gain`
        should have been generated previously using the `compress` function.
        
        Parameters
        ----------
        signal : array
            The input signal to be compressed (mono)
        gain : array
            The gain function, generated by `compress`

        Returns
        -------
        sigout : array
            The input signal with the gain function applied

        Notes
        -----
        There is no in-built facility using this function to delay the audio 
        signal relative to the gain control signal (to reduceovershoot 
        effects), which is an option in the compress function.
    
        Adapted from Matlab code provided by Ian Wiggins, Institute of Hearing 
        Research, Nottingham
    """
    lin_gain = 10.0 ** (gain / 20.0)
    sigout = signal * lin_gain
    return sigout
