def stereo2mono(x):
 if (x.ndim == 1):
  return x
 elif (x.ndim == 2):
  return ((x[:, 1] / 2) + (x[:, 0] / 2))
 else:
  return (-1)

def stereo2mono ( x ) : if ( x . ndim == 1 ) : return x elif ( x . ndim == 2 ) : return ( ( x [ : , 1 ] / 2 ) + ( x [ : , 0 ] / 2 ) ) else : return ( - 1 )
this function converts the input signal to mono .