docs: def square_wave(params, frequency=400, amplitude=1,
                  offset=0, ratio=0.5):
      '''
      Generate a square wave
      :param params: buffer parameters, controls length of signal created
      :param frequency: wave frequency (array or value)
      :param amplitude: wave amplitude (array or value)
      :param offset: offset of wave mean from zero (array or value)
      :param ratio: ratio of high to low time (array or value)
      :return: array of resulting signal
      '''
      frequency = create_buffer(params, frequency)
      amplitude = create_buffer(params, amplitude)
      offset = create_buffer(params, offset)
      ratio = create_buffer(params, ratio)
      phase = np.add.accumulate(frequency / params.sample_rate) % 1
      output = offset + amplitude * np.where(phase < ratio, 1, -1)
      return output